Every served call now carries a costBasis: recorded when the tool wrote its own figure, calculated when CodeBurn priced measured tokens, estimated when the tokens or price are a guess, included when a subscription covered it at $0, and unpriced when the model has no known price. It is derived from fields the cache already stores, so no parse or cache version moves. The export JSON gives each record its basis and gives sessions and days the share of cost from recorded, calculated and estimated; records.csv gets the column. sessions --format json, the menubar payload and MCP get_usage carry the same shares. Sync now sets ai.cost_estimated from the basis instead of guessing from the provider name.
1.2 KiB
CodeBurn in your agent (MCP)
claude mcp add codeburn -- npx -y codeburn mcp
codeburn mcp runs a local MCP server over stdio, so Claude Code, Cursor, or any MCP client can ask "where did my tokens go this week?" or "how do I spend less?" mid-conversation. It exposes two tools:
| Tool | What it returns |
|---|---|
get_usage |
Spend and usage with breakdowns by tool, model, project, and task (fast) |
get_savings |
Cost reductions: waste findings, retry tax, routing waste (slower, deeper analysis) |
Everything is read from local disk, same as the CLI. Project names are pseudonymized by default; the agent only sees real names if it asks with include_project_names: true. For other MCP clients, configure a stdio server with command npx and args -y codeburn mcp.
get_usage totals include costBasis when there is spend: the share of cost, from 0 to 1, that is recorded by the tool itself, calculated from measured tokens at published prices, or estimated from content length. The other two bases, included (a subscription already paid) and unpriced (no known price), are $0 and carry no share. New keys can appear in the output, so read fields by name.