Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EstimateInputTokens ¶
func EstimateInputTokens(req *CountTokensRequest) int
EstimateInputTokens estimates input tokens for a request
func EstimateOutputTokens ¶
EstimateOutputTokens estimates tokens for output text
Types ¶
type CountTokensRequest ¶
type CountTokensRequest struct {
Model string `json:"model" binding:"required"`
Messages []MessageParam `json:"messages" binding:"required"`
System any `json:"system,omitempty"`
Tools []Tool `json:"tools,omitempty"`
}
CountTokensRequest matches Anthropic's official API specification
type CountTokensResponse ¶
type CountTokensResponse struct {
InputTokens int `json:"input_tokens"`
}
type MessageParam ¶
Click to show internal directories.
Click to hide internal directories.