tokencost-mcp-server
The TokenCost MCP Server provides real-time LLM token pricing data and cost estimation tools for 60+ AI models across 15+ providers (OpenAI, Anthropic, Google, xAI, Meta, Mistral, DeepSeek, and more).
Get Model Pricing (
tokencost_get_model_pricing): Retrieve detailed pricing for a specific model (e.g., GPT-5, Claude Sonnet, Gemini Pro), including input/output costs per 1M tokens, context window size, and max output tokens.Compare Models (
tokencost_compare_models): Side-by-side pricing comparison of 2–10 models simultaneously, showing cost differences to help choose the best option.Estimate Cost (
tokencost_estimate_cost): Calculate the exact USD cost for a given number of input and output tokens with a specific model, broken down by input, output, and total.Find Cheapest Models (
tokencost_find_cheapest): Discover the most cost-effective models, with optional filters by provider, minimum context window, and sorting by input, output, or combined cost.List All Models (
tokencost_list_models): Browse all 60+ available models with IDs, names, and providers, optionally filtered by provider.List Providers (
tokencost_list_providers): View all supported providers with their model counts and pricing ranges.
Pricing data is kept up-to-date within days of official changes and can be queried via natural language through AI assistants like Claude Desktop, Cursor, or Windsurf.
Provides real-time pricing data, cost estimation, and model comparisons for Amazon AI models like Nova.
Provides real-time pricing data, cost estimation, and model comparisons for Google AI models like Gemini.
Provides real-time pricing data, cost estimation, and model comparisons for Meta AI models like Llama.
Provides real-time pricing data, cost estimation, and model comparisons for NVIDIA AI models.
Provides real-time pricing data, cost estimation, and model comparisons for OpenAI AI models like GPT-4 and GPT-5.
Provides real-time pricing data, cost estimation, and model comparisons for Perplexity AI models.
TokenCost MCP Server
An MCP (Model Context Protocol) server that provides real-time LLM token pricing data for 60+ AI models across 15 providers.
Query, compare, and estimate costs for models from OpenAI, Anthropic, Google, Meta, xAI, Mistral, DeepSeek, and more — directly from your AI assistant.
Built by TokenCost — the free LLM token cost calculator.
Tools
Tool | Description |
| Get pricing for a specific model |
| Side-by-side pricing comparison |
| Calculate cost for given token counts |
| Find cheapest models with filters |
| List all available models |
| List all providers with pricing ranges |
Related MCP server: UsageWall
Quick Start
Claude Desktop / Cursor / Windsurf
Add to your MCP config:
{
"mcpServers": {
"tokencost": {
"command": "npx",
"args": ["-y", "tokencost-mcp-server"]
}
}
}From Source
git clone https://github.com/ankit-aglawe/tokencost-mcp-server
cd tokencost-mcp-server
npm install
npm run build
npm startExample Usage
"How much would it cost to process 1M input tokens with GPT-5?"
→ Uses tokencost_estimate_cost with model="gpt-5", input_tokens=1000000, output_tokens=0
"Compare Claude Sonnet 4.6 vs GPT-5 vs Gemini 3 Pro pricing"
→ Uses tokencost_compare_models with ["claude-sonnet-4.6", "gpt-5", "gemini-3-pro"]
"What's the cheapest model with at least 200K context?"
→ Uses tokencost_find_cheapest with min_context=200000
Supported Providers
OpenAI, Anthropic, Google, xAI, Meta, Mistral, DeepSeek, Alibaba (Qwen), Amazon (Nova), NVIDIA, Cohere, Perplexity, Moonshot (Kimi), Zhipu (GLM), MiniMax
Pricing Data
Pricing is kept accurate and up to date by the TokenCost team. We track official provider announcements and update pricing as soon as changes are published — new models, price cuts, and deprecations are reflected within days.
If you notice outdated pricing or a missing model, open an issue and we'll get it updated.
License
MIT
Available Tools
6 toolstokencost_compare_modelsCompare Model PricingARead-onlyIdempotent
Compare pricing across multiple LLM models side by side.
Args:
models (string[]): Array of model IDs or names to compare (2-10 models)
Returns: Side-by-side comparison table with input/output costs, context windows, and relative cost differences.
Examples:
["gpt-5", "claude-sonnet-4.6"] → Compare OpenAI vs Anthropic pricing
["gpt-5-mini", "gemini-3-flash", "claude-haiku-4.5"] → Compare budget models
Inputs: models (required).
tokencost_estimate_costEstimate Token CostARead-onlyIdempotent
Calculate the cost for a specific number of input and output tokens with a given model.
Args:
model (string): Model ID or name
input_tokens (number): Number of input tokens (0 to 100B)
output_tokens (number): Number of output tokens (0 to 100B)
Returns: Cost breakdown with input cost, output cost, and total cost in USD.
Examples:
model="gpt-5", input_tokens=1000, output_tokens=500 → Cost for a typical API call
model="claude-sonnet-4.6", input_tokens=100000, output_tokens=4000 → Cost for a long context call
Inputs: model (required), input_tokens (required), output_tokens (required).
tokencost_find_cheapestFind Cheapest ModelsARead-onlyIdempotent
Find the cheapest LLM models, optionally filtered by provider or minimum context window.
Args:
provider (string, optional): Filter by provider (e.g., "OpenAI", "Anthropic", "Google")
min_context (number, optional): Minimum context window size in tokens
sort_by (string, optional): Sort by "input", "output", or "combined" cost (default: "combined")
limit (number, optional): Number of results to return (default: 10, max: 30)
Returns: Ranked list of cheapest models with pricing details.
Examples:
{} → Top 10 cheapest models overall
{ provider: "OpenAI" } → Cheapest OpenAI models
{ min_context: 200000, sort_by: "input" } → Cheapest 200K+ context models by input price
Inputs: provider, min_context, sort_by, limit.
tokencost_get_model_pricingGet Model PricingARead-onlyIdempotent
Get pricing details for a specific LLM model.
Args:
model (string): Model ID or name to look up (e.g., "gpt-5", "claude-sonnet-4.6", "gemini-3-pro")
Returns: Model pricing details including input/output costs per 1M tokens, context window, and max output. Returns an error message if the model is not found, with suggestions for similar models.
Examples:
"gpt-5" → GPT-5 pricing from OpenAI
"claude-opus-4.6" → Claude Opus 4.6 pricing from Anthropic
"gemini" → First matching Gemini model
Inputs: model (required).
tokencost_list_modelsList All ModelsARead-onlyIdempotent
List all available LLM models with pricing data, optionally filtered by provider.
Args:
provider (string, optional): Filter by provider (e.g., "OpenAI", "Anthropic", "Google")
Returns: List of all models with IDs, names, and providers. Use model IDs with other tools.
Examples:
{} → All 60+ models
{ provider: "Anthropic" } → All Anthropic Claude models
Inputs: provider.
tokencost_list_providersList ProvidersARead-onlyIdempotent
List all LLM providers with model counts and pricing ranges.
Returns: All providers with the number of models and pricing range for each.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose with no overlap: compare_models for side-by-side comparisons, estimate_cost for specific token calculations, find_cheapest for budget optimization, get_model_pricing for detailed lookups, list_models for catalog browsing, and list_providers for provider overview. The descriptions clearly differentiate their functions, eliminating any confusion about which tool to use for a given task.
All tools follow a perfect verb_noun pattern with the 'tokencost_' prefix: compare_models, estimate_cost, find_cheapest, get_model_pricing, list_models, and list_providers. The naming is completely consistent, using descriptive verbs that accurately reflect each tool's function, making the set highly predictable and easy to navigate.
Six tools is an ideal number for this server's purpose of LLM cost analysis. Each tool serves a distinct, valuable function in the workflow—from browsing models and providers to detailed comparisons and cost estimations—without any redundancy. The count is well-scoped, covering all essential operations without being overwhelming or insufficient for the domain.
The tool set provides complete coverage for LLM cost analysis: list_providers and list_models for discovery, get_model_pricing for detailed lookups, estimate_cost for calculations, compare_models for side-by-side analysis, and find_cheapest for optimization. There are no obvious gaps; agents can perform all typical cost-related tasks from exploration to decision-making without dead ends.
Maintenance
Related MCP Connectors
Hosted MCP server for LLM cost estimation, model comparison, and budget-aware routing.
LLM cost optimization gateway, repo token-waste auditor & model arbitrage MCP server.
MCP server for building and testing AI agents with multi-model experimentation and insights.
Connect MCP clients to 2,000+ AI models without managing provider API keys.
Related MCP Servers
- AlicenseBqualityDmaintenanceA Model Context Protocol (MCP) server that optimizes token usage by caching data during language model interactions, compatible with any language model and MCP client.42ISC
- AlicenseNot gradedqualityDmaintenanceLive LLM pricing as an MCP server. Ask Claude or any MCP client 'how much does this prompt cost?' and get real numbers from a hand-checked pricing table for every major LLM.MIT
- AlicenseAqualityFmaintenanceMCP server that provides AI assistants with real-time, current information about AI models from OpenAI, Anthropic, and Google, including pricing, capabilities, and context windows.423 PyPIMIT
- AlicenseAqualityBmaintenanceDaily-verified LLM API pricing dataset (44+ models, CN & global) with a hosted MCP server for live price queries and token cost estimation.2CC BY-4.0