forked from sashabaranov/go-openai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.go
24 lines (20 loc) · 939 Bytes
/
common.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package openai
// common.go defines common types used throughout the OpenAI API.
// Usage Represents the total token usage per request to OpenAI.
type Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
PromptTokensDetails *PromptTokensDetails `json:"prompt_tokens_details"`
CompletionTokensDetails *CompletionTokensDetails `json:"completion_tokens_details"`
}
// CompletionTokensDetails Breakdown of tokens used in a completion.
type CompletionTokensDetails struct {
AudioTokens int `json:"audio_tokens"`
ReasoningTokens int `json:"reasoning_tokens"`
}
// PromptTokensDetails Breakdown of tokens used in the prompt.
type PromptTokensDetails struct {
AudioTokens int `json:"audio_tokens"`
CachedTokens int `json:"cached_tokens"`
}