Skip to main content
Glama

Estimate cost

estimate_cost

Calculate the USD cost of a model request from published per-million-token rates. Specify input, output, and cache token counts to get an exact estimate.

Instructions

Estimate the USD cost of a request to one model from its published per-million-token rates. Use get_model first if you need to pick an id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesModel id, e.g. 'anthropic/claude-sonnet-4-5' or 'gpt-5.2'.
inputTokensNoNumber of prompt/input tokens.
outputTokensNoNumber of completion/output tokens.
cacheReadTokensNoNumber of cached-input tokens read at the cache-read rate.
cacheWriteTokensNoNumber of tokens written to cache at the cache-write rate.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.2.0

TDQS

A4/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full behavioral burden. It discloses that the calculation is an estimate based on published rates, implying a deterministic read-only computation. However, it doesn't mention caveats like rate staleness, unsupported model IDs, or whether the operation requires network access. This is a baseline level of transparency, not a rich one.

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

Conciseness5/5

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

Two sentences with zero waste. The main action is front-loaded, and the sibling pointer is a short, necessary clause. Every sentence earns its place.

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?

For a low-complexity estimator with a fully documented schema, the description covers the core purpose and the one key prerequisite (use get_model). It lacks an explicit return-value description, but 'estimate the USD cost' implies the result is a monetary value. The 'get_model first' note is a valuable cross-reference that completes the context.

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 coverage is 100% with clear descriptions for all five parameters, so the description doesn't need to repeat them. It does add the useful context that rates are per-million-token, which clarifies why the default inputTokens is 1,000,000. This is a small addition beyond the schema, keeping the score at the baseline.

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

Purpose5/5

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

The description names a specific verb ('Estimate'), a precise object ('USD cost of a request to one model'), and the calculation basis ('published per-million-token rates'). It clearly distinguishes this from the sibling catalog tools like get_model and compare_models by focusing on cost estimation for a single model.

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

Usage Guidelines4/5

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

The description explicitly tells the agent to 'Use get_model first if you need to pick an id', which is a clear prerequisite and routes the agent to the correct sibling. It doesn't discuss when to avoid compare_models, but the single-model scope makes the intended usage context clear enough.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/QAInsights/models-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server