Count tokens in a message
POST/v1/messages/count_tokens
Counts the input tokens of a Messages API request, as the model would be sent it, Spice's
system prompt and tools included. Only a model with from: anthropic counts tokens: a count
is specific to the model's tokenizer. The request and response follow the Messages API
reference: <https://docs.claude.com/en/api/messages-count-tokens>.
Request​
Responses​
- 200
- 400
- 404
The input token count
The request is invalid, or the model cannot count tokens
The model was not found
