Skip to main content
Glama

Estimate Model API Cost

rai_cost_estimate
Read-onlyIdempotent

Estimate the USD cost of a model API call from token counts by specifying model, provider, input tokens, and output tokens.

Instructions

Estimate the USD cost of a model API call from token counts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYesModel name, e.g. gpt-4o
providerYesProvider: openai | anthropic | google | mistral
input_tokensYes
output_tokensYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.6

TDQS

C2.6/5.0
Behavior2/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false and openWorldHint=false, so the safety profile is covered. The description adds only that the output is expressed in USD and derived from token counts; it says nothing about pricing-data staleness, whether it is a pure computation, or what form the estimate takes.

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

Conciseness3/5

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

A single front-loaded sentence with no filler, which is good, but it is under-specified rather than genuinely concise — there is simply not enough content to be wasteful.

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

Completeness2/5

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

Four required parameters, 50% schema coverage, and no output schema. The description never says what the tool returns (a bare number, a currency-formatted string, a breakdown per token type), which for a cost-estimation tool an agent genuinely needs in order to use the result.

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

Parameters2/5

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

Schema coverage is only 50% — input_tokens and output_tokens have no schema description at all. The phrase 'from token counts' weakly gestures at them but adds no units, granularity, or counting convention, so the description does not compensate for the coverage hole.

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?

States a specific verb (estimate) plus resource (USD cost of a model API call) and the inputs it derives them from (token counts). It is clear on its own, but it does not differentiate itself from siblings like rai_compare_models or rai_budget_check, which touch adjacent cost/model concerns.

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?

The description offers no when-to-use guidance, no alternatives, and no prerequisites beyond the implicit 'you must have token counts'. With ~30 sibling tools in this family, the absence of any routing hint is a real gap.

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