Provider-by-provider table
Every cell comes from the vendor documentation or a source named in the row. Where I could not find a statement, the cell says "not documented".
The Vercel row is the only one with a daily period documented, and that is the useful one for agents. Routing Claude Code or a Codex-style agent through a gateway with a daily budget turns the cap from "a bad month" into "a bad day".
Claude Code: the plan versus API split
Claude Code bills in one of two ways and the caps above only touch one of them. Signed in with a Claude plan, you hit plan usage limits and extra usage. Using an API key from a Console organization, you pay per token and the Console limits apply.
On 7 October 2026 Anthropic announced monthly API credits for Max and Team plans. The help center article lists $100 for Max 5x and $200 for Max 20x, with Team seats pooled and capped at $500. They cover the Messages and Message Batches APIs, the Console Playground, Managed Agents and the Agent SDK. They do not cover interactive Claude Code in the terminal, IDE, desktop or web, and they do not cover extra usage or Claude on Bedrock or Vertex. Unused credits expire at the end of each billing cycle.
The catch for scripts: claude -p and the Agent SDK are covered only when you run them with an API key from your linked Console organization, not while signed in with your plan. A headless loop launched from a cron job therefore spends credits first, then real dollars, and the Console limit is the only thing between that loop and your card.
The five-step cap stack
No single layer is enough. Each one fails in a different way, so you stack them from slowest and hardest to fastest and softest.
Step 1: provider cap on every key you hand to an agent
Create a separate workspace (Anthropic) or project (OpenAI) for agents, and give it its own key. On OpenAI, turn on "Enforce a hard limit" for that project. On Anthropic, set the workspace limit under the organization limit, since a workspace limit can only be lower than the organization's. Pick a number you could lose without discussion, not your budget.
Step 2: organization limit as the backstop
Set the organization limit at your real monthly ceiling. Anthropic evaluates both the workspace and organization limiters on every request, so the lower one binds. Because enforcement lags, set the number below your true limit. Google tells people to do exactly that for Spend Caps.
Step 3: hook-level daily cap in Claude Code
Claude Code's hooks documentation describes a PreToolUse hook that receives JSON on stdin (tool_name, tool_input, session_id and more) and can block the call two ways: exit code 2, where stderr becomes the reason shown to Claude, or exit 0 with a JSON object whose permissionDecision is "deny". Exit 0 with no JSON means the normal permission flow runs. Other non-zero exit codes are non-blocking errors and the tool call proceeds, which matters: a crashing script fails open.
A hook sees tool calls, not dollars, so this layer counts calls as a proxy for loop speed. It will not catch one enormous call. It will catch a loop.
#!/bin/bash
# .claude/hooks/daily-call-cap.sh (chmod +x)
LIMIT=1500
FILE="$HOME/.claude/call-count-$(date +%F)"
COUNT=$(( $(cat "$FILE" 2>/dev/null || echo 0) + 1 ))
echo "$COUNT" > "$FILE"
if [ "$COUNT" -gt "$LIMIT" ]; then
jq -n --arg r "Daily tool-call cap of $LIMIT reached" '{
hookSpecificOutput: {
hookEventName: "PreToolUse",
permissionDecision: "deny",
permissionDecisionReason: $r
}
}'
fi
exit 0
Register it in .claude/settings.json under hooks, then PreToolUse, with an empty or * matcher and a command handler pointing at the script. Counting is per machine, so run it where the agent runs.
Step 4: per-PR cost tracking
A cap tells you a loop happened. Per-PR tracking tells you which task caused it. Log tokens and model per session, tag with the branch, and compare against what the same work costs in a human hour. The Agent Run Cost Simulator models a run before you start it, and the AI Model Cost Calculator compares the same token volume across models. The Agent Cost Control spreadsheet is a ready-made ledger for the per-PR numbers.
Step 5: alerts that reach a human
Alerts still matter. They are the only layer that tells you the other four fired. Send them somewhere you read within the hour, at 50 and 80 percent, and treat a hard-cap error in the logs as an incident, not noise. Codex users: the official Codex pages I could reach did not document a spend or token ceiling per session. Third-party write-ups describe a rollout-level token budget in recent Codex CLI builds, but I could not confirm the setting names, so rely on your OpenAI project cap and a wrapper script until you verify them.
Worked example: one runaway loop
Assume an agent that retries a failing test run once every 20 seconds overnight, 10 hours, 1,800 turns. Prices come from the Anthropic pricing page: Opus 5.5 at $4 input and $20 output per MTok, Sonnet 5.5 at $2 and $10, Haiku 5.5 at $0.10 and $0.50 for prompts up to 100K tokens. Each turn sends 150K tokens of context and gets 2K tokens back. Haiku is modelled at an 80K prompt to stay under its 100K tier.
The cached column uses the published cache-hit rates of $0.20 per MTok on Opus 5.5 and $0.10 on Sonnet 5.5, and counts only the input at those rates plus normal output. Real loops mix cache writes and misses, so your number lands between the columns.
Now the cap. A $50 workspace limit trips at turn 78 on uncached Opus, about 26 minutes in. Without it, the same loop runs all night. With cache hits and a $50 cap, the loop stops around turn 710, about four hours in. This is also the argument for routing retry-heavy automation to a cheaper model. The Haiku 5.5 100K-token rule explains where that tier stops being cheap. For a tested set of hooks, settings and runbooks, see the Claude Code Production Pack.
Quick answers
Does Claude Code have a built-in dollar limit?
Not one I found documented. Plan users hit plan usage limits. API-key users rely on Console organization and workspace limits, whose failure behaviour Anthropic does not describe on the pages I read.
Do the new Max API credits cover Claude Code?
No. Anthropic's article excludes interactive Claude Code, and says claude -p and the Agent SDK count only with a Console API key.
Can a hook cap dollars?
No. A PreToolUse hook receives the tool name and input, so it can count calls or inspect commands. Dollar enforcement belongs to the provider or a gateway.
Which provider has the fastest hard stop?
Vercel AI Gateway checks the budget before each request, per its docs, and supports a daily period. Every other cap here documents some lag.
Is AWS Bedrock safe to leave uncapped?
I could not verify an official, generally available Bedrock hard cap. Hacker News commenters reported little built-in limiting, and AWS spend limits are a limited release. Add a gateway or your own proxy until that changes.
What number should I set?
Set the agent workspace at the amount you can lose without a conversation, and the organization limit below your real ceiling, because every cap here lags.
Note: Prices and limits reflect vendor documentation read on 13 October 2026 and change often. Verify in your own console before relying on any figure.
Comments · 0
Beta: comments are stored locally on your device and not visible to other readers.
No comments yet. Be the first to share your thoughts.