Skip to main content
Glama

LLM Pricing

predict_cost

Predict the real cost of an LLM call from your actual prompt text — no need to know token counts in advance. Counts tokens locally, infers the task type (or accepts one explicitly), estimates output length from empirical I/O profiles, and returns all models ranked cheapest-first with effective cost after prompt-cache savings. Also surfaces the best quality-per-dollar pick. Use this before making any LLM API call to avoid surprise bills.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
top_nNoNumber of models to return, ranked cheapest-first (default: 10, max: 50)
promptYesThe actual prompt text to cost-estimate (required)
task_typeNoTask type for output-length estimation. Auto-inferred from prompt if omitted. Options: classification, extraction, summarization, qa, code_generation, translation, chat, content_generation, reasoning, function_calling, data_analysis, rewrite
require_visionNoOnly include models that support image/vision input (default: false)
cache_hit_ratioNoFraction of calls that hit the prompt cache (0–1). Set this if you have a large reusable system prompt. Supported providers: Anthropic (10% cache rate), OpenAI (50%), Google (25%). Default: 0
min_context_tokensNoMinimum context window size required in tokens (optional)
require_function_callingNoOnly include models that support function/tool calling (default: false)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the computation model (tokens counted locally, task type inferred or explicit, output length from empirical I/O profiles) and the shape of the result (models ranked cheapest-first, effective cost after prompt-cache savings, best quality-per-dollar pick). It does not state permissions, rate limits, or failure behavior, but for a local estimation tool those are low-stakes.

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 the core verb and resource, then the mechanism, then the return shape, then the usage cue. The sentences are information-dense with little padding, though the enumeration of internal steps is slightly longer than strictly necessary.

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

Completeness4/5

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

No output schema exists, and the description compensates by describing the return structure (ranked model list, effective cost, quality-per-dollar pick). For a seven-parameter read-only estimation tool with no annotations, this covers what an agent needs to invoke it 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?

Schema description coverage is 100%, so all seven parameters are already documented, including the task_type enum and the cache_hit_ratio semantics. The description reinforces the cache-savings and task-inference behavior but adds no syntax or format detail beyond the schema, 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?

States a specific verb and resource: predict the real cost of an LLM call from prompt text, and enumerates the internal steps (local token counting, task-type inference, output-length estimation, cheapest-first ranking). The purpose is unambiguous. It does not, however, differentiate itself from the sibling estimate_cost, which an agent may reasonably confuse it with.

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

Usage Guidelines4/5

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

Gives a clear usage context: 'Use this before making any LLM API call to avoid surprise bills.' That is a concrete when-to-use. It offers no when-not guidance and never names the alternative siblings (estimate_cost, compare_costs, recommend_model), so selection between closely related cost tools is left to inference.

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.