TokenCost MCP server
Ask your AI assistant what an LLM API costs and get today’s numbers from TokenCost instead of a guess from training data. Free, read-only, no API key.
Endpoint
The server speaks MCP over Streamable HTTP, stateless, with plain JSON responses.
https://www.llmapicosts.com/api/mcpConnect your client
Claude Code
claude mcp add --transport http tokencost https://www.llmapicosts.com/api/mcpClaude Desktop
Add it under Settings, Connectors, as a custom connector with the URL above. Or, in claude_desktop_config.json, bridge it with mcp-remote:
{
"mcpServers": {
"tokencost": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://www.llmapicosts.com/api/mcp"]
}
}
}Cursor
In ~/.cursor/mcp.json:
{
"mcpServers": {
"tokencost": { "url": "https://www.llmapicosts.com/api/mcp" }
}
}VS Code
In .vscode/mcp.json:
{
"servers": {
"tokencost": { "type": "http", "url": "https://www.llmapicosts.com/api/mcp" }
}
}Tools
All tools are read-only and answer from the price data bundled with the site. Prices are US dollars per 1 million tokens. Monthly cost uses a 30-day month; the default workload is 2,000 input and 500 output tokens per request, 10,000 requests a day, 40% of input cached.
search_models: Find models by name or provider with prices, context, open-weight flag and ECI score.
Parameters: query?, provider?, limit? (1-25)get_model_price: Full rates (batch included), monthly cost at the default workload, ECI and recent price changes for one model.
Parameters: model (id or name)estimate_cost: Monthly cost of your workload on one model, split into input, cached input and output.
Parameters: model, input_tokens_per_request, output_tokens_per_request, requests_per_day, cached_share? (0-1)compare_models: Side-by-side monthly costs for 2 to 5 models, with the cheapest and percentage gaps.
Parameters: models (2-5 ids or names), workload fields optionalcheapest_models: Rank models by monthly cost, optionally above a minimum ECI score, for one provider or open-weight only.
Parameters: min_eci?, provider?, open_weight_only?, limit?, workload fields optional
Model names are matched loosely (case-insensitive, id or name). If a name is ambiguous the tool lists the candidates to choose from.
Example
curl -s https://www.llmapicosts.com/api/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{
"name":"estimate_cost",
"arguments":{"model":"anthropic-claude-sonnet-5","input_tokens_per_request":2000,
"output_tokens_per_request":500,"requests_per_day":10000,"cached_share":0.4}}}'Every answer ends with a source line and a link to the relevant TokenCost page, so your assistant can cite where the number came from.
Data licence and credit
The data is the same as on the open data page and is released under CC BY 4.0. Please credit TokenCost with a link when you use or republish what the server returns. How prices are collected is described in the methodology.
Fair use
The server is free. There is no key and no hard quota, but it runs on a small hosting plan, so please keep to a reasonable request rate (a few per second at most), and cache answers where you can. Prices refresh once a day. Heavy or commercial use? Get in touch, or download the JSON files from /data instead.