Skip to main content
Glama

calculate_llm_cost

Calculate and rank LLM API costs for a monthly token workload, including KV prompt caching hit ratio modeling, to compare providers.

Instructions

Calculate and rank LLM API costs for a specific token workload with KV prompt caching hit ratio modeling.

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": "calculate_llm_cost"
  }
}

Input Schema

NameRequiredDescriptionDefault
modelIdNoOptional model ID (e.g. gpt-5, claude-4-5-sonnet, deepseek-r1)
inputTokensNoMonthly input tokens (default: 7,000,000)
outputTokensNoMonthly output tokens (default: 3,000,000)
cacheHitRatioNoPrompt cache hit ratio between 0 and 1 (default: 0.5)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.2/5.0
Behavior3/5

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

With no annotations, the description carries the full disclosure burden. It does add real behavioral content by stating that results are ranked and that KV prompt caching hit ratio is modeled into the cost, but it omits whether pricing comes from a static table, what currency/units the output uses, and that the operation is side-effect-free.

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?

A single front-loaded sentence with the core action first and no filler. The trailing "KV prompt caching hit ratio modeling" is dense jargon that could be plainer, but nothing is redundant.

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

Completeness3/5

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

All four parameters are documented in the schema and the description covers the calculation's inputs, but with no output schema and no annotations the description should say more about the shape of the result — a ranked list of models with cost figures — and the pricing basis/currency. Adequate but with a clear gap.

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 defaults, ranges, and the meaning of each parameter are already fully documented in the schema. The description's phrase "specific token workload" and "caching hit ratio modeling" restates that semantics without adding anything new, so the baseline 3 applies.

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?

Specific verb phrase ("Calculate and rank LLM API costs") applied to a concrete resource, scoped by "a specific token workload" and cache-hit modeling. It implicitly distinguishes itself from list_llm_models (enumeration) and compare_llm_models (comparison) by being a cost computation over a given workload, but never names a sibling to make the boundary explicit.

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?

No when-to-use or when-not-to-use guidance is given. It never states whether this is the right tool when the agent has a concrete token volume versus when it should list or compare models first, leaving the agent to infer the choice from the sibling names alone.

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