llm-cost

by comparedge

1 stars
323 downloads
Not rated
GitHub Website

About

Token cost math for LLM API calls: 69 models across 17 providers, prices verified by ComparEdge. Free, no API key.

Details

Author
comparedge
GitHub stars
1
Downloads
323
Categories
Finance, AI, API, Search

- Dollar estimates for a single call or thousands of identical calls.
- Same-call comparison across up to 6 models, cheapest first.
- Monthly budget projection from daily volume.
- Cheapest-model ranking with a context-window floor.
- Batch API and cached-input discounts where the provider offers them.
- Fuzzy model resolution: claude-opus-4-8, Opus 4.8 and anthropic/opus land on the same model.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name llm-cost
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Add npx -y @comparedge/llm-cost-mcp@latest to your MCP client config (Claude Desktop, Cursor, VS Code). Restart the client and six tools appear. No API key, no account.

list_providers

List every LLM API provider ComparEdge tracks, with model count, whether a batch API is available, and the cheapest model per provider. BEHAVIOR: Returns every provider we track (OpenAI, Anthropic, Google, DeepSeek, Amazon, Groq, Mistral, xAI, and more), each with its model count and a one-line cheapest-model summary. Prices are USD per 1M tokens. USAGE GUIDELINES: - Use first when the user asks "which providers exist?" or "who sells the cheapest tokens?". - Use before list_models when you want the provider slug to filter by. - No parameters. EXAMPLE QUERIES: "What LLM providers are there?", "Which providers have a batch API?", "Show me the model vendors you cover"

list_models

List LLM models with their per-1M-token input and output prices, cached-input rate where offered, context window, and tier. Optionally filter to one provider. BEHAVIOR: Returns every model (or just one provider's) with id, display name, input/output/cached rates, context window, and tier (flagship, standard, fast, reasoning). The id is what estimate_cost, compare_models_cost, and monthly_budget expect. USAGE GUIDELINES: - Use to find the exact model id before pricing a call. - Pass provider (a slug like "openai", "anthropic", "google") to narrow the list. - Use cheapest_models instead when the user wants the lowest price rather than a full list. EXAMPLE QUERIES: "List Anthropic models and prices", "What does GPT-5.5 cost per token?", "Show all reasoning models", "Which Gemini models have a 1M context window?"

estimate_cost

Estimate the exact dollar cost of one LLM call, or a batch of identical calls, from input and output token counts. Returns a per-call breakdown plus cached-input and batch-API savings where the model supports them. BEHAVIOR: Resolves the model reference (id or display name, fuzzy matched), then computes input_tokens/1M x input_rate + output_tokens/1M x output_rate. Multiplies by calls for a total. If the model offers cached-input pricing or a batch API, it shows those cheaper totals too. USAGE GUIDELINES: - Use whenever the user knows roughly how many tokens a call reads and writes. - A rough token rule: 1 token is about 4 English characters, or 0.75 words. A page of text is ~500 tokens. - Set calls when the same-shaped request runs many times (e.g. one per support ticket). - Use monthly_budget instead when the user thinks in calls-per-day rather than a fixed batch. - Use compare_models_cost to price the same call across several models at once. EXAMPLE QUERIES: "What does a 10k-token prompt with a 2k-token answer cost on Claude Opus 4.8?", "Price 50,000 GPT-5-mini calls at 800 in / 400 out tokens", "How much for a 200k-token document summarized by Gemini 3.1 Pro?"

compare_models_cost

Price the same call across 2 to 6 models and rank them from cheapest to most expensive, with a multiplier showing how much more each costs than the cheapest option. BEHAVIOR: Resolves each model reference, computes the per-call cost at the given token counts, sorts ascending, and reports each model's cost and its ratio to the cheapest. If any reference cannot be resolved, it says which one and stops so you can correct it. USAGE GUIDELINES: - Use when the user is choosing between named models for a known workload. - Pick the token counts that reflect the real task, not a round guess, so the ranking is meaningful. - Use cheapest_models instead when the user has not named specific models. EXAMPLE QUERIES: "Compare GPT-5.5, Claude Opus 4.8, and Gemini 3.1 Pro for a 5k/1k call", "Cheapest of Haiku 4.5, GPT-5-mini, Gemini 3 Flash for classification", "Opus vs Sonnet vs Fable at 20k in 2k out"

cheapest_models

List the cheapest LLM models, optionally filtered to those with at least a given context window. Ranked by a blended input:output rate. BEHAVIOR: Ranks models by a blended per-1M rate weighted 3:1 input to output (most workloads read more than they write), lowest first. min_context filters out models with a smaller context window. Returns the blended rate plus the raw input and output rates so you can sanity-check against your own token split. USAGE GUIDELINES: - Use when the user wants "the cheapest model" without naming candidates. - Pass min_context when the task needs a large window; it accepts "200" (read as 200K) or "200000" (raw tokens). - Follow up with estimate_cost using the real token split, since the blended ranking is an approximation. EXAMPLE QUERIES: "What are the cheapest LLMs right now?", "Cheapest model with at least a 1M context window", "Five lowest-cost models for high-volume tagging"

monthly_budget

Project the daily, monthly, and yearly spend for a recurring LLM workload from calls-per-day and average token counts. Includes cached-input and batch-API projections where available. BEHAVIOR: Computes per-call cost from average input and output tokens, then scales to daily (x calls), monthly (x30 days), and yearly (x365) totals, and reports the monthly token volume. Cheaper cached-input and batch paths are shown when the model supports them. USAGE GUIDELINES: - Use for planning a feature that calls an LLM on a steady cadence (per ticket, per user action, per cron run). - avg_input_tokens and avg_output_tokens should be typical values, not worst case. - Use estimate_cost instead for a one-off or fixed batch. EXAMPLE QUERIES: "Monthly cost if we run 5,000 Claude Haiku calls a day at 1,200 in / 300 out", "Budget GPT-5-mini for 200 summaries an hour", "Yearly spend on Gemini 3 Flash at 50k calls/day, 500/200 tokens"

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "llm-cost": {
            "llm-cost": {
                "command": "npx",
                "args": [
                    "-y",
                    "@comparedge/llm-cost-mcp@latest"
                ]
            }
        }
    }
}

McpServers

{
    "llm-cost": {
        "command": "npx",
        "args": [
            "-y",
            "@comparedge/llm-cost-mcp@latest"
        ]
    }
}

Token cost math for LLM API calls: 69 models across 17 providers, prices verified by ComparEdge. Free, no API key.

Someone asks what the AI feature will cost at scale, and the honest answer around most teams is a shrug. Rates moved twice since anyone last checked, and the model itself will happily quote prices from its training data. This MCP server keeps current per-million-token rates for 69 models where your assistant can reach them, and does the arithmetic itself.

$ You: price Claude Opus 4.8 on a 25k-token prompt with a 1k answer, run 5,000 times llm-cost › estimate_cost Cost estimate: Claude Opus 4.8 (Anthropic) Rates: input $5/1M, output $25/1M, cached input $0.5/1M Per call (25,000 in + 1,000 out tokens): input: $0.1250 output: $0.0250 per call total: $0.1500 Across 5,000 calls: $750.00 Ways to pay less for the same 5,000 calls: with cached input: $187.50 via batch API: $375.00

Nothing here is rounded or guessed. The rate is verified, date-stamped, and the server multiplied.

$ You: compare that call on Opus 4.8, Sonnet 5, GPT-5.6 Terra and Gemini 3.1 Pro llm-cost › compare_models_cost 25,000 in + 1,000 out, cheapest first: 1. Claude Sonnet 5 $0.0600 /call $300.00 /5k 2. Gemini 3.1 Pro $0.0620 /call $310.00 /5k 3. GPT-5.6 Terra $0.0775 /call $387.50 /5k 4. Claude Opus 4.8 $0.1500 /call $750.00 /5k Ranking uses each model's live feed entry, not remembered prices.

The same numbers answer in a browser through theLLM calculator, and theLLM category hubranks every tracked model by rating and price.

flowchart LR V["provider pricing pages<br/>17 providers"] --> CE["verification<br/>date-stamped checks"] CE --> F["model prices feed<br/>69 models, USD per 1M tokens"] F -->|"6h cache, serve stale on failure"| MCP["llm-cost server<br/>local arithmetic"] MCP --> A["your agent"]

The server never calls a provider API. It reads one public feed,llms-model-prices.json, and computes locally. Nothing to rate-limit, no key to leak, and a network hiccup serves the last good copy instead of an error. How each price gets checked is written up in themethodology, and the catalog behind it ships as anopen datasetunder CC BY 4.0.

Four do the math. Two help you find the exact model id the math wants.

- A page of English prose is roughly 500 tokens; one token is about four characters.
- Model references are forgiving:claude-opus-4-8,Opus 4.8andanthropic/opusresolve to the same model. When the resolver is unsure, it returns candidates instead of guessing.
- cheapest_modelsranks by a blended rate weighting input to output 3 to 1, because real workloads read far more than they write. Confirm the winner withestimate_coston your actual split.

{ "mcpServers": { "llm-cost": { "command": "npx", "args": ["-y", "@comparedge/llm-cost-mcp@latest"] } } }

Claude Desktop keeps this file at~/Library/Application Support/Claude/claude_desktop_config.json. Cursor: Settings, then MCP. VS Code with Copilot reads.vscode/mcp.json. Restart the client; six tools appear. No API key, no account. Per-client walkthroughs live in thesetup guide.

Built byComparEdge, where software prices are checked against vendor pages before anyone quotes them. Two siblings share the data: the full catalog server and a price-change watcher, both onComparEdge MCP.

MIT licensed. JSON-RPC 2.0 over stdio, standard Model Context Protocol.

The Capital.com MCP Server lets your AI assistant talk to your trading account directly. Market data, position checks, trade previews – all in plain language, without leaving your AI tool.

QuickBooks integration using OAuth2. Write operations disabled by default per integration. 550+ tools covering invoices, bills, reports, and inventory. Requires a DataGrout account.

Remote MCP server (Streamable HTTP, read-only, no auth) at https://doc.2328.io/mcp — integration documentation for the 2328 payment platform.

Secure agent purchasing with human-approved virtual cards.

Brazilian Open Finance MCP — connect 30+ banks (Itaú, Nubank, Bradesco, Santander, Inter, BB, Caixa, C6 and more) to Claude/Cursor. 13 read-only tools.

Live MCP server connecting AI agents to 36+ business data sources. OAuth 2.1 PKCE.

Live Dodo Payments API for AI agents — payments, subscriptions, customers, products, refunds, license keys, and usage-based billing via browser OAuth (no API key needed) plus a companion documentation search server.

AI intelligence oracle + cross-border settlement rail. 10-layer Stability Oracle (climate, macro, FX, ESG) with x402 pay-per-call API. USDC/EURC settlement on Base at 1.385% all-in.

US stock market & financial data — SEC filings full-text search, XBRL fundamentals, 13F institutional holdings, insider & congressional trades, earnings-call transcripts, short interest, and FRED macro; 90+ tools, free tier, self-hostable.

Investment analysis for 2,260+ US equities — 43 tools for stock screening, ML earnings predictions, insider/congressional trades, macro signals, Fear & Greed, and alternative data.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.