Hit Claude Max 5-hour or weekly limits? Switch to an API key and resume Claude Code in 30 seconds
As of November 22, 2026, when Claude Pro or Max hits its 5-hour session cap or weekly limit, two official paths keep you moving right away: enable Usage Credits inside your subscription to bill prepaid balance at standard API rates in the same session, or export ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN (with unset ANTHROPIC_API_KEY) in the current terminal and run claude -c (--continue) in the same project directory without losing local transcripts or CLAUDE.md.
Updated 2026-11-22
One key for Claude, GPT and leading Chinese models, billed per token, up and running in minutes.
- Billed per token — live rates on /models
- Pay by card (Visa / Mastercard), Apple Pay, Google Pay or crypto
- Self-service: top up and activate instantly
Four points to keep in mind before switching
Environment credentials override subscription login
Setting ANTHROPIC_AUTH_TOKEN takes precedence over a saved claude.ai subscription immediately; setting ANTHROPIC_API_KEY prompts once for approval in interactive mode and applies directly in print mode (-p). Close the shell or unset the variable to return to subscription billing, and verify with /status.
Local transcripts and CLAUDE.md survive auth switches
Conversation transcripts, ./CLAUDE.md, and ~/.claude/CLAUDE.md stay on your local disk. Exit the capped session, export your API variables in that terminal, and run claude -c (--continue) or claude -r (--resume) in the same directory to pick up where you left off.
Anthropic official Sonnet 5.5 rates (per 1M tokens)
Anthropic official API rates: claude-sonnet-5-5 is $2 input, $10 output, $0.10 cache read; claude-opus-5-5 is $4 / $20 / $0.20; claude-fable-5-2 is $8 / $40 / $0.20; claude-haiku-5-5 (prompts up to 100,000 tokens) is $0.10 / $0.50 / $0.01.
Cached reads do not count toward API ITPM limits
API billing has no subscription-style 5-hour or weekly lockouts; instead it enforces per-minute RPM, ITPM, and OTPM limits plus monthly spend caps across Start, Build, and Scale tiers. Official rate-limit docs state cache_read_input_tokens do not count toward ITPM, lifting real throughput.
Why you hit the cap and how credential precedence works
As of November 22, 2026, Anthropic's Help Center states that Pro and Max plans carry both a 5-hour session limit and a weekly limit, while Max and Ultra also enforce a separate weekly limit for Fable; web, desktop, IDE extensions, and terminal Claude Code all draw from the same shared pool, and verified Ultra accounts have no 5-hour limit.
Claude Code's authentication docs confirm that environment-variable API credentials take priority over a signed-in claude.ai subscription: ANTHROPIC_AUTH_TOKEN sends an Authorization: Bearer header and overrides immediately, while ANTHROPIC_API_KEY sends X-Api-Key and prompts once in interactive mode.
Because shell exports apply only to the current terminal process, you can finish an urgent PR on an API key without running /logout or editing your global shell profile, then open a clean terminal once your subscription resets.
2026-11-22 status: mid-week caps bite harder, and wrap-up allowance does not raise quotas
Anthropic's Help Center notes that hitting your 5-hour session limit mid-response may trigger a small, capped wrap-up allowance displaying "Usage limit reached · wrapping up" so the in-progress step can finish, but that usage still counts toward your weekly limit and never covers a new message sent afterward (up to 1 time per weekly period on Pro, or each 5-hour hit within your weekly limit on Max).
Meanwhile, monthly API credits included with Max and Ultra plans cannot be used in Claude Code, Claude apps, or Usage Credits. In community threads from 2026-11-17 to 2026-11-21 on Reddit, X, and V2EX, developers reported exhausting Max weekly limits in 2 days or burning through quotas on long context sessions, pushing more teams toward a hybrid workflow: subscription for normal days, API key or another tool when caps hit mid-week.
Three dates: official precedence rules, mid-week community hits, and today's switch workflow
Anthropic's Help Center published its guide on managing API key environment variables in Claude Code on 2026-05-05, spelling out that environment API keys override logged-in subscriptions, recommending temporary per-terminal exports, and advising periodic /status checks.
Between 2026-11-17 and 2026-11-21, community reports spiked across Reddit, X, and V2EX: Max users wrote about draining a weekly limit in 2 days on Opus 5.5, and German-speaking developers noted Monday-reset weekly caps running dry by Thursday morning, spurring demand for temporary pay-as-you-go bridging rather than buying another $100 Max or $200 Ultra seat.
As of November 22, 2026, Anthropic's official documentation lays out two clean continuation routes: turn on Usage Credits inside your subscription, or export ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN in a single terminal and resume with claude -c. Combined with Anthropic's 0.05x and 0.025x cache-read pricing and 7-day QCode packs, mid-week sprints stay moving without a second monthly plan.
What is confirmed vs common misconceptions and community reports
Confirmed (Anthropic Help Center, Claude Code docs, pricing, and rate-limit pages)
As of November 22, 2026, each point below is documented directly by Anthropic.
- 1Plan limits: Pro and Max carry both a 5-hour session limit and a weekly limit; Max and Ultra have an additional weekly limit for Fable; verified Ultra accounts have no 5-hour cap; web, desktop, IDE, and Claude Code share one pool.
- 2Included credits boundary: monthly API credits bundled with Max and Ultra cannot be used in Claude Code, Claude apps, or Usage Credits.
- 3Precedence and verification:
ANTHROPIC_AUTH_TOKENsends Authorization: Bearer and overrides claude.ai immediately;ANTHROPIC_API_KEYsends X-Api-Key, prompts once in interactive mode, and applies immediately in -p mode; /status shows Anthropic base URL and active credential source, while claude auth status prints JSON auth status. - 4Resuming work: claude -c (
--continue) loads the most recent interactive session in the current directory and claude -r (--resume) resumes by ID, name, or picker; by default the initial system prompt snapshot is reused until compaction. - 5Official API rates and limits: per 1M tokens (input / output / cache read), Sonnet 5.5 is $2 / $10 / $0.10, Opus 5.5 is $4 / $20 / $0.20, and Fable 5.2 is $8 / $40 / $0.20 (5m cache writes are $2.50 / $5 / $10; 1h cache writes are $4 / $8 / $16). Monthly API spend caps are $500 on Start, $1,000 on Build, and $200,000 on Scale; Start-tier Fable 5.2 runs at 4,000 RPM / 500,000 ITPM / 100,000 OTPM, and cache_read_input_tokens do not count toward ITPM (official example: 2,000,000 ITPM at an 80% cache hit rate effectively processes 10,000,000 input tokens per minute).
Common misconceptions and community reports (not official policy)
Do not build your workflow around these myths.
- 1"Hot-swap a third-party API key inside a running subscription process" — Claude Code reads shell environment variables at startup, so switching via shell exports requires exiting the process, exporting in the shell, and running claude -c (
settings.jsonenv edits reapply live, but are awkward for temporary bridging back to a subscription). - 2"Switch to Sonnet via /model after hitting your weekly limit" — both 5-hour and weekly limits are shared across models; changing models only helps when a single-family cap triggers, not when the overall weekly limit is exhausted.
- 3"Use Max or Ultra monthly API credits to keep running Claude Code" — official docs explicitly state those bundled monthly credits cannot be used in Claude Code or Usage Credits.
- 4"Switching to an API key wipes your context and
CLAUDE.md" — transcripts andCLAUDE.mdlive on local disk and reload when you run claude -c in the same directory. - 5Community anecdotes such as draining Ultra overnight, losing 39% of a 5-hour quota in 5 minutes, or extrapolating Ultra to $8000 per month reflect individual workloads, not official quotas.
Official Usage Credits (inside subscription) vs external API key (single-terminal switch)
Path A: Enable official Usage Credits (stay in session)
Turning on Usage Credits in Pro, Max, or Ultra settings lets you keep working in the same session after hitting a 5-hour, weekly, or Fable cap by drawing down prepaid balance at Anthropic's standard API rates without restarting. It requires a supported payment card and prepaid Claude Console balance, careful checks on Console auto-reload settings to avoid unwanted refills, and stays tied to one vendor's model lineup and account terms.
Path B: Export an API key in the current terminal (resume with claude -c)
Exit the capped process, export ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN only in that shell (leaving ~/.zshrc and ~/.bashrc untouched), and run claude -c in the same directory. When your subscription resets, closing the shell puts you straight back on your plan. On official Anthropic API rates, 10M cached tokens cost just $1 on Sonnet 5.5 or $2 on Opus 5.5 and Fable 5.2—far less than buying a second $100 Max or $200 Ultra subscription for a few days—and an external gateway unlocks multi-model switching and global payment methods under one key.
3 steps in 30 seconds: bridge the cap without touching global config
- 1Confirm the cap and exit cleanly: run /status inside Claude Code to confirm you are on a claude.ai subscription and have hit a limit (messages like "You've hit your weekly limit" or "You've hit your session limit"), then exit Claude Code while keeping the terminal in your project directory.
- 2Export temporary credentials in this shell only: run unset
ANTHROPIC_API_KEYfirst so an older Console key cannot clash, then run exportANTHROPIC_BASE_URL="https://api.qcode.cc/api" and exportANTHROPIC_AUTH_TOKEN="cr_your_key" (in PowerShell use $env:ANTHROPIC_BASE_URL= "https://api.qcode.cc/api" and $env:ANTHROPIC_AUTH_TOKEN= "cr_your_key"; do not write these into~/.zshrc,~/.bashrc, or committed .claude/settings.jsonso you can revert by closing the window). - 3Resume locally and control model spend: run claude -c in the same project directory to load your latest transcript (or claude -r to pick a named session), check /status to confirm Anthropic base URL and
ANTHROPIC_AUTH_TOKENare active, use /modelclaude-opus-5-5or /modelclaude-fable-5-2for heavy planning, and switch to /modelclaude-sonnet-5-5or /modelglm-5.3for routine edits; once your plan resets, open a fresh terminal and run claude to return to your subscription automatically.
Keep your subscription, bridge mid-week caps: QCode 7-day Pay-as-you-go Packs
QCode is an independent API access service with no affiliation to Anthropic, OpenAI, or other vendors. Built for a hybrid workflow where you keep your Pro or Max plan for routine days and bridge mid-week limits on demand: Not ready for a monthly plan? Pay-as-you-go Packs start at $4 for a one-time quota you use within 7 days; if you already have a Personal Plan, add a booster pack when you need more quota.
Pay-as-you-go Packs allow up to 5 concurrent requests, and buying another pack after expiry restores and stacks quota onto the same cr_ API key (Personal Plan keys cannot renew on the same key after expiry and require issuing a new key). Endpoints follow each protocol: Claude Code uses ANTHROPIC_BASE_URL=https://api.qcode.cc/api (https://asia.qcode.cc/api for mainland China, https://us.qcode.cc/api for North America and Europe), Codex CLI uses https://api.qcode.cc/openai, and OpenAI-compatible clients use https://api.qcode.cc/openai/v1.
One cr_ key drives multiple models on offer—plan architecture on claude-opus-5-5 or claude-fable-5-2, then run routine coding on claude-sonnet-5-5, gpt-6.2-sol, deepseek-v4.1-flash, kimi-k3.1-pro, or glm-5.3; billing is per token with live per-model rates on /models. Top-ups accept Visa and Mastercard, Apple Pay, Google Pay, Alipay, WeChat Pay, Russian local bank cards and SBP (plus CIS cards), and USDT crypto across 18 networks (0% platform fee, usually minutes, up to 12 hours).
Common questions
Will switching to an API key lose my conversation history or CLAUDE.md?
No. Your project ./CLAUDE.md, user-level ~/.claude/CLAUDE.md, and session transcript files are stored locally on disk and are independent of authentication. After exiting a capped session, export ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN in the same project directory and run claude -c to resume the latest conversation, or claude -r to pick any saved session.
How do I verify whether Claude Code is billing my API key or my Pro/Max subscription?
Run /status inside Claude Code for an immediate check. According to the official gateway docs, an active gateway session displays an Anthropic base URL line on the Status tab and lists ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY on the Auth token or API key line; if you see Login method pointing to a claude.ai account instead, you are still on subscription billing. Outside Claude Code, claude auth status prints the authMethod field as JSON.
How do I switch back to my Pro or Max subscription after limits reset?
As long as you did not save the exports into ~/.zshrc, ~/.bashrc, or settings.json, simply close the temporary terminal and open a fresh shell to run claude—your saved claude.ai login resumes automatically without running /login again. To switch back inside the same shell, run unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN ANTHROPIC_API_KEY, restart claude, and confirm with /status.
What happens if both ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN are set?
They map to different HTTP headers, so leaving both set can trigger auth-conflict warnings or 401 errors. ANTHROPIC_AUTH_TOKEN sends Authorization: Bearer while ANTHROPIC_API_KEY sends X-Api-Key. When connecting to QCode (https://api.qcode.cc/api), keep only ANTHROPIC_AUTH_TOKEN and run unset ANTHROPIC_API_KEY first to clear any leftover Console key, then verify the active source with /status.
How does temporary API billing work, and will it auto-charge a monthly fee?
QCode Pay-as-you-go Packs carry no recurring monthly charge: you buy a one-time 7-day quota billed per token that stops cleanly when exhausted (HTTP 402), with live rates on /models. For reference on Anthropic's official API table, claude-sonnet-5-5 lists at $2 input, $10 output, and $0.10 cache read per 1M tokens, while claude-opus-5-5 is $4 / $20 / $0.20. Note that API-key runs in Claude Code default to a 5-minute prompt cache, and you can set CLAUDE_CODE_PROMPT_CACHE_TTL to 1h when you want longer caching (1-hour cache writes bill at a higher rate).
How can I top up an API key without an international credit card?
While Anthropic's Console requires a standard payment card for prepaid credits, QCode supports global payment methods: Visa and Mastercard, Apple Pay, Google Pay, Alipay, WeChat Pay, Russian local bank cards and SBP (plus CIS cards), and USDT cryptocurrency across 18 networks with 0% platform fee (usually minutes, up to 12 hours). USD and CNY balances are tracked separately so you can pick whichever suits your payment method.
Sources
Anthropic Help Center guide on using Claude Code with Pro, Max, or Ultra plans (support.claude.com, checked 2026-11-22); Anthropic Help Center guide on managing API key environment variables in Claude Code (support.claude.com, published 2026-05-05, checked 2026-11-22); Claude Code official documentation for authentication, cli-reference, env-vars, and llm-gateway-connect (code.claude.com, checked 2026-11-22); Claude API official pricing and rate-limits docs (platform.claude.com, checked 2026-11-22); community limit discussions on Reddit, X, and V2EX (2026-11-17 to 2026-11-21), used as community context only. All checked on 2026-11-22.
Hit your cap mid-week? Switch to an API key in 30 seconds and ship your PR
No monthly plan required: create a QCode account for a cr_ API key, export ANTHROPIC_BASE_URL=https://api.qcode.cc/api and ANTHROPIC_AUTH_TOKEN in your current shell, and resume your project with claude -c in 30 seconds, with live per-model rates on /models.
Related reading
Pay-as-you-go Packs: no monthly plan, valid 7 days
Buy a one-time quota valid for 7 days or add a booster pack to a Personal Plan; per-model rates are on /models.
Moving Claude Code to an API key after a stopped subscription: export, backup, credentials, cache billing (2026-11)
Checked 2026-11-20: a stopped Claude subscription does not end Claude Code work — export the data through the official entry point, back up CLAUDE.md and settings.json, swap two variables, and note the main-conversation cache drops from one hour to five minutes.
Claude Code prompt caching: 5 minutes or 1 hour, and how cache read and cache write are billed (2026-11)
Checked 2026-11-20: subscriptions default to 1 hour, API keys to 5 minutes; writes 1.25x for 5 minutes and 2x for an hour, reads 0.025x-0.1x, with a Fable 5.2 worked example.
Crypto payment guide
Nine coins, 56 networks, zero platform fee for AI coding API credits.
Anthropic's documentation, pricing, and rate-limit pages were checked on 2026-11-22 and are authoritative at code.claude.com, platform.claude.com, and support.claude.com. QCode.cc is an independent API access service with no affiliation to and no endorsement from Anthropic, OpenAI, or other vendors. QCode model availability and live rates follow qcode.cc/models.