Count tokens
An estimate of a Messages request's input tokens, from llm.buzz's own tokenizer, never the provider's. It costs nothing and is not refused for a key's spending limit. The body names the estimate in x-sgr-ignored-parameters as input_tokens->estimated(gateway_tokenizer).
curl -X POST https://api.llm.buzz/api/v1/messages/count_tokens \
-H "Authorization: Bearer $LLM_BUZZ_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-haiku-5.5",
"messages": [
{
"role": "user",
"content": "Say hello in one word."
}
]
}'{
"input_tokens": 14,
"x-sgr-ignored-parameters": [
"input_tokens->estimated(gateway_tokenizer)"
]
}{
"type": "error",
"error": {
"type": "authentication_error",
"message": "A valid API key is required: send x-api-key or Authorization: Bearer."
}
}Authorization
An inference key, as Authorization: Bearer KEY or in x-api-key, the header the Anthropic SDK sends.
Body application/json
modelstringrequiredA model's name from
GET /api/v1/models, such asdeepseek/deepseek-v4.1-flash. A suffix changes one request::floortries the cheapest provider first and:nitrothe fastest. On Chat Completions and Responses:onlineasks for a web search, which llm.buzz does not run today: the request is served without one andx-sgr-ignored-parametersnamesweb_search->dropped(search_unavailable), or for an organization whose requests llm.buzz keeps in the EU it answers 400web_search_unavailable_in_region. On Messages:onlinedoes nothing and is named asmodel:online.messagesobject[]requiredThe conversation, as on Messages.
systemstring or object[]The system prompt: a string, or a list of text blocks, which may carry
cache_control.toolsobject[]Tools, as on Messages.
Response 200
The estimate.
Errors
401Messages keeps Anthropic's error body: a 401 is an
authentication_error, a 402 abilling_error, a 403 apermission_errorand a 429 arate_limit_error.