Skip to main content
Glama

Estimate model cost

estimate_cost
Read-onlyIdempotent

What a model call costs per request, per day and per month at a given volume, from AI Gateway's live prices. Model ids look like 'openai/gpt-4.1-mini' or 'anthropic/claude-sonnet-4.5'.

Input Schema

NameRequiredDescriptionDefault
modelYesA model id like 'openai/gpt-4.1-mini' or 'anthropic/claude-sonnet-4'
cached_shareNoShare of input tokens served from the prompt cache, 0 to 1
input_tokensYesInput tokens per request: system prompt, retrieved documents, history and the user's message
output_tokensYesOutput tokens per request: the length of a typical reply
requests_per_dayYesExpected requests per day, for the monthly cost

Output Schema

NameRequiredDescriptionDefault
modelYes
per_dayYes
per_monthYes
input_shareYesShare of the cost that's input tokens, 0 to 1
per_requestYes
price_sourceYes
prices_per_millionYesDollars per million tokens
cache_saving_per_monthYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / properties / input_tokens / description
      Added value: +"Input tokens per request: system prompt, retrieved documents, history and the user's message"
    • addedInput schema / properties / model / description
      Added value: +"A model id like 'openai/gpt-4.1-mini' or 'anthropic/claude-sonnet-4'"
    • addedInput schema / properties / output_tokens / description
      Added value: +"Output tokens per request: the length of a typical reply"
    • addedInput schema / properties / requests_per_day / description
      Added value: +"Expected requests per day, for the monthly cost"
  2. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": false,
      +  "properties": {
      +    "cache_saving_per_month": {
      +      "type": "number"
      +    },
      +    "input_share": {
      +      "description": "Share of the cost that's input tokens, 0 to 1",
      +      "type": "number"
      +    },
      +    "model": {
      +      "type": "string"
      +    },
      +    "per_day": {
      +      "type": "number"
      +    },
      +    "per_month": {
      +      "type": "number"
      +    },
      +    "per_request": {
      +      "type": "number"
      +    },
      +    "price_source": {
      +      "enum": [
      +        "catalog",
      +        "fallback"
      +      ],
      +      "type": "string"
      +    },
      +    "prices_per_million": {
      +      "additionalProperties": false,
      +      "description": "Dollars per million tokens",
      +      "properties": {
      +        "cached_input": {
      +          "type": "number"
      +        },
      +        "input": {
      +          "type": "number"
      +        },
      +        "output": {
      +          "type": "number"
      +        }
      +      },
      +      "required": [
      +        "input",
      +        "cached_input",
      +        "output"
      +      ],
      +      "type": "object"
      +    }
      +  },
      +  "required": [
      +    "model",
      +    "per_request",
      +    "per_day",
      +    "per_month",
      +    "input_share",
      +    "cache_saving_per_month",
      +    "prices_per_million",
      +    "price_source"
      +  ],
      +  "type": "object"
      +}
  3. First observed

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, openWorldHint and destructiveHint=false, so safety is covered. The description still adds real value by disclosing the data source ('AI Gateway's live prices') and the required model-id format, though it says nothing about behavior for unknown ids or the effect of cached_share on results.

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, no filler. The cost granularities are front-loaded before the id-format hint, so the agent gets the core capability first.

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 an output schema present, return values need no explanation, and the description states the three cost horizons being computed. It is nearly complete; the only soft spot is that the caching dimension (cached_share) that affects the estimate is not acknowledged.

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 defines all five parameters in detail, including ranges and semantics. The model-id examples in the description duplicate the schema's own example, and cached_share is never mentioned, so the description adds little beyond the baseline.

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-equivalent (estimating cost) and resource (a model call), plus the exact output granularities: per request, per day, per month. It does not name any sibling (e.g. compare_models, price_ai_feature, count_tokens), so the agent must infer how it differs from adjacent tools.

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 phrase 'at a given volume', which suggests pre-launch cost planning, but the description never states when to prefer this over siblings like price_ai_feature or compare_models, nor any prerequisites or exclusions.

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.

Resources