CodePanel
get_spend

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_budget says how much of the limit is gone; get_spend says where it went.
  • When rounds fail: failedCalls counts 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, ownKeyUsd and creditsUsd: everything spent, the part on your own provider keys, and the part paid from CodePanel credits. Only ownKeyUsd counts toward the monthly budget and repository cap. Subscription fees are not in any of them.
  • byModel: one row per role (reviewer or orchestrator), provider and modelId, with usd, calls and failedCalls.
  • calls and unpricedCalls: calls recorded, and how many had no price. An unpriced call counts as $0, so the totals are a floor.
  • itemizedCalls, complete and groupLimitReached: whether byModel accounts for every call. When complete is false, older calls were not itemized, so don't conclude which model dominates yet.
  • suggestions: advice drawn from the numbers, each with id, title, evidence and action. 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.days is the last 30 UTC days, each with usd, creditsUsd, calls and mergedPrs. account.window sums them and adds usdPerMergedPr, cacheReadShare (the share of prompt tokens a provider read from its cache) and cacheSavedUsd (what that saved at listed prices, after the cost of writing the cache). account.recordedSince is the first day CodePanel kept: days before it read as zero because they were not recorded. account.month is this month by model (roles together), with projectedUsd at its pace so far and the budget it counts against.

Examples

These responses come from a test account on a local backend. The numbers and model names are seed data.

Call
{ "repo": "codepanel-dev/web-app" }
Result
{
  "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.

Last updated