Skip to main content
Glama

Calculate monthly API cost

calculate_api_cost

Calculates monthly and yearly LLM API costs from tokens per request, requests per day, and cache hit rate, then lists cheaper alternative models for the same workload.

Instructions

Calculates what an LLM API workload costs per month and per year from input/output tokens per request, requests per day and the share of input served from cache, and names the cheapest alternatives for the same workload. Mirrors https://aicostdesk.com/llm-api-calculator.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "model": "<model>"
    },
    "name": "calculate_api_cost"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelYesModel id or name, e.g. "gpt-6.2-sol" or "Claude Sonnet 5.5".
alternativesNoHow many cheaper alternative models to show. Default 3.
input_tokensNoInput tokens per request. Default 1500.
output_tokensNoOutput tokens per request. Default 500.
cache_hit_rateNoShare of input tokens served from prompt cache, 0-1 (0.9) or percent (90). Default 0.
days_per_monthNoBilling days per month. Default 30.
requests_per_dayNoRequests (or messages, jobs) per day. Default 1000.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It usefully signals that this is a pure estimation with no side effects and discloses provenance ('Mirrors https://aicostdesk.com/llm-api-calculator'), which implies a fixed pricing reference. It does not state the currency, how current the pricing data is, whether the calculation is deterministic, or what happens with an unrecognized model id.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence that leads with the verb and the primary output, then layers in inputs and the secondary output. It is dense but readable and contains no filler; the trailing source URL is short and earns its place as provenance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 7-parameter estimation tool with no annotations and no output schema, the description does partially describe the return shape (monthly and yearly cost plus a ranked list of cheaper models), which is the most important missing piece. Still absent are currency, whether costs are itemized per model, and error behavior for unknown models — gaps that matter given there is no output schema to fall back on.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents defaults, ranges, and the dual 0-1 / 0-100 interpretation of cache_hit_rate. The description restates a subset of those inputs (tokens, requests per day, cache share) and ties the alternatives parameter to 'cheapest alternatives', but adds no format or unit detail beyond what the schema provides. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb and resource ('Calculates what an LLM API workload costs per month and per year') and enumerates the exact inputs that drive the result (input/output tokens per request, requests per day, cache share) plus a secondary output ('names the cheapest alternatives'). It is clearly a cost-estimation tool and is distinguishable from compare_two_models or compare_subscription_vs_api, though it never names those siblings to draw the contrast explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied by the purpose: an agent can infer this is the tool for 'what will this workload cost per month', and the mention of naming cheaper alternatives hints at the alternatives parameter. However, there is no explicit when-to-use/when-not statement and no routing to compare_two_models or compare_subscription_vs_api for comparison-style questions, so the agent must infer the boundary itself.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.