anthropic_passthrough
Count Tokens
Count tokens for Anthropic Messages API format.
This endpoint follows the Anthropic Messages API token counting specification. It accepts the same parameters as the /v1/messages endpoint but returns token counts instead of generating a response.
Example usage:
curl -X POST "http://localhost:4000/v1/messages/count_tokens?beta=true" -H "Content-Type: application/json" -H "Authorization: Bearer your-key" -d '{
"model": "claude-3-sonnet-20240229",
"messages": [{"role": "user", "content": "Hello Claude!"}]
}'
Returns: {"input_tokens": <number>}
post/v1/messages/count_tokens
Request
- Base URL: https://docs.litellm.com.cn (the document declares no server; this is the origin it was published from)
- URL: https://docs.litellm.com.cn/v1/messages/count_tokens
- Auth: API key in header x-litellm-api-key
Response
Successful Response
unknown required
Changes
No recorded changes to this operation across all 1 revision of this API.