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_KEYis 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./statusshows 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 |
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:
export ANTHROPIC_BASE_URL="https://api.infro.io"
export ANTHROPIC_AUTH_TOKEN="sk_infro_..."
export ENABLE_TOOL_SEARCH=trueThe 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;/statusshows 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.
