Skip to main content
Glama

price_usage

Calculate the USD cost of a model's token usage by input and output tokens, helping estimate or verify LLM spend per task.

Instructions

Price a concrete usage record at a model's list rates.

Args: model_id: Model identifier from the pricing snapshot, e.g. "anthropic.claude-sonnet-4-5" or "openai.gpt-5-mini". input_tokens: Input (prompt) tokens consumed. output_tokens: Output (completion) tokens consumed.

Returns the input/output/total cost in USD.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
model_idYes
input_tokensYes
output_tokensYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/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 burden. It discloses that pricing comes from a 'pricing snapshot' at list rates and that the result is USD cost, but says nothing about unknown model handling, rounding, or what happens if the model isn't in the snapshot. Partial behavioral coverage only.

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 purpose sentence followed by args and a return note; every line is functional. Slightly list-like but no wasted prose.

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?

For a simple compute tool, the description covers inputs, their formats, and the return shape in USD despite no output schema. Remaining gap is absence of error/edge-case behavior.

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 0%, so the description must compensate, and it does: it documents all three parameters with concrete model_id examples ('anthropic.claude-sonnet-4-5') and clarifies token semantics (prompt vs. completion). That is meaningful added value beyond the bare schema.

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+resource: 'Price a concrete usage record at a model's list rates.' The word 'concrete' implicitly distinguishes it from the estimate sibling, but no sibling is named outright. An agent can mostly tell what it does.

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

Usage Guidelines3/5

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

The distinction from estimate_run_cost is only implied via 'concrete usage record' vs. an estimate; no explicit when-to-use or when-not-to-use guidance is given. For a tool sitting among four cost-related siblings, more routing guidance would be expected.

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