Skip to main content
Glama

OptimToken: AI and Compute Economics

Estimate LLM Cost

estimate-llm-cost
Read-onlyIdempotent

Cost a workload with EXACT numbers the caller supplies: arbitrary token counts per request and any monthly volume, not just the 10k/100k/1m presets the other cost tools use. Use this for 'about 800 in and 200 out, 4 million calls a month', or to price one named model across every use-case profile. To compare 2-4 named models like for like at a preset volume, use compare-models-side-by-side instead. Provide a model name to get detailed cost breakdowns, or compare costs across all use case presets. Each figure comes twice: list price, and the optimized price achievable with prompt caching and the batch API. The presets carry their own cache-hit and batch assumptions; a custom token shape carries none unless cacheHitRate and/or batchEligible are passed with it, and each cost entry states which applied in optimizationBasis. Cost figures are final as returned: rounded server-side and dated by provenance, with the lever behind each saving, or the reason there is none, named in the text.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "estimate-llm-cost"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelNameNoModel name, e.g. 'GPT-4o'. A partial name matches up to 5 models and ALL of them are costed. If omitted, the first 8 catalogue entries are used — that is catalogue order, not a quality ranking.
cacheHitRateNoShare of input tokens served from the prompt cache, 0 to 1: for example 0.6 for a stable system prompt and tool definitions re-sent on every call. Only valid with customInputTokens and customOutputTokens; the presets carry their own and cannot be overridden. Omitting it means no caching is assumed, not that none is achievable.
batchEligibleNoWhether this workload is asynchronous and can go through the batch API. Only valid with customInputTokens and customOutputTokens; the presets carry their own. Omitting it means no batch discount is assumed, not that the workload is ineligible.
monthlyVolumeNoExact monthly request count, any integer (default 100,000). This tool does not take the 10k/100k/1m presets the other cost tools use.
useCasePresetNoWorkload shape, which sets tokens per request: supportTicket (1.5k in / 500 out), knowledgeQA (2k / 800), meetingSummary (10k / 1.2k, batch-eligible), marketingContent (2.5k / 1.8k), codingTask (3k / 2k), invoiceProcessing (1.5k / 600, batch-eligible), callSummary (2k / 700, batch-eligible), agentWorkflow (6k / 3k). Default: every preset.
customInputTokensNoCustom input tokens per request. Must be supplied TOGETHER with customOutputTokens — either alone is ignored and the preset is used. A custom shape assumes no cacheable prefix and no batch eligibility unless cacheHitRate / batchEligible say otherwise, so without them its optimized cost equals its list cost.
customOutputTokensNoCustom output tokens per request. Must be supplied TOGETHER with customInputTokens — either alone is ignored and the preset is used.

Output Schema

NameRequiredDescriptionDefault
errorNo
sourceYes
volumeYes
eloAsOfYes
dataAsOfNo
modelCostsYes
provenanceNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / additionalProperties
      Added value: +false
  2. Changed2 schema fields changed
    • addedOutput schema / properties / modelCosts / items / properties / model / properties / deprecation
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "replacement": {
      +      "type": "string"
      +    },
      +    "shutdown": {
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
    • addedOutput schema / properties / provenance / properties / deprecationsVerifiedAt
      Added value: +{
      +  "type": "string"
      +}
  3. Changed1 schema field changed
    • addedOutput schema / properties / provenance / properties / hostPricingAsOf
      Added value: +{
      +  "type": "string"
      +}
  4. Changed9 schema fields changed
    • addedInput schema / properties / batchEligible
      Added value: +{
      +  "description": "Whether this workload is asynchronous and can go through the batch API. Only valid with customInputTokens and customOutputTokens; the presets carry their own. Omitting it means no batch discount is assumed, not that the workload is ineligible.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / cacheHitRate
      Added value: +{
      +  "description": "Share of input tokens served from the prompt cache, 0 to 1: for example 0.6 for a stable system prompt and tool definitions re-sent on every call. Only valid with customInputTokens and customOutputTokens; the presets carry their own and cannot be overridden. Omitting it means no caching is assumed, not that none is achievable.",
      +  "maximum": 1,
      +  "minimum": 0,
      +  "type": "number"
      +}
    • changedInput schema / properties / customInputTokens / description
      Previous value: -"Custom input tokens per request. Must be supplied TOGETHER with customOutputTokens — either alone is ignored and the preset is used. A custom shape assumes no cacheable prefix and no batch eligibility, so its optimized cost equals its list cost."New value: +"Custom input tokens per request. Must be supplied TOGETHER with customOutputTokens — either alone is ignored and the preset is used. A custom shape assumes no cacheable prefix and no batch eligibility unless cacheHitRate / batchEligible say otherwise, so without them its optimized cost equals its list cost."
    • addedOutput schema / properties / modelCosts / items / properties / costs / items / properties / cacheHitRate
      Added value: +{
      +  "type": "number"
      +}
    • addedOutput schema / properties / modelCosts / items / properties / costs / items / properties / optimizationBasis
      Added value: +{
      +  "enum": [
      +    "preset",
      +    "caller-supplied",
      +    "none-supplied"
      +  ],
      +  "type": "string"
      +}
    • changedOutput schema / properties / modelCosts / items / properties / costs / items / required
      Previous value: -[
      -  "useCase",
      -  "inputTokens",
      -  "outputTokens",
      -  "perRequest",
      -  "monthly",
      -  "perRequestOptimized",
      -  "monthlyOptimized",
      -  "savingsPct",
      -  "batchEligible",
      -  "cacheEligible",
      -  "batchApplied",
      -  "cacheApplied"
      -]New value: +[
      +  "useCase",
      +  "inputTokens",
      +  "outputTokens",
      +  "perRequest",
      +  "monthly",
      +  "perRequestOptimized",
      +  "monthlyOptimized",
      +  "savingsPct",
      +  "batchEligible",
      +  "cacheEligible",
      +  "batchApplied",
      +  "cacheApplied",
      +  "cacheHitRate",
      +  "optimizationBasis"
      +]
    • addedOutput schema / properties / modelCosts / items / properties / model / properties / cacheWritePricePer1M
      Added value: +{
      +  "type": "number"
      +}
    • addedOutput schema / properties / modelCosts / items / properties / model / properties / outlierListing
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / modelCosts / items / properties / model / properties / promotionalListing
      Added value: +{
      +  "type": "boolean"
      +}
  5. Changed11 schema fields changed
    • changedInput schema / properties / customInputTokens / description
      Previous value: -"Custom input tokens per request (overrides preset)"New value: +"Custom input tokens per request. Must be supplied TOGETHER with customOutputTokens — either alone is ignored and the preset is used. A custom shape assumes no cacheable prefix and no batch eligibility, so its optimized cost equals its list cost."
    • changedInput schema / properties / customOutputTokens / description
      Previous value: -"Custom output tokens per request (overrides preset)"New value: +"Custom output tokens per request. Must be supplied TOGETHER with customInputTokens — either alone is ignored and the preset is used."
    • changedInput schema / properties / modelName / description
      Previous value: -"Model name to estimate costs for (e.g. 'GPT-4o', 'Claude Sonnet 4'). If omitted, shows top models."New value: +"Model name, e.g. 'GPT-4o'. A partial name matches up to 5 models and ALL of them are costed. If omitted, the first 8 catalogue entries are used — that is catalogue order, not a quality ranking."
    • changedInput schema / properties / monthlyVolume / description
      Previous value: -"Custom monthly volume (default: 100,000)"New value: +"Exact monthly request count, any integer (default 100,000). This tool does not take the 10k/100k/1m presets the other cost tools use."
    • changedInput schema / properties / useCasePreset / description
      Previous value: -"Use case preset. Default: all presets."New value: +"Workload shape, which sets tokens per request: supportTicket (1.5k in / 500 out), knowledgeQA (2k / 800), meetingSummary (10k / 1.2k, batch-eligible), marketingContent (2.5k / 1.8k), codingTask (3k / 2k), invoiceProcessing (1.5k / 600, batch-eligible), callSummary (2k / 700, batch-eligible), agentWorkflow (6k / 3k). Default: every preset."
    • addedOutput schema / properties / modelCosts / items / properties / costs / items / properties / batchApplied
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / modelCosts / items / properties / costs / items / properties / batchEligible
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / modelCosts / items / properties / costs / items / properties / cacheApplied
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / modelCosts / items / properties / costs / items / properties / cacheEligible
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / modelCosts / items / properties / costs / items / properties / savingsPct
      Added value: +{
      +  "type": "number"
      +}
    • changedOutput schema / properties / modelCosts / items / properties / costs / items / required
      Previous value: -[
      -  "useCase",
      -  "inputTokens",
      -  "outputTokens",
      -  "perRequest",
      -  "monthly",
      -  "perRequestOptimized",
      -  "monthlyOptimized"
      -]New value: +[
      +  "useCase",
      +  "inputTokens",
      +  "outputTokens",
      +  "perRequest",
      +  "monthly",
      +  "perRequestOptimized",
      +  "monthlyOptimized",
      +  "savingsPct",
      +  "batchEligible",
      +  "cacheEligible",
      +  "batchApplied",
      +  "cacheApplied"
      +]
  6. Changed2 schema fields changed
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / properties / provenance
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "catalogTotal": {
      +      "type": "number"
      +    },
      +    "dataAsOf": {
      +      "type": "string"
      +    },
      +    "eloAsOf": {
      +      "type": "string"
      +    },
      +    "label": {
      +      "type": "string"
      +    },
      +    "notice": {
      +      "type": "string"
      +    },
      +    "pricesVerified": {
      +      "type": "boolean"
      +    },
      +    "source": {
      +      "type": "string"
      +    },
      +    "tier": {
      +      "type": "number"
      +    },
      +    "upstreamSchemaVersion": {
      +      "type": "string"
      +    },
      +    "upstreamSource": {
      +      "type": "string"
      +    },
      +    "upstreamTimestamp": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "tier",
      +    "source",
      +    "label",
      +    "pricesVerified",
      +    "eloAsOf"
      +  ],
      +  "type": "object"
      +}
  7. Changed2 schema fields changed
    • changedOutput schema / $schema
      Previous value: -"https://json-schema.org/draft/2020-12/schema"New value: +"http://json-schema.org/draft-07/schema#"
    • removedOutput schema / properties / provenance
      Removed value: -{
      -  "additionalProperties": false,
      -  "properties": {
      -    "catalogTotal": {
      -      "type": "number"
      -    },
      -    "dataAsOf": {
      -      "type": "string"
      -    },
      -    "eloAsOf": {
      -      "type": "string"
      -    },
      -    "label": {
      -      "type": "string"
      -    },
      -    "notice": {
      -      "type": "string"
      -    },
      -    "pricesVerified": {
      -      "type": "boolean"
      -    },
      -    "source": {
      -      "type": "string"
      -    },
      -    "tier": {
      -      "type": "number"
      -    },
      -    "upstreamSchemaVersion": {
      -      "type": "string"
      -    },
      -    "upstreamSource": {
      -      "type": "string"
      -    },
      -    "upstreamTimestamp": {
      -      "type": "string"
      -    }
      -  },
      -  "required": [
      -    "tier",
      -    "source",
      -    "label",
      -    "pricesVerified",
      -    "eloAsOf"
      -  ],
      -  "type": "object"
      -}
  8. Changed2 schema fields changed
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / properties / provenance
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "catalogTotal": {
      +      "type": "number"
      +    },
      +    "dataAsOf": {
      +      "type": "string"
      +    },
      +    "eloAsOf": {
      +      "type": "string"
      +    },
      +    "label": {
      +      "type": "string"
      +    },
      +    "notice": {
      +      "type": "string"
      +    },
      +    "pricesVerified": {
      +      "type": "boolean"
      +    },
      +    "source": {
      +      "type": "string"
      +    },
      +    "tier": {
      +      "type": "number"
      +    },
      +    "upstreamSchemaVersion": {
      +      "type": "string"
      +    },
      +    "upstreamSource": {
      +      "type": "string"
      +    },
      +    "upstreamTimestamp": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "tier",
      +    "source",
      +    "label",
      +    "pricesVerified",
      +    "eloAsOf"
      +  ],
      +  "type": "object"
      +}
  9. First observed

TDQS

A4.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, non-destructive and open-world, so the safety profile is covered; the description usefully adds that every figure is returned twice (list and optimized), that custom token shapes assume no caching/batch unless flags are passed, and that results are server-rounded and dated via `provenance`. That is real value beyond the annotations. It stops short of describing pagination, error behavior, or how partial-name ambiguity beyond the 5-match cap is surfaced, so it is good but not exhaustive.

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?

Front-loaded with purpose, then the sibling exclusion, then mode selection, then the pricing semantics — a sensible order. It is dense but mostly earns its length; the main waste is the repeated statement that presets carry their own cache-hit and batch assumptions, which appears twice in near-identical form.

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

Completeness5/5

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

For a 7-parameter, zero-required, read-only estimation tool with an output schema, the description covers purpose, alternatives, mode selection, defaulting behavior, and the meaning of the optimizationBasis/provenance fields. Nothing an agent needs to invoke it correctly or interpret the response appears to be missing.

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 per-parameter meaning is already fully documented, including the customInputTokens/customOutputTokens pairing, cacheHitRate's 'omitting means no caching assumed', and the preset token shapes. The description largely restates these ('a custom token shape carries none unless cacheHitRate and/or batchEligible are passed'), adding framing but little new parameter meaning. Baseline 3 is appropriate.

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?

States a specific verb and resource ('Cost a workload') plus the defining scope: exact caller-supplied token counts and arbitrary monthly volume, in contrast to preset-driven siblings. It also names what the tool is not ('not just the 10k/100k/1m presets the other cost tools use'), so an agent can separate it from the preset cost tools without opening a schema.

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

Usage Guidelines5/5

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

Gives a concrete usage example ('about 800 in and 200 out, 4 million calls a month') and an explicit alternative with the selecting condition: use compare-models-side-by-side for 2-4 named models at a preset volume. It also routes two internal modes (single model breakdown vs. all use-case presets), so the when-to-use decision is fully covered.

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.