AI coding cost controls with hard spend limits
See what each AI session and agent step costs, set soft and hard spend limits per workspace and per workflow, pick a model tier, or bring your own provider key.
In AI CodeOps, cost controls meter every model call an AI session makes, show the cost per session and per agent step, and stop spending at the limits you set for the workspace and for each workflow. You also choose how expensive the models are, per session, or bring your own provider key.
AI coding agents spend money on every model call. Without limits, one long session or a misconfigured schedule can use a month's budget in an afternoon. AI CodeOps records cost as a session runs, not only when it ends, so a limit can stop a session part-way.
Which agents run
Every agent step is a model call, so every agent costs something. What changes the bill is which tier each step runs on. With the Auto tier, AI CodeOps picks the tier per call by what the call is for:
| Call | Agents | Tier order |
|---|---|---|
| Steering | Architect, Reviewer, Security Auditor, ADR Writer, Product Analyst, Project Planner, Researcher | Premium, Standard, Economy |
| Writing the change | The code pass after the agent steps | Standard, Premium, Economy |
| Drafting | Builder, Tester, the engineers and every other agent | Economy, Standard, Premium |
Each call takes the first tier in its order that your plan includes and still has allowance for. The findings review of the diff counts as steering. See the agent catalogue for what each agent does, and models for the tiers.
A workspace can also give an agent a different model through its own agent settings. That step's cost is then priced at the model it actually used.
Cost per session
Every model call is metered as it happens. Calls that fail part-way are counted too, because the provider still bills them. You see the cost in several places:
- AI Sessions lists each session with its status, cost and tokens.
- A session's page shows the total, and the cost and tokens of each agent step.
- Changes shows what each change cost to produce.
- Usage (under Measure) charts cost per day for the month, filterable by model and by API key, with a table of individual calls.
Costs come from each provider's list prices, or from the prices you set on your own provider connection. Every change's evidence pack also records the tokens and cost of each run.
Budgets per workspace and per workflow
Owners, admins and billing admins set a cost budget for the workspace under Configure, Billing. It has a period (daily, weekly, monthly or a rolling 30 days, in UTC), a soft limit, a hard limit and optional per-workflow caps. Amounts are stored in millionths of a US dollar. This is the shape the console saves through PUT /api/budget, for a $500 monthly cap with a warning at $400 and a $50 cap on one workflow:
{
"enabled": true,
"period": "monthly",
"softLimitMicros": 400000000,
"hardLimitMicros": 500000000,
"perWorkflowLimits": { "feature-sdlc": 50000000 },
"expectedVersion": 3
}
expectedVersion stops two people from overwriting each other's changes. Once the period's spend is over the hard limit, a new session is refused with a verdict like this:
{
"allowed": false,
"state": "denied",
"summary": "Dispatch denied: budget exceeded",
"reasons": ["over_workspace_cap"],
"currentSpendMicros": 501830000,
"softLimitMicros": 400000000,
"hardLimitMicros": 500000000,
"perWorkflowLimitMicros": null,
"estimatedCostUsdMicros": 0,
"periodStartedAt": "2026-10-01T00:00:00.000Z",
"period": "monthly"
}
Spend is calculated from the sessions themselves each time, so it cannot drift from what actually ran.
Quality gates involved
The budget is a gate on spending, checked at three points:
- At launch. Once the period's spend is over the hard limit, or a workflow's spend is over its cap, new sessions are refused. If the check itself fails, the session does not start.
- Before every model call. A running session that has crossed the hard limit stops before its next call, with the reason on its page.
- Soft limit. Sessions still run, and each warning is recorded with the workspace's policy decisions, next to every denial.
If the budget stops a session after its code was written but before the findings review, the review is recorded as not completed, and the quality gate holds the change. A workspace with no budget has no spend limit beyond its model allowance.
Model tiers and allowances
Sessions on the platform's models run on Economy (the default, in every plan), Standard (mid-grade models such as Kimi or GLM), Premium (top models such as Claude), or Auto, offered when more than one tier is available to you. Each plan includes a monthly token allowance per tier. The Usage page shows a bar per tier, amber from 80% and red when used up. Allowances restart on the 1st of each month (UTC). AI CodeOps is free during the open beta; see pricing.
When a tier's allowance runs out, the session continues on the workspace's credits if it has enough. Otherwise it stops and says what ran out. It never moves to another tier on its own.
Bring your own key
A workspace can add its own provider key. Sessions can run on Anthropic (Claude), OpenAI, Moonshot (Kimi), Z.ai (GLM), DeepSeek, Groq, OpenRouter and Ollama Cloud keys, and on OpenAI-compatible endpoints at a public HTTPS address. Sessions on your own key are billed by your provider and do not use the platform allowance; the workspace budget still applies. Keys are encrypted at rest. If your provider refuses a call, the session does not quietly fall back to the platform's key.
To estimate spend before you start, try the free AI coding cost calculator. The cost controls guide walks through each setting.
Frequently asked questions
Can I cap spend for a single agent?
No. Limits apply per workspace and per workflow. Each agent step's tokens and cost are shown on the session page, but there is no per-agent cap.
What happens when a session hits the hard limit mid-run?
It stops before its next model call, with a message saying the budget was reached. The call that was already in flight finishes, so a run can go slightly over the cap.
Does bringing my own API key bypass the budget?
It bypasses the platform's model allowance, because your provider bills you directly. Your workspace budget still applies to sessions on your own key.
Will a session switch to a cheaper model when the allowance runs out?
No. A session never changes tier by itself. It continues on workspace credits if there are enough, and otherwise stops and tells you what ran out. Auto only picks tiers you have allowance for.
Who can change the budget?
Members whose role can manage the budget, which by default means owners, admins and billing admins. Budget changes are recorded in the audit log.