# A team on Claude Code. Who controls the cost?

> Control what a team spends on Claude Code: one key per person, a monthly cap and a model allowlist on each, spend by person and team. Four variables to connect.

Web page: https://agentlab.cresclab.com/en/gateway/claude-code  
繁體中文 (Markdown): https://agentlab.cresclab.com/gateway/claude-code.md

AI Gateway guide

Give each person a key of their own, with a monthly cap and the models it may use. Spending stops at the cap, not at the invoice.

[Sign up free](https://app.agentlab.cresclab.com/?lang=en&intent=gateway&from=%2Fen%2Fgateway%2Fclaude-code) [The short answer](https://agentlab.cresclab.com/en/gateway/claude-code#answer)

Short answer

## Three settings do it

**Someone might spend too much in a month**

A monthly spend cap on each key; requests are refused at it

**Everyone reaches for the most expensive model**

A model allowlist on each key, or auto to pick by difficulty

**You need to know whose spend it is**

Charge keys to teams; read usage by key, model and team

Compared

## One shared key, or a Gateway key each

The difference is whether anything stops a problem before it happens.

A shared API key compared with one Agent Lab Gateway key per person

| What you manage | One shared API key | A Gateway key each |
| --- | --- | --- |
| Who spent what | Cannot tell | By key, model and team |
| Spend cap | One for the whole key | One per key and per team |
| Which models | All of them | An allowlist per key |
| Someone leaves | Rotate the key; everyone reconfigures | Revoke that one key |
| Prompt text | Depends on the provider | Not stored by the Gateway; metadata only |

Details in the docs: [Claude Code setup](https://agentlab.cresclab.com/docs/en/gateway/quickstart#claude-code) ; [keys](https://agentlab.cresclab.com/docs/en/gateway/keys) ; [limits and budgets](https://agentlab.cresclab.com/docs/en/gateway/limits).

Is it for you

## Check both sides first

### A good fit

- Three or more people on Claude Code, with costs to split or expense
- You want the cap in place before people start
- The same key should also serve Codex, Cursor or your own code

### Worth knowing

- Model spend is drawn from prepaid credit at list price; each top-up carries a 5% fee
- Claude Code needs four environment variables, set once on each machine
- A cap holds the cost before sending: a request that does not fit is refused, not reported later

FAQ

## Claude Code through a gateway

**How do I point Claude Code at an AI gateway?**

Set four environment variables: ANTHROPIC_BASE_URL to https://api.agentlab.cresclab.com, ANTHROPIC_AUTH_TOKEN to your Gateway key, ANTHROPIC_MODEL to the Claude model to use, and ANTHROPIC_DEFAULT_HAIKU_MODEL to a cheap model for its small background calls. Then run claude as usual. [Full setup →](https://agentlab.cresclab.com/docs/en/gateway/quickstart#claude-code)

**What happens at the cap?**

The request is refused before it reaches the model, and nothing is charged. The message names the limit, how much is used and when it resets. An owner or admin can raise it.

**Can I allow only cheaper models?**

Yes. Each key has a model allowlist, and a model outside it is refused. Claude Code can also ask for auto, and the Gateway picks a model from the list by how hard the task is.

**Does the Gateway see our code?**

Requests pass through the Gateway on the way to the model, but it stores no prompt or reply text: only metadata such as usage, model and cost. [How data is handled →](https://agentlab.cresclab.com/docs/en/gateway/data)

**What does it cost?**

Turning it on is free, with no credit card. Model spend is at list price with no markup, drawn from prepaid credit; a top-up starts at US$5 and carries a 5% fee.

Make one key for yourself with a small cap, and read a day of usage.

[Sign up free](https://app.agentlab.cresclab.com/?lang=en&intent=gateway&from=%2Fen%2Fgateway%2Fclaude-code) [See AI Gateway](https://agentlab.cresclab.com/en/gateway)
