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.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputsNo
matrixNo
arbitrageNo
freshnessNo
disclaimerNo
rate_pack_idNo
token_distributionNo
statutory_authorityNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "arbitrage": {
      +      "type": [
      +        "object",
      +        "null"
      +      ]
      +    },
      +    "disclaimer": {
      +      "type": [
      +        "string",
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "freshness": {
      +      "type": [
      +        "object",
      +        "null"
      +      ]
      +    },
      +    "inputs": {
      +      "type": [
      +        "object",
      +        "null"
      +      ]
      +    },
      +    "matrix": {
      +      "type": [
      +        "object",
      +        "null"
      +      ]
      +    },
      +    "rate_pack_id": {
      +      "type": [
      +        "string",
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "statutory_authority": {
      +      "type": [
      +        "string",
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "token_distribution": {
      +      "type": [
      +        "object",
      +        "null"
      +      ]
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed1 schema field changed
    • changedInput schema / required
      Previous value: -[
      -  "prompt_tokens",
      -  "completion_tokens"
      -]New value: +[
      +  "prompt_tokens",
      +  "completion_tokens",
      +  "as_of_date"
      +]
  3. Changed2 schema fields changed
    • removedInput schema / properties / completion_tokens / default
      Removed value: -1000
    • removedInput schema / properties / prompt_tokens / default
      Removed value: -5000
  4. 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"
      +]
  5. 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."
  6. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive, closed-world, so 'deterministic, idempotent, zero side effects' partly restates structured data. However, the description adds real behavioral substance: pricing is modeled per million input/output tokens, cache discounts up to 95% and batch discounts at 50% are applied, and a freshness tiering system (FRESH <14d, AGING 14-30d, STALE >30d) governs rate-pack resolution.

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 text is front-loaded and organized into labeled Behavior and Usage Guidelines sections, with no filler. It runs somewhat long for a single-function calculator, and a minor typo ('pack age') slightly blunts polish, but every sentence carries 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?

With an output schema present, rich annotations, and 100% schema description coverage, the description only needs to supply purpose, behavior, and routing — all of which it does, including the sibling exclusion. Nothing an agent needs to invoke this correctly is missing.

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

Parameters4/5

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

Schema description coverage is 100% (including camelCase aliases), so the baseline is 3. The description goes beyond the schema by quantifying the economics behind the parameters — the up-to-95% cache discount tied to cache_hit_ratio and the 50% batch discount tied to is_batch — which gives the agent a reason to set those values.

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 uses specific verbs and resources — calculate multi-provider LLM inference token costs, prompt caching economics, batch API savings, and cross-model cost disparity — and names the actual providers. An agent can distinguish this from generic finops siblings without opening the 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?

It gives explicit positive triggers (budgeting agent inference costs, evaluating LLM providers, deciding on caching or batch inference) and an explicit negative routing rule: 'Do not use for cloud network egress; use cloud_egress_finops instead.' The alternative is named by exact tool.

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