Count tokens
Return an approximate token count for a Gemini request without running the model. This is a fast estimate for pre-flight sizing, not an exact tokenization; the billed token counts on the actual response are authoritative.
Authentication
AuthorizationBearer
Pass your EmpirioLabs API key as a bearer token. The Anthropic-style
x-api-key header is also accepted on every endpoint.
Path parameters
model
An EmpirioLabs chat model id, for example qwen3-7-max.
Request
This endpoint expects an object.
contents
Conversation turns. Roles are user and model.
systemInstruction
generationConfig
tools
toolConfig
safetySettings
Accepted for compatibility.
Response
Token count.
totalTokens
Approximate total token count (estimate
Errors
401
Unauthorized Error
