MCP server
MCP Server
Give your agent live LLM pricing as callable tools — look up what a model costs, compare models to find a cheaper one, estimate a job before running it, and check what is being retired.
Endpoint
https://agentcost.tech/api/mcp
Streamable HTTP. The pricing tools are public — no credentials, no sign-up. The account tools need a project API key. Protocol revisions 2026-07-28, 2025-06-18, 2025-03-26, so both the current stateless revision and the older handshake era work.
Connect
Claude Code
Add the remote server from the terminal.
claude mcp add --transport http agentcost https://agentcost.tech/api/mcp
Claude Desktop, Cursor, Windsurf and other config-file clients
Add an entry under mcpServers in the client's config file.
{
"mcpServers": {
"agentcost": {
"type": "http",
"url": "https://agentcost.tech/api/mcp"
}
}
}Anything else that speaks MCP
Point any MCP client at the endpoint over Streamable HTTP. No install step, no OAuth flow.
https://agentcost.tech/api/mcp
With your project API key
The account tools read your own project, so they need its API key as a bearer token. The pricing tools keep working without one.
claude mcp add --transport http agentcost https://agentcost.tech/api/mcp \
--header "Authorization: Bearer sk_your_project_api_key"
# config-file clients
{
"mcpServers": {
"agentcost": {
"type": "http",
"url": "https://agentcost.tech/api/mcp",
"headers": { "Authorization": "Bearer sk_your_project_api_key" }
}
}
}Tools
list_models
Search the public AgentCost catalogue of LLM models and their per-1,000-token rates. Filter by provider and/or a substring of the model name. Use this to compare model costs or find a cheaper alternative. Returns rates in USD; no credentials required.
- provider
- Provider slug to filter by, e.g. openai, anthropic, google, aws, azure.
- query
- Case-insensitive substring to match against the model name, e.g. 'sonnet' or 'gpt-4'.
- limit
- Maximum models to return. Results are sorted cheapest-input-first.
get_model_pricing
Look up the per-1,000-token rates for a single named model. Resolves the name exactly, then case-insensitively, then by provider-prefixed suffix (so 'gpt-4o' finds 'azure/gpt-4o'). Use this when you already know which model you are pricing.
- model*
- Model name as the provider spells it, e.g. gpt-4o or claude-sonnet-4-6.
estimate_cost
Work out the USD cost of one or more LLM calls before making them, from the current catalogue. Give a model and the token counts involved. Use `calls` to price a whole job rather than a single call. Cached input tokens bill at the provider's cached rate when one is published and at the full input rate when it is not; the result reports which happened.
- model*
- Model name, e.g. gpt-4o.
- input_tokens*
- Prompt tokens per call.
- output_tokens*
- Completion tokens per call.
- cached_input_tokens
- Prompt tokens served from the provider's cache, per call.
- cache_write_tokens
- Tokens written into the prompt cache, per call.
- calls
- How many identical calls to price. Use this to cost a whole job.
list_model_deprecations
List models with an upstream-announced retirement date, soonest first. Use this to check whether a model a user depends on is being retired, or to avoid recommending one that is.
- provider
- Optional provider slug to filter by.
- limit
get_spend_overview
Total LLM spend, call count, tokens, average cost per call and success rate for the caller's own AgentCost project over a time window. Needs the project API key in the Authorization header.
- range
- Time window ending now.
get_spend_breakdown
Cost and call volume for the caller's own project, grouped by agent, model, workflow, tool, user or session, most expensive first. Use this to find which agent or model is spending the money. Needs the project API key in the Authorization header.
- dimension*
- What to group by. user and session come from user_id and session_id in event metadata.
- range
- Time window ending now.
- limit
- Maximum groups to return.
get_budget_state
Month-to-date spend against the project's budget: the budget, what is left, utilisation, whether it is exhausted and when the period ends. Use this before starting an expensive job. Needs the project API key in the Authorization header.
get_run_cost
Every model call in one run (trace) of the caller's own project, in execution order, with the cost of each, the run total and how the run ended. The trace id is the one the SDK's workflow() minted or an external system supplied. Needs the project API key in the Authorization header.
- trace_id*
- The run's trace id.
* required
What it does not do
Without an API key the tools read the public pricing catalogue only. With one, the account tools read that project's spend, budget and runs, and nothing else. Changing budgets, projects or members needs the REST API. Nothing here writes anything, so every tool is safe to call speculatively.
Verify it
curl -sX POST https://agentcost.tech/api/mcp \
-H "Content-Type: application/json" \
-H "MCP-Protocol-Version: 2026-07-28" \
-H "Mcp-Method: tools/list" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'Related: REST API reference · Versioning & deprecation policy · OpenAPI spec