Skip to main content
Glama

AI token cost arbitrage

ai_token_arbitrage
Read-onlyIdempotent

Calculate multi-provider LLM API inference token costs, prompt caching economics (up to 95% discount), batch API savings (50%), and cross-model cost disparity multipliers across frontier and high-efficiency models (Anthropic Claude, OpenAI GPT, Google Gemini, DeepSeek).

Behavior: Deterministic, idempotent calculation with zero external side effects. Models official public provider pricing cards per million input/output tokens. Incorporates prompt cache hit pricing reductions and asynchronous batch API discounts. Evaluates real-time pack age and freshness status (FRESH < 14 days, AGING 14-30 days, STALE > 30 days). Returns comprehensive model cost matrix, cheapest and most expensive model arbitrage analysis, cache savings, and monthly cost projections.

Usage Guidelines: Use when budgeting AI agent inference costs, evaluating LLM providers, or deciding whether to implement prompt caching or batch inference. Do not use for cloud network egress; use cloud_egress_finops instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
isBatchNoCamelCase alias for is_batch.
asOfDateNoCamelCase alias for as_of_date.
is_batchNoWhether asynchronous batch processing discount (50%) applies. Alias: isBatch.
as_of_dateYesISO date string (YYYY-MM-DD) for rate-pack historical resolution (e.g. '2026-09-07' for current, '2025-11-15' for 2025-Q4). Alias: asOfDate.
promptTokensNoCamelCase alias for prompt_tokens.
cacheHitRatioNoCamelCase alias for cache_hit_ratio.
prompt_tokensYesNumber of input prompt tokens per API call. Must be a non-negative integer. Alias: promptTokens.
cache_hit_ratioNoProportion of input prompt tokens served from cache (0.0 to 1.0 or 0% to 100%). Default is 0.80 (80%). Alias: cacheHitRatio.
completionTokensNoCamelCase alias for completion_tokens.
completion_tokensYesNumber of generated output completion tokens per API call. Must be a non-negative integer. Alias: completionTokens.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / required
      Previous value: -[
      -  "prompt_tokens",
      -  "completion_tokens"
      -]New value: +[
      +  "prompt_tokens",
      +  "completion_tokens",
      +  "as_of_date"
      +]
  2. Changed2 schema fields changed
    • removedInput schema / properties / completion_tokens / default
      Removed value: -1000
    • removedInput schema / properties / prompt_tokens / default
      Removed value: -5000
  3. Changed15 schema fields changed
    • addedInput schema / properties / asOfDate
      Added value: +{
      +  "description": "CamelCase alias for as_of_date.",
      +  "type": "string"
      +}
    • addedInput schema / properties / as_of_date
      Added value: +{
      +  "description": "ISO date string (YYYY-MM-DD) for rate-pack historical resolution (e.g. '2026-09-07' for current, '2025-11-15' for 2025-Q4). Alias: asOfDate.",
      +  "type": "string"
      +}
    • removedInput schema / properties / cacheHitRatio / default
      Removed value: -0.8
    • changedInput schema / properties / cacheHitRatio / description
      Previous value: -"Proportion of input prompt tokens served from cache (0.0 to 1.0 or 0 to 100%). Default is 0.80 (80%)."New value: +"CamelCase alias for cache_hit_ratio."
    • addedInput schema / properties / cache_hit_ratio
      Added value: +{
      +  "default": 0.8,
      +  "description": "Proportion of input prompt tokens served from cache (0.0 to 1.0 or 0% to 100%). Default is 0.80 (80%). Alias: cacheHitRatio.",
      +  "type": "number"
      +}
    • removedInput schema / properties / completionTokens / default
      Removed value: -1000
    • changedInput schema / properties / completionTokens / description
      Previous value: -"Number of generated output completion tokens per API call. Must be an integer >= 0."New value: +"CamelCase alias for completion_tokens."
    • addedInput schema / properties / completion_tokens
      Added value: +{
      +  "default": 1000,
      +  "description": "Number of generated output completion tokens per API call. Must be a non-negative integer. Alias: completionTokens.",
      +  "type": "number"
      +}
    • removedInput schema / properties / isBatch / default
      Removed value: -false
    • changedInput schema / properties / isBatch / description
      Previous value: -"Whether the 50% asynchronous batch processing discount applies."New value: +"CamelCase alias for is_batch."
    • addedInput schema / properties / is_batch
      Added value: +{
      +  "default": false,
      +  "description": "Whether asynchronous batch processing discount (50%) applies. Alias: isBatch.",
      +  "type": "boolean"
      +}
    • removedInput schema / properties / promptTokens / default
      Removed value: -5000
    • changedInput schema / properties / promptTokens / description
      Previous value: -"Number of input prompt tokens per API call. Must be an integer >= 0."New value: +"CamelCase alias for prompt_tokens."
    • addedInput schema / properties / prompt_tokens
      Added value: +{
      +  "default": 5000,
      +  "description": "Number of input prompt tokens per API call. Must be a non-negative integer. Alias: promptTokens.",
      +  "type": "number"
      +}
    • addedInput schema / required
      Added value: +[
      +  "prompt_tokens",
      +  "completion_tokens"
      +]
  4. Changed4 schema fields changed
    • changedInput schema / properties / cacheHitRatio / description
      Previous value: -"Prompt cache hit ratio (0.0 to 1.0 or 0 to 100%)"New value: +"Proportion of input prompt tokens served from cache (0.0 to 1.0 or 0 to 100%). Default is 0.80 (80%)."
    • changedInput schema / properties / completionTokens / description
      Previous value: -"Output completion token count per API request"New value: +"Number of generated output completion tokens per API call. Must be an integer >= 0."
    • changedInput schema / properties / isBatch / description
      Previous value: -"Whether asynchronous batch API 50% discount applies"New value: +"Whether the 50% asynchronous batch processing discount applies."
    • changedInput schema / properties / promptTokens / description
      Previous value: -"Input prompt token count per API request"New value: +"Number of input prompt tokens per API call. Must be an integer >= 0."
  5. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Even with readOnlyHint and idempotentHint annotations, the description adds behavioral context: deterministic calculation with zero external side effects, official provider pricing cards as data source, cache/batch discount mechanics, and freshness categories. No statement contradicts the annotations.

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?

The definition is organized into Description, Behavior, and Usage Guidelines with the main purpose front-loaded. It is slightly verbose and contains a distracting 'pack age' phrase, but every section carries useful selection and invocation information.

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 deterministic calculation with no output schema, the description adequately names the return products (cost matrix, arbitrage analysis, cache savings, monthly projections), key pricing assumptions, and the routing alternative. Combined with the thorough input schema, an agent can select and invoke this tool correctly.

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?

The schema covers all 10 parameters with types, defaults, aliases, and constraints, so the baseline is 3. The description complements this by explaining the cost mechanics (95% cache discount, 50% batch discount, cache hit ratio) but does not add per-parameter syntax beyond the schema.

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 opens with a specific verb ('Calculate') and a precise resource ('multi-provider LLM API inference token costs'), then enumerates covered economics: caching, batch discounts, and cross-model cost disparity. This clearly differentiates it from financial/egress siblings and gives an agent an unambiguous purpose.

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?

It provides explicit when-to-use scenarios ('budgeting AI agent inference costs', 'evaluating LLM providers', 'deciding whether to implement prompt caching or batch inference') and explicitly says 'Do not use for cloud network egress; use cloud_egress_finops instead'. This is model guidance for selection.

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