Skip to main content
Glama

Estimar costo de tokens de LLM

llm-cost-estimate
Read-onlyIdempotent

Estima el costo de llamadas a un LLM a partir de tokens (o texto estimado) y precios por millón indicados; sin lista de precios incorporada. Cuándo: un flujo de agente necesita un resultado exacto y repetible para un paso auxiliar (tokens, costos, reintentos, fragmentos, ranking, limpieza de JSON). No para: estimar el costo de un lote de llamadas pagadas por uso (x402-cost-estimate). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.

EN: Estimates LLM request cost from input/output token counts (or text, estimated heuristically) and supplied per-million-token prices, with optional cached-input pricing and call volume. No built-in price list. When: an agent loop needs an exact, repeatable result for a bookkeeping step (tokens, costs, retries, chunking, ranking, JSON clean-up). [EN completo / full EN: inputSchema.description]

Input Schema

NameRequiredDescriptionDefault
callsNoNumber of identical calls (integer; optional; default 1; min 1; max 1000000000).
input_textNoText to estimate input tokens from (string; optional).
input_tokensNoInput tokens (integer; optional; min 0; max 1000000000000).
output_tokensNoOutput tokens (integer; optional; default 0; min 0; max 1000000000000).
cached_input_tokensNoOf the input, tokens billed at cache price (integer; optional; default 0; min 0; max 1000000000000).
price_input_per_mtokYesUSD per 1M input tokens (number; required; min 0; max 10000).
price_cached_per_mtokNoUSD per 1M cached input tokens (number; optional; default 0; min 0; max 10000).
price_output_per_mtokYesUSD per 1M output tokens (number; required; min 0; max 10000).

Output Schema

NameRequiredDescriptionDefault
callsNo
total_usdNo
input_tokensNo
output_tokensNo
estimated_inputNo
cost_per_call_usdNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / price_input_per_mtok / examples
      Added value: +[
      +  3
      +]
    • addedInput schema / properties / price_output_per_mtok / examples
      Added value: +[
      +  15
      +]
  2. Changed1 schema field changed
    • addedInput schema / description
      Added value: +"EN: Estimates LLM request cost from input/output token counts (or text, estimated heuristically) and supplied per-million-token prices, with optional cached-input pricing and call volume. No built-in price list. When: an agent loop needs an exact, repeatable result for a bookkeeping step (tokens, costs, retries, chunking, ranking, JSON clean-up). Not for: estimating the cost of a batch of pay-per-call API requests (x402-cost-estimate). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB."
  3. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, openWorldHint=false and destructiveHint=false, but the description still adds real substance: determinism guarantee, the fact that no built-in price list exists (agent must supply prices), and hard limits (64 KB input, 1 s per call, 1 MB result). The 'solo lectura, sin red, sin estado guardado' sentence partly restates the annotations, which keeps it from a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose, which is good, but the description carries the same content twice in Spanish and English and repeats the schema's own English description. The bilingual duplication roughly doubles length without adding 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?

An output schema exists, so return values need not be explained. For an 8-parameter pure-calculation tool, the description covers purpose, selection criteria, determinism, price-list caveat and operational limits — nothing an agent needs 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 coverage is 100%, so the baseline is 3, but the description adds semantics the schema does not: that text input is converted to tokens 'heuristically' (an approximation caveat), and that cached-input pricing and call volume are optional multipliers. That goes beyond enumerating parameter names.

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+resource ('Estima el costo de llamadas a un LLM') and pins down the inputs (tokens or heuristic text estimation, plus supplied per-million prices). The explicit 'sin lista de precios incorporada' and the named sibling x402-cost-estimate make it distinguishable from nearby 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?

Has explicit 'Cuándo' (agent loop needing an exact, repeatable bookkeeping result) and 'No para' (batch of pay-per-call API requests → x402-cost-estimate) sections naming the alternative. This is the full when/when-not/alternative triad.

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