get_spend
The CodePanel MCP tool that shows a repository's model spend this month by role and model, and the account's last 30 days by day.
On this page›
get_spend shows what a repository's reviews cost this calendar month (UTC), split by role, provider and model, with failed calls counted. Call it before you change a panel, or when a monthly budget or repository cap is filling faster than you expected. It only reads, and it needs the read scope.
When to call it
- Before changing models: find which role takes most of the money. Pair it with
get_quality, because a cheaper model saves money only if its findings stay as good. - When a budget is close:
get_budgetsays how much of the limit is gone;get_spendsays where it went. - When rounds fail:
failedCallscounts calls that were billed but gave nothing usable.
If you want the spend, the quality figures and two alternative panels in one answer, call get_optimization instead.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
repo |
string | yes | Repository as owner/name |
It only reads: the server marks it readOnlyHint: true, so clients that ask before a write can run it without asking.
repo is owner/name. There is no month input: the report always covers the current UTC month.
What it returns
totalUsd,ownKeyUsdandcreditsUsd: everything spent, the part on your own provider keys, and the part paid from CodePanel credits. OnlyownKeyUsdcounts toward the monthly budget and repository cap. Subscription fees are not in any of them.byModel: one row perrole(reviewerororchestrator),providerandmodelId, withusd,callsandfailedCalls.callsandunpricedCalls: calls recorded, and how many had no price. An unpriced call counts as $0, so the totals are a floor.itemizedCalls,completeandgroupLimitReached: whetherbyModelaccounts for every call. Whencompleteisfalse, older calls were not itemized, so don't conclude which model dominates yet.suggestions: advice drawn from the numbers, each withid,title,evidenceandaction. It is often empty.nextAction: whether you can trust the breakdown as the whole month, and what to do if not.account: the whole account, every repository together, as the desktop app's Spend page shows it.account.daysis the last 30 UTC days, each withusd,creditsUsd,callsandmergedPrs.account.windowsums them and addsusdPerMergedPr,cacheReadShare(the share of prompt tokens a provider read from its cache) andcacheSavedUsd(what that saved at listed prices, after the cost of writing the cache).account.recordedSinceis the first day CodePanel kept: days before it read as zero because they were not recorded.account.monthis this month by model (roles together), withprojectedUsdat its pace so far and thebudgetit counts against.
Examples
These responses come from a test account on a local backend. The numbers and model names are seed data.
{ "repo": "codepanel-dev/web-app" }
{
"byModel": [
{ "calls": 5, "failedCalls": 0, "modelId": "claude-sonnet-5-5", "provider": "anthropic", "role": "reviewer", "usd": 0.286 },
{ "calls": 3, "failedCalls": 0, "modelId": "claude-opus-5-5", "provider": "anthropic", "role": "orchestrator", "usd": 0.247 },
{ "calls": 4, "failedCalls": 0, "modelId": "grok-4.7", "provider": "xai", "role": "reviewer", "usd": 0.2389 },
{ "calls": 4, "failedCalls": 0, "modelId": "gpt-5.4-mini", "provider": "openai", "role": "reviewer", "usd": 0.09375 },
{ "calls": 3, "failedCalls": 0, "modelId": "gemini-3.8-flash", "provider": "google", "role": "reviewer", "usd": 0.07368749999999999 }
],
"calls": 19,
"complete": true,
"creditsUsd": 0,
"groupLimitReached": false,
"itemizedCalls": 19,
"month": "2026-11",
"nextAction": "Compare the largest spend roles with quality verdicts before changing the panel. Panel recommendations are estimates, not proven savings or a codebase audit.",
"ownKeyUsd": 0.9393375000000003,
"repo": "codepanel-dev/web-app",
"suggestions": [],
"totalUsd": 0.9393375000000003,
"unpricedCalls": 0
}
All 19 calls are itemized (complete: true), all ran on own keys (creditsUsd: 0), and suggestions is empty because nothing stood out. The same ownKeyUsd shows as the repository's spentUsd in get_budget.
The same step without MCP
| Surface | Form |
|---|---|
| CLI | codepanel spend owner/name --json (CLI) |
| HTTP API | GET /spend?repo=owner/name |
The dashboard's Spend & budget tab for a repository shows the same figures (Budgets and spending limits).
What the server tells your agent
The description your agent reads when it lists the tools:
Full UTC month recorded model costs by role, provider and model, including failed calls, own keys versus credits, unpriced calls and explicit itemization coverage. account adds the whole account: 30 UTC days (credits vs own keys, PRs merged, $ per merged PR, cache-read share and its measured saving; recordedSince says from which day) and the month by model with its projection. Subscription fees are separate. Use with get_quality and get_panel_recommendation to investigate value and optimize; do not infer savings from model price alone.
Related
get_quality: the other half of a model choice.get_optimization: spend, quality and panel alternatives together.get_budget: how much of the limit is left.- Budgets and spending limits: what each limit counts.
- MCP server: install, sign-in and every other tool.