Estimate token counts per tokenizer
count_tokensEstimate how many tokens a text is for each tokenizer family (OpenAI o200k, Claude legacy and 2026, Gemini, DeepSeek, Mistral, Qwen), with an error band. Estimates only; for exact counts use the provider's count endpoint.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "count_tokens"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | Prompt text. Counted with an estimator, never stored. | |
| models | No | Model ids to compare, e.g. ["claude-sonnet-5-5", "gpt-6.2-sol", "gemini-3.8-flash"]. Omit to compare every listed model. list_models gives every id. | |
| messages | No | Chat messages [{role, content}]. Counted with an estimator, never stored. |