# Claude Code and Codex limits for teams: plan or API keys?

URL: https://infro.io/blog/claude-code-and-codex-limits-for-teams-plan-or-api-keys
Author: INFRO Editorial (https://infro.io/blog/editorial)
Publisher: INFRO
Published: 2026-11-26
Last modified: 2026-11-26
Last reviewed: 2026-11-26 (next review due 2026-12-26)
Topic: Agents and multimodal systems
Format: Comparison

> Claude Pro and Max plans have a five-hour session limit and a weekly limit shared with Claude chat[^claude-pro-max]; Codex plans meter included usage per five hours with weekly limits possible[^codex-pricing]. API keys bill per token at the provider's own rates and have no plan allowance, so the team needs its own per-person view and caps.

Key takeaways:
- Claude Pro and Max have a five-hour session limit plus a weekly limit shared across Claude and Claude Code; Codex plans publish estimates, not fixed message limits.
- An API key replaces the plan's allowance with per-token billing by the provider, so the limit that stops work becomes the budget you set.
- A stray ANTHROPIC_API_KEY in a shell makes Claude Code bill the API instead of the subscription, so check which credential is active.
- With one gateway key per developer, spend per person and per agent is an estimate you can read and cap before the provider is called.
- Plan sign-in and API keys are separate paths; only API-key usage can be pointed at a gateway.

## Two meters, two kinds of limit

A subscription plan and an API key are different meters. A plan gives a person an allowance that resets on a clock; when it runs out, work stops or the person pays for more. An API key has no allowance. The provider bills tokens as they are used, at its own rates, and the only ceiling is the one you set. Moving a team from one to the other swaps a limit that surprises people for a bill that surprises finance, unless the team adds its own visibility and caps.

This post compares the two for Claude Code and Codex using the vendors' own help and pricing pages, then covers what a team needs once usage is on keys. It does not cover routing a subscription through a gateway, because that is not something to do: plan sign-in stays between the person and the vendor, and a gateway takes API keys only.

## What Claude says about session and weekly limits

For individual Pro and Max accounts, Anthropic describes a five-hour session limit and a weekly limit. Ultra plans have a weekly limit, and verified Ultra accounts have no five-hour limit. Max and Ultra also have a separate weekly limit for Fable models. These limits are shared across Claude and Claude Code, so chat in the app counts against the same allowance as terminal work.[1]

When a limit is reached, Anthropic lists the options: upgrade a tier, enable paid extra usage on the plan, switch to a Console account and buy API usage for intensive sprints, or wait for the reset. API usage chosen this way is billed at standard API rates, distinct from plan pricing.[1]

For organizations, the Team and Enterprise article is separate. Claude Code is included with every Team seat, and premium seats offer more usage. Usage-based Enterprise plans, including self-serve Enterprise, have no per-seat usage limits and bill at API rates, while Team and seat-based Enterprise plans can enable paid extra usage once included limits are hit.[2] If you searched for a "Claude Code team limit", this is the page that applies to you, not the Pro/Max one.

## What Codex says about included usage

OpenAI says ChatGPT Work and Codex share pricing and usage limits. The Codex pricing page publishes estimates of local messages per five-hour period for Plus and Standard Business, and says they are not fixed message limits: model, task size, context, tool use and whether the work runs locally or in the cloud all change consumption. It also says weekly limits may apply, that Pro plans currently have no five-hour limit, and that Enterprise and Edu users on flexible pricing have no fixed rate limits.[3]

The practical consequence is the same as on Claude: the team cannot compute its ceiling from the page. The page points to the usage dashboard for current limits and reset times.[3] Cloud tasks may draw more of the allowance than local messages, and local messages and cloud chats share one allowance.[3]

## What an API key changes

On both products, an API key is a separate billing path.

- **Claude Code.** If an `ANTHROPIC_API_KEY` is set in the environment, Claude Code uses it instead of the subscription, and charges go to the API account behind that key, even if the person is also logged in with a plan.[4] This is the most common way a team ends up on pay-as-you-go by accident. `/status` shows which method is active.
- **Codex.** A person can sign in with ChatGPT or with an API key. With a key, OpenAI bills through the Platform account at standard API rates, not the plan's included allowance.[5] OpenAI lists API-key use as suited to automation in shared environments such as CI, with no cloud-based features like GitHub code review or Slack, and with model availability following the models your key can call.[3]

Both providers bill API usage at their published rates. Anything a gateway or dashboard shows in dollars for that traffic is an estimate of what the provider will bill, not a price from the gateway.

|  | Subscription plan | API key |
| --- | --- | --- |
| What stops work | Session and weekly allowance | Only a limit you set |
| Claude Code | Five-hour and weekly limits on Pro/Max; weekly on Ultra | Billed per token at API rates |
| Codex | Estimated messages per five hours, weekly limits may apply | Billed at API pricing, separate from the allowance |
| Cost shape | Fixed per seat, plus any paid extra usage | Variable with tokens used |
| Per-person view | Whatever the vendor's admin screens give | Yours to build, or read from a gateway |

Table: Plan limits against API keys, as the vendors describe them

## When each fits

A plan fits people whose use is steady and interactive, because a fixed seat price is easy to budget and a limit is a natural brake. It fits poorly when a few people hit the five-hour or weekly wall every week, since the options Anthropic lists then are a higher tier, paid extra usage or API usage.[1]

API keys fit shared automation, CI, agents that run unattended, and people who exceed their plan regularly. The cost is variance: one runaway loop can spend more than a seat costs, and a key shared by five people hides who did it. Many teams end up mixed, with plan seats for most people and keys for automation and overflow. That is a reasonable split as long as the keyed part has its own limits.

## Spend per person and per agent on API keys

Once usage is on keys, the provider's invoice shows one number per account. To see per person and per agent, give each developer, and each unattended agent, its own key, and record requests with an estimated cost.

INFRO is one way to do this. It is a software subscription and your provider still bills you for the tokens; INFRO adds nothing to them.[6] Its coding-agent docs describe recognizing Claude Code, Codex and OpenCode from their own headers, grouping each session and the subagents it starts in the request log, and reporting estimated provider spend per organization member and per agent through `GET /v1/usage?group_by=member` and `group_by=agent`.[6] Labels on a gateway key such as `team=platform` are added to every request the key makes, and the code holding the key cannot change them.[6] The console's Summary can show cost per team member and per coding agent as cards, with the largest ones compared against the same days of the last cycle, all in estimated provider cost.[6]

Attribution applies from the first request that carries it; earlier requests are not backfilled.[7] Turn it on before the first month you want to read.

## Budgets with a hard limit

The vendor limits you are used to are time windows. On keys you set money windows instead. INFRO's budget scopes are organization, project, member and key. A key's spend limit resets daily, weekly or monthly, or is a lifetime ceiling, and key limits always block. An organization budget can be a monthly target that only alerts, or a hard cap that only the owner sets.[8]

A blocking budget admits a request only if its worst-case estimated cost fits the room left, counting recorded spend and reservations held for in-flight requests. Close to a limit, a request can be refused briefly for room that is reserved but not yet spent.[8] The refusal is a `402` returned before the provider sees the request.[6] The check is against INFRO's estimate, an upper bound on that estimate and not on the provider's invoice.[8]

> **Example: Illustrative: a weekly key limit**
> These figures are made up to show the mechanism. A team of eight gives each developer a key with a weekly limit and gives the nightly agent its own key with a smaller one. When a developer's key reaches its limit on Thursday, their requests return `402` until Monday 00:00 UTC, the start of the key's weekly window, and the other seven keep working. The nightly agent cannot consume the developers' room, because the limits are per key.

## Setup in three lines

This path is for API-key usage only. Claude Code reads the base URL and token from the environment:

```bash
export ANTHROPIC_BASE_URL="https://api.infro.io"
export ANTHROPIC_AUTH_TOKEN="sk_infro_..."
export ENABLE_TOOL_SEARCH=true
```

The gateway key replaces the plan login for that shell, and the provider account behind it is your own, connected in the console. Codex takes a model provider block in `~/.codex/config.toml`, with `base_url = "https://api.infro.io/v1"`, `env_key = "INFRO_API_KEY"` and `wire_api = "responses"`. The full Codex, OpenCode and Agents SDK snippets, the attribution headers and the list of which providers are served as written are on the [Claude Code & Codex page of the INFRO docs](https://infro.io/docs/coding-agents).[6] Per-key limits are described under [rate and spend limits](https://infro.io/docs/api/limits).[9]

## A decision checklist

- [ ] Find who hit limits last month and whether it was the five-hour or the weekly window.
- [ ] Check every shell and CI runner for a stray `ANTHROPIC_API_KEY`; `/status` shows the active method.
- [ ] Keep plan seats for steady interactive use; put unattended agents and overflow on keys.
- [ ] Give each keyed person and agent its own key, with a limit.
- [ ] Decide which budgets only alert and which block.
- [ ] Compare estimated spend with the provider invoice each month.

For wider cost context, see [coding agent costs for teams](https://infro.io/blog/coding-agent-costs-for-teams) and [routing Claude Code and Codex through a gateway](https://infro.io/blog/claude-code-codex-through-gateway).

## Questions

### Why is Claude Code billing my API account when I have a Max plan?

Claude Code prefers an API key set in the environment over a logged-in subscription, so a leftover ANTHROPIC_API_KEY produces pay-as-you-go charges[4]. Run /status to see which method is active and unset the variable if you want plan usage.

### Does a Codex API key use my ChatGPT plan allowance?

No. API-key sessions are billed at API pricing, separately from the ChatGPT allowance, and cloud features such as GitHub code review and Slack are not available on a key[3].

### Can I put my Claude or ChatGPT subscription behind a gateway?

No, and this post does not suggest it. A gateway takes API keys. The base URL and key setup applies only to usage you move onto provider API keys.

### Is the spend INFRO shows the same as my invoice?

No. It is an estimate from the provider's reference rates, or the rates you enter; your provider's own invoice is the bill[8].

## Sources

1. Use Claude Code with your Pro, Max, or Ultra plan — Anthropic (Claude Help Center). https://support.claude.com/en/articles/11145838-using-claude-code-with-your-pro-or-max-plan (accessed 2026-11-26)
2. Use Claude Code with your Team or Enterprise plan — Anthropic (Claude Help Center). https://support.claude.com/en/articles/11845131 (accessed 2026-11-26)
3. Codex pricing — OpenAI. https://learn.chatgpt.com/docs/pricing.md (accessed 2026-11-26)
4. Manage API key environment variables in Claude Code — Anthropic (Claude Help Center). https://support.claude.com/en/articles/12304248-managing-api-key-environment-variables-in-claude-code (accessed 2026-11-26)
5. Codex authentication — OpenAI. https://learn.chatgpt.com/codex/auth.md (accessed 2026-11-26)
6. Claude Code & Codex — INFRO Docs. https://infro.io/docs/coding-agents (accessed 2026-11-26)
7. Cost attribution — INFRO Docs. https://infro.io/docs/features/attribution (accessed 2026-11-26)
8. Spend controls — INFRO Docs. https://infro.io/docs/org/spend-controls (accessed 2026-11-26)
9. Rate & spend limits — INFRO Docs. https://infro.io/docs/api/limits (accessed 2026-11-26)
