Tokenia MCP Server
Use Tokenia's token counting and LLM cost estimation directly from your agent or IDE — Claude, Cursor, or any client that speaks the Model Context Protocol. Exact token counts for OpenAI and DeepSeek, cost across 100+ models, no sign-up.
Endpoint
Accuracy, stated honestly: token counts are exact for OpenAI and DeepSeek models (official tokenizers) and estimated for every other provider. Every result row carries an exact boolean so you always know which is which. Costs are computed from Tokenia's public pricing dataset.
Connect
claude mcp add --transport http tokenia https://tokenia.live/mcp
~/.cursor/mcp.json (or project .cursor/mcp.json){
"mcpServers": {
"tokenia": {
"type": "http",
"url": "https://tokenia.live/mcp"
}
}
}
Any client that supports the Streamable HTTP transport can connect by pointing at https://tokenia.live/mcp (HTTP POST). The server is stateless — no session handshake to persist.
Tools
count_tokens
Count the tokens in a text and estimate per-model input/output cost across LLM providers. Counts are exact for OpenAI and DeepSeek and estimated for others — every row carries an exact boolean. Optionally filter by provider or model.
textrequired — string, 1–1,000,000 characters. The text to tokenize.provideroptional — string. Filter to one provider key, e.g."openai","anthropic","deepseek".modeloptional — string. Filter to one model id, e.g."gpt-4o".
{ charCount, wordCount, lineCount, modelCount, models: [{ provider, providerName, model, modelName, tokens, exact, inputCostUSD, outputCostUSD, inputPer1M, outputPer1M, contextWindow, fitsContext }] }
estimate_cost
Estimate input + output cost for one model. Provide the input size as inputTokens (a known count) OR text (which is tokenized for that model). With text, exact reflects whether the count is exact (OpenAI/DeepSeek) or estimated; with inputTokens, exact is null (caller-supplied).
modelrequired — string. Model id ("gpt-4o") or"provider:id".outputTokensrequired — integer ≥ 0. Expected output tokens. Pass0explicitly for input-only cost.inputTokensone of — integer ≥ 0. Known input token count. Provide this ortext, not both.textone of — string, 1–1,000,000 chars. Tokenized for the input count. Provide this orinputTokens, not both.
{ model, modelName, inputTokens, outputTokens, inputCostUSD, outputCostUSD, totalCostUSD, exact (boolean | null) }
list_models
List the LLM models Tokenia knows, with input/output price per 1M tokens and context window. exactSupported is true only where an official tokenizer gives exact counts (OpenAI/DeepSeek). Optionally filter by provider or search.
provideroptional — string. Filter to one provider key, e.g."openai".searchoptional — string. Substring filter over model id / name.
{ modelCount, models: [{ provider, model, name, inputPer1M, outputPer1M, contextWindow, exactSupported }] }
compare_models
Compare the cost of a workload across 2+ models. Provide the input size as inputTokens (a known count) OR text (tokenized per model, each row with its own exact flag). Returns per-model totals, the cheapest model, and the savings vs the most expensive.
modelsrequired — array of 2 or more model ids, e.g.["gpt-4o", "claude-sonnet-4-6", "deepseek-v3"].outputTokensrequired — integer ≥ 0. Expected output tokens. Pass0explicitly for input-only cost.inputTokensone of — integer ≥ 0. Known input token count. Provide this ortext, not both.textone of — string, 1–1,000,000 chars. Tokenized per model. Provide this orinputTokens, not both.
{ models: [{ model, modelName, inputTokens, exact, inputCostUSD, outputCostUSD, totalCostUSD }], cheapest, savingsUSD, savingsPct }
Prefer the website? The same data powers the analyzer, the model directory, and the cheapest-by-use-case pages.