Skip to content

Agents and multimodal systemsComparison

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

Teams that hit the five-hour or weekly limit on Claude Code or Codex ask whether to move to API keys. This compares what each vendor says about plan limits and API billing, and what a team can see and cap once usage is on keys.

By INFRO Editorial

Published

7 min read

A glowing autonomous agent core coordinating tools, memory, and multiple AI model routes

In short

Claude Pro and Max plans have a five-hour session limit and a weekly limit shared with Claude chat1; Codex plans meter included usage per five hours with weekly limits possible3. 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 planAPI key
What stops workSession and weekly allowanceOnly a limit you set
Claude CodeFive-hour and weekly limits on Pro/Max; weekly on UltraBilled per token at API rates
CodexEstimated messages per five hours, weekly limits may applyBilled at API pricing, separate from the allowance
Cost shapeFixed per seat, plus any paid extra usageVariable with tokens used
Per-person viewWhatever the vendor's admin screens giveYours to build, or read from a gateway
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

Setup in three lines

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

Shell
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 (opens in a new tab).6 Per-key limits are described under rate and spend limits (opens in a new tab).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 and routing Claude Code and Codex through a gateway.

Questions readers ask

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 charges4. 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 key3.
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 bill8.

From the team that builds it

Where this shows up in INFRO

INFRO is a control plane in front of the provider accounts you already hold. The capabilities below are the parts of it this article touches, each with the documentation that defines its behaviour.

  • Claude Code and Codex through INFRO

    Available with a plan

    Point Claude Code, the Claude Agent SDK, Codex or the OpenAI Agents SDK at INFRO by changing the base URL and the key. Anthropic's Messages API and OpenAI's Responses API, with routing, budgets refused before the call, guardrails and the request log applied as on every other request.

  • Coding agent sessions and spend per person

    Available with a plan

    Claude Code, Codex and OpenCode recognized from their own headers, with each session and the subagents it starts grouped in the request log; session, tag and agent headers and W3C baggage for any other client; labels on a gateway key added to every request it makes; estimated provider spend per person and per agent.

  • Budgets and spend ceilings

    Available with a plan

    A hard cap per organization, project, member, and key, with alerts at your own thresholds.

    Read the documentation for Budgets and spend ceilings
  • Cost cards and a Summary layout each person arranges

    Available with a plan

    Cost per project, customer, feature, team member, coding agent, workflow and promoted tag on the Summary, shown when the organization sends that dimension, against the same days of the last cycle. Each member orders, hides and sizes the cards; owners and admins set the organization's default.

INFRO accounts are self-serve. Provider usage is billed to you by your providers; INFRO charges a software subscription and takes 0% of model spend. See plans.

Sources

Numbered in order of first citation. Each was opened and checked against the claim on the date shown.

  1. 1.Use Claude Code with your Pro, Max, or Ultra plan (opens in a new tab) — Anthropic (Claude Help Center). Accessed Nov 26, 2026.
  2. 2.Use Claude Code with your Team or Enterprise plan (opens in a new tab) — Anthropic (Claude Help Center). Accessed Nov 26, 2026.
  3. 3.Codex pricing (opens in a new tab) — OpenAI. Accessed Nov 26, 2026.
  4. 4.Manage API key environment variables in Claude Code (opens in a new tab) — Anthropic (Claude Help Center). Accessed Nov 26, 2026.
  5. 5.Codex authentication (opens in a new tab) — OpenAI. Accessed Nov 26, 2026.
  6. 6.Claude Code & Codex (opens in a new tab) — INFRO Docs. Accessed Nov 26, 2026.
  7. 7.Cost attribution (opens in a new tab) — INFRO Docs. Accessed Nov 26, 2026.
  8. 8.Spend controls (opens in a new tab) — INFRO Docs. Accessed Nov 26, 2026.
  9. 9.Rate & spend limits (opens in a new tab) — INFRO Docs. Accessed Nov 26, 2026.

About this article

Read on 2026-11-26: Anthropic's Claude Help Center articles for Pro/Max/Ultra, Team/Enterprise and API-key environment variables; OpenAI's Codex pricing and authentication pages; and INFRO's coding-agent, spend-control, limits and attribution docs. Plan prices, exact per-plan allowances and any figure the vendors do not publish were left out as unconfirmed.

Last checked against its sources on . The next review is due by . No separate named reviewer is recorded for this article.

How articles are written, sourced and corrected is set out in the editorial standards.