Skip to main content
Glama

Estimate the cost of LLM calls

estimate_llm_cost
Read-onlyIdempotent

USD cost of a call to a model from its token counts, at list price, and the total for a number of such calls.

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>",
      "inputTokens": "<inputTokens>",
      "outputTokens": "<outputTokens>"
    },
    "name": "estimate_llm_cost"
  }
}

Input Schema

NameRequiredDescriptionDefault
callsNoNumber of calls like this one.
modelYesModel id.
inputTokensYesPrompt tokens per call, including any cached ones.
cachedTokensNoHow many of the prompt tokens are read from the prompt cache.
outputTokensYesReply tokens per call.
cacheWriteTokensNoPrompt tokens written to the cache (Anthropic).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare readOnly, idempotent, non-destructive, closed-world, so the safety profile is covered. The description adds useful behavior beyond that: pricing is at list price (no discounts or margins) and the result aggregates across 'calls', which is real information the annotations do not convey.

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 sentence with no filler, front-loading what is returned (USD cost) before the aggregation clause. The trailing 'total for a number of such calls' is slightly convoluted but still compact and informative.

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

Completeness4/5

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

With 6 fully documented parameters, no nested objects, and no output schema, the description covers the essentials and states what comes back (per-call cost and total). Only the absence of explicit alternative-routing guidance keeps it from being complete.

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 every parameter including cachedTokens and cacheWriteTokens is documented in the schema. The description only implicitly echoes token counts and the call multiplier without adding format or pricing-tier detail, so the baseline 3 applies.

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 gives a specific verb-plus-resource: it computes the USD cost of a model call from token counts and the aggregate for multiple calls. 'At list price' meaningfully separates it from pricing/margin siblings such as get_margin_overview and get_cost_breakdown, though it never names an alternative explicitly.

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

Usage Guidelines2/5

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

Usage is only implied. The phrasing suggests estimating a hypothetical call rather than reporting recorded spend, but there is no explicit when-to-use, when-not, or pointer to compare_llm_costs/get_cost_breakdown for the neighboring cases.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.