Claude Code
Route Claude Code through CoreValue to see what each developer and team spends, and cap it before the month ends.
Claude Code reads two environment variables that send its requests to any Anthropic-compatible endpoint. Point them at CoreValue, and every request your developers make is logged with its cost, attributed to a key, and checked against your budgets before it reaches Anthropic.
You will need: an Anthropic API key added to CoreValue as a provider key. Claude Code must use an API key. A Claude Pro or Max subscription login goes straight to Anthropic and cannot be routed through a gateway.
Set up one developer
Create a CoreValue key for the developer
In the console, click Governance, then Keys, then Generate API key.
Name the key after the developer, for example claude-code-priya, and pick
their Team. Copy the sk-cova-… key.
One key per developer is what makes per-developer spend and per-developer budgets possible. A shared key gives you one total.
Point Claude Code at CoreValue
Add this to ~/.claude/settings.json:
{
"apiKeyHelper": "echo sk-cova-…",
"env": {
"ANTHROPIC_BASE_URL": "https://gateway.corevalue.dev"
}
}apiKeyHelper is a command whose output Claude Code uses as the API key. echo
works; a command that reads the key from your secrets manager is better. Claude
Code uses it without asking, including in non-interactive runs such as
claude -p in CI.
You can use environment variables instead:
export ANTHROPIC_BASE_URL=https://gateway.corevalue.dev
export ANTHROPIC_API_KEY=sk-cova-…The first time, Claude Code asks whether to use the API key it found. Answer
yes. Until you have, claude -p stops with Not logged in, so use
apiKeyHelper on machines where nobody can answer.
Either way, do not use ANTHROPIC_AUTH_TOKEN. It sends the key as a bearer
token, and the gateway, which reads the key from the x-api-key header,
refuses it.
Run Claude Code and check the console
Start claude and ask it anything. Then open Requests in the console: the
requests appear under the developer's key, with model and cost.
Roll it out to a team
-
Set it centrally. Claude Code reads a managed settings file that developers cannot override. Put
ANTHROPIC_BASE_URLthere, and anapiKeyHelperscript that fetches each developer's own key from your secrets tooling. -
Label the work. Claude Code sends extra headers from
ANTHROPIC_CUSTOM_HEADERS, oneName: Valueper line. Use it to tag the repository or project:export ANTHROPIC_CUSTOM_HEADERS="Cova-Feature-Id: payments-repo"Cova-Team-Idworks the same way, but the key's team already attributes the spend, so you only need it when one key is shared across teams.
Cap the spend
Budgets reset on the 1st of each month (UTC). Two work well for Claude Code:
| Budget | When it runs out |
|---|---|
| Key cap, one per developer | Their requests are refused with HTTP 429, and Claude Code shows the error, until the month rolls over. Other developers carry on. |
| Team budget | You choose: block the team, downgrade to a cheaper model from your downgrade mappings (for example Opus to Sonnet), or alert and let requests through. |
Blocking and downgrading need the Growth plan or higher; alerts work on every plan. See Budgets and limits.
See where the money went
- Spend shows cost by key, team and model, so you can compare developers and teams. See Spend.
- Chargeback turns the month into a per-team report for finance. See Chargeback.
- A request that feeds a tool result back to the model is recorded with actor
agent; the first request of each task is recorded asunknown. See Cova-Actor.
Use the Google Gemini SDK
Use Google's official @google/genai SDK with Cova AI Gateway: your app sends only its Cova key, and the gateway uses the Google key stored in CoreValue.
Tag your traffic
Tell CoreValue which of your users and customers each request was for, so you can see and cap spend per user and customer.