agent-cost-mcp-server
v0.1.1Prices LLM/agent runs per successful task, with spend recording and budget status.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
price_usage
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.
| Parameter | Type | Description |
|---|---|---|
input_tokens * | integer | |
model_id * | string | |
output_tokens * | integer |
estimate_run_cost
Estimate what one run of a workload will cost on a model. Args: model_id: Model to price the workload on. input_tokens: Expected input tokens for one run. output_tokens: Expected output tokens for one run. Returns the model's cost plus the same workload priced on every other model in the snapshot, cheapest first.
| Parameter | Type | Description |
|---|---|---|
input_tokens * | integer | |
model_id * | string | |
output_tokens * | integer |
compare_models_for_task
Rank models for a task by expected cost per successful task. Cost per token is the wrong ranking for agent work: a cheap model that fails half its tasks costs more per success than a pricier, reliable one. Pass measured success rates (0-1 per model_id) if you have them; models without a supplied rate are ranked on raw cost. Args: input_tokens: Input tokens for one attempt at the task. output_tokens: Output tokens for one attempt at the task. success_rates: Optional map of model_id to success rate in (0, 1].
| Parameter | Type | Description |
|---|---|---|
input_tokens * | integer | |
output_tokens * | integer | |
success_rates |
record_spend
Record a run's actual token usage in the local per-task ledger. Args: task_id: Caller-chosen identifier grouping one task's runs. model_id: Model the run used. input_tokens: Actual input tokens consumed. output_tokens: Actual output tokens consumed. Returns the recorded entry, priced at the model's list rates.
| Parameter | Type | Description |
|---|---|---|
input_tokens * | integer | |
model_id * | string | |
output_tokens * | integer | |
task_id * | string |
budget_status
Check a task's recorded spend against a budget. Args: task_id: The task identifier used with record_spend. budget_usd: The budget for the task, in USD. Returns spent, remaining, call count, and whether the task is over budget. This server supplies the numbers; enforcing the budget (stopping a run) belongs to the agent framework.
| Parameter | Type | Description |
|---|---|---|
budget_usd * | number | |
task_id * | string |