When the AI bill rises, finance needs to know which project drove the increase. The engineering lead needs to know whether the work justifies more budget. A useful AI spend policy gives both teams an answer and makes clear who can approve the next dollar.
For teams using Claude Code, Codex, and internal AI applications, that starts with five decisions. Who owns each budget? What happens at the limit? How is usage attributed? When is a premium model worth its cost? And whose credentials authorize the work?
AI spend control for an engineering team comes down to four things: tie every AI request to a developer and project, set budgets at more than one level, enforce them with hard limits rather than alerts, and route routine work to cheaper models. OpenAI and Anthropic each offer native limits for their own billing, but neither can enforce one budget across both. If your team uses Claude Code and Codex together, that shared budget needs a control layer in front of both providers.
AI coding tools make spend harder to predict than any other software line item. A seat licence costs the same every month; a coding agent's bill depends on which model it picks, how much context it resends and how many times it retries. A monthly invoice shows the total but not which developer, project or runaway agent loop produced it. This guide covers how to fix that, step by step, using your providers' built-in controls first and adding a control layer only where they stop.
Why AI coding spend runs away
Coding agents spend money in ways a normal SaaS budget was never built for. Four patterns cause most surprise bills:
- Shared keys hide who spent what. When a whole team shares one provider key, the invoice has a total and nothing else. You cannot tell a production workload from a weekend experiment, and you cannot revoke one person's access without breaking everyone's.
- Agents multiply a small price. One task can mean dozens of model calls as the agent reads files, edits, runs tests and retries. A loop that keeps failing keeps billing.
- The default model is usually the expensive one. Claude Code defaults to a premium model, and most developers never change it. Routine edits that a model costing a twentieth as much could handle get billed at the top rate. See the cheapest Claude and Codex models for coding.
- Alerts don't stop anything. A spend alert tells you about the problem after the money is gone. Only an enforced limit stops the next request.
The fix is the same in every case: know who is spending, decide how much they can spend, and make the limit real.
The five controls that actually work
1. Give every request an owner
Replace shared keys with one credential per developer and one per automated job (CI, bots, internal apps). Map each credential to an owner, team, project and environment:
| Field | Example | Why it matters |
|---|---|---|
| Developer or service | developer-042, ci-test-generator | Who started the work |
| Team | Platform engineering | Team budgets and showback |
| Project | Payments migration | Ties cost to business work |
| Provider and model | Anthropic, claude-opus-5-5 | Explains model-driven changes |
| Session or task ID | migration-session-118 | Groups an agent's many calls into one task |
Derive identity from the credential, not from a project label in the request, which anyone can type. Here's how to track Claude Code usage by developer and project.
2. Set budgets at more than one level
An organization cap protects the total; smaller limits catch a problem before it eats the whole allocation. The figures below are illustrative:
| Level | Example limit | What happens at the limit |
|---|---|---|
| Organization | $6,000 / month | Final backstop; review the forecast weekly |
| Project | $1,500 / month | Owner notified at 70%, hard stop at 100% |
| Developer | $20 / day | New requests paused until tomorrow |
| CI job | $5 / run | Run ends before more AI calls |
| Temporary exception | +$50 for 48 hours | Expires automatically |
These limits overlap rather than add up, so decide which one wins. For setup details, see Claude Code budgets per user and project and budgets for coding agents by developer or team.
3. Enforce with hard limits, keep alerts as early warning
Use alerts at 50–80% so owners can react, and a hard stop at 100% so a runaway loop can't keep billing. Keep production on its own budget with a named owner who can raise it, so a cap never takes down a live service by surprise.
4. Cap agent behaviour, not just dollars
Dollar budgets contain the damage; behaviour limits prevent it. Limit agent steps or tool calls per task, concurrent requests, retries, and output length. Treat a budget-exhausted error differently from a rate-limit error: retrying can't fix an empty budget. More in how to stop runaway AI agent costs.
5. Match the model to the task
Budgets limit spend; model policy lowers the cost of the work itself. Send routine edits, tests and boilerplate to a cheap model such as Claude Haiku 5.5 or GPT-6 Luna, and allow premium models where your own tests show they finish the job better. Measure cost per completed task, retries included, not cost per request. Smart model routing can make that choice automatically.
What OpenAI and Anthropic limits do on their own
Both providers now offer real hard limits, but each covers only its own bill, and neither works per developer across both tools.
| OpenAI (Codex via API) | Anthropic (Claude Code via API) | |
|---|---|---|
| Hard limit scope | Organization and project | Organization and workspace |
| Per-developer limit | No; use one project per developer as a workaround | Yes, in the dedicated Claude Code workspace |
| At the limit | Requests fail with a 429 error | Requests fail until the limit is raised or resets |
| Alerts | Yes, alongside hard limits | Yes |
| Covers the other provider | No | No |
OpenAI: set a monthly spend limit for the organization or a project and turn on enforcement. OpenAI's spend-limit guide notes that alerts alone never stop traffic, and that enforcement takes a moment to propagate, so spend can slightly overshoot the cap.
Anthropic: set organization limits and workspace limits in the Claude Console; a workspace limit can't exceed the organization's, and the Default Workspace can't take a custom limit. Per-user monthly limits exist only in the Claude Code workspace. See Anthropic's workspace docs.
If your team uses only one provider and doesn't need per-developer limits across tools, native controls may be enough; start there. You need more when you want one budget across Claude Code and Codex, per-developer caps for both, or cost attribution in one place. [Before publishing: confirm the Anthropic behaviour at the limit against current docs.]
Tools that add a shared control layer
| Tool | What it adds | What to check |
|---|---|---|
| Opviera | Per-developer and per-project attribution, hard-stop budgets, model policies and routing for Claude Code, Codex and opencode | Supported models, platform fee |
| LiteLLM Proxy | Open-source virtual keys, spend tracking and budgets | You host and maintain it |
| Portkey | Workspace budgets, alerts and rate limits | Workspace budgets, alerts and rate limits |
For a longer, honest comparison, see the best Claude Code cost management tools. Before you commit to any tool, run a pilot: issue one credential, push it past a small test budget, check the blocked response, and reconcile the recorded cost with the provider invoice.
How to roll it out to an engineering team
Start with one team, prove attribution and enforcement work, then expand:
- List every route to an AI bill. Include API keys, Claude Code and Codex seats, CI jobs, internal apps and cloud deployments such as Claude on Amazon Bedrock. A control that covers one route doesn't cover the others.
- Measure a baseline. Record two to four weeks of spend by provider, team and project, and note what you can't attribute yet.
- Issue individual credentials and retire shared keys, starting with the pilot team.
- Set budgets and owners at organization, project and developer level, using the baseline rather than guesses. AI cost forecasting helps size them.
- Turn on enforcement in a test project first: push a credential past a small limit and confirm what developers see.
- Review weekly. Ask which teams, models and failed retries drove the change, and what work the spend produced. Report it back to each team (showback or chargeback), and judge value by cost per accepted pull request, not raw spend.
How Opviera handles AI coding spend
Opviera is a control layer for Claude Code, Codex and opencode. Each developer gets one key; every request then passes through a gateway that can attribute, limit and route it before it reaches Anthropic, OpenAI or an open-weight provider.
- Cost per developer and project, across both providers, with no manual tagging.
- Hard-stop budgets per user and per project that apply to Claude Code and Codex together, shown inside the tool when a developer hits one.
- Model policies and smart routing so routine requests drop to a cheaper model.
- Prompt compression that cuts up to 92% of the context agents resend on heavy workloads.
- Abuse alerts that flag requests whose content doesn't match the project they claim.
Opviera began as an internal tool that cut our own AI bill by 70%. To estimate your team's numbers, try the AI savings calculator.
Frequently asked questions
How do we manage spending on Claude Code and Codex across our engineering team?
Give each developer their own credential, attribute every request to a developer and project, and set hard-stop budgets at developer, project and organization level. Native OpenAI and Anthropic limits each cover only their own bill, so a single budget across both tools needs a gateway that sees both.
We rolled out AI coding tools and have no idea what they cost per team. Where do we start?
Start with an inventory of every route to an AI bill, then replace shared keys with per-developer credentials mapped to teams. Within a few weeks you'll have a baseline by team and project to set budgets from.
How do I set a daily coding agent budget for each developer?
Anthropic supports per-user monthly limits in its Claude Code workspace; OpenAI's limits stop at the project level. For daily per-developer caps that cover both Claude Code and Codex, use a control layer such as Opviera that enforces a daily allowance per developer key.
Can one budget cover both OpenAI and Anthropic?
Only through a gateway or other system that aggregates spend from both providers. Each provider's native limits govern only its own billing, and calls that bypass the shared system need their own controls.
Are spending alerts enough?
No, not on their own. Alerts tell you spend is rising, but traffic keeps flowing. Use alerts for early warning and a hard limit to stop spend at the cap.
Will a hard cap interrupt production?
It can. Give production its own budget, separate from development and experiments, with a named owner who can raise it quickly.
What is the difference between AI spend control and AI spend governance?
Spend control is the mechanism: attribution, budgets and enforcement. Governance is the policy behind it: who owns each budget, which models are approved, and how exceptions get approved.
Should every developer get the same budget?
Start from a common baseline, then adjust for the work. Someone running a large migration needs more room than someone doing routine maintenance, ideally through a time-limited exception.
Written by CK, Co-Founder & CPO.
Take Control of Your Engineering Team's AI Spending
Opviera helps organizations manage AI consumption through centralized cost tracking, spending budgets, model policies, and optimization capabilities. Explore Opviera's AI Cost Governance Platform Get Started with Opviera
Keep reading
LLM Spend Limits per Tenant: A SaaS Implementation Guide
One customer starts a bulk import. Another needs a single AI summary. Learn how to give each tenant a dollar budget and decide which requests can run.
Read article → FeaturePrompt Compression for Claude Code and Codex
AI coding agents resend bulky context every turn, and you pay for it each time. Compression cuts up to 92% of those tokens while accuracy holds. Here's how it works.
Read article → FeatureControl Claude Code Costs on AWS Bedrock
Route Claude Code through a gateway that holds the Bedrock access, so developers get AI without direct AWS keys, and every request has a per-user budget.
Read article →