1
package api
2
3
type ChatMessage struct {
4
Role string `json:"role"`
5
Content string `json:"content"`
6
}
7
8
type MessagesRequest struct {
9
Model string `json:"model"`
10
Messages []ChatMessage `json:"messages"`
11
MaxTokens int `json:"max_tokens"`
12
Temperature float64 `json:"temperature"`
13
}
14
15
type ContentBlock struct {
16
Type string `json:"type"`
17
Text string `json:"text"`
18
}
19
20
type Usage struct {
21
InputTokens int `json:"input_tokens"`
22
CacheCreationInputTokens *int `json:"cache_creation_input_tokens"`
23
CacheReadInputTokens *int `json:"cache_read_input_tokens"`
24
OutputTokens int `json:"output_tokens"`
25
}
26
27
type ErrorResponse struct {
28
Type string `json:"type"`
29
Message string `json:"message"`
30
}
31
32
type MessagesResponse struct {
33
Id string `json:"id"`
34
Type string `json:"type"`
35
Role string `json:"role"`
36
Content []ContentBlock `json:"content"`
37
Model string `json:"model"`
38
StopReason string `json:"stop_reason"`
39
StopSequence bool `json:"stop_sequence"`
40
Usage Usage `json:"usage"`
41
Error *ErrorResponse `json:"error"`
42
}