Claude Code has a per-session context window, which is how much conversation the model can hold at once, and a plan usage quota, which is how much you can consume in a five-hour session window and a week. Context is 200K or 1M tokens depending on model and plan, and running out is handled by auto-compaction or fixed with /compact and /clear. Quota is per account, and running out means waiting for the window, switching model, or turning on usage credits. Neither limit is a published daily token number, because Anthropic does not publish one.
- The context window is per session and refills instantly with
/clear. - The usage quota is per account and refills only with time, or with paid usage credits.
- The error text tells you which: a compaction or context notice means the first, "session limit" or "weekly limit" means the second.
- Sonnet 5 runs at 1M tokens on the Anthropic API and auto-compacts near 967K, as of August 2026.
- A larger context window makes quota drain faster, because every turn re-sends more.
- There is no published daily token limit. Consumption is measured against a five-hour session window and a weekly cap.
Two limits, one word
A token limit in Claude Code is either the context window or the plan quota. They share no mechanism, no unit, and no fix.
The two things people mean by "Claude Code token limit".
| Context window | Usage quota | |
|---|---|---|
| Scope | One session | Your whole account |
| Measures | How much fits in one request | How much you have consumed over time |
| Typical size | 200K or 1M tokens, by model and plan | Not published as a token number |
| What happens | Claude Code compacts older history into a summary | Requests are refused until the window resets |
| How to recover | /compact or /clear, immediately | Wait, switch model, or enable usage credits |
| Costs money? | No | It is what you are paying for |
| Applies on an API key? | Yes | No. Only per-minute throughput limits |
How big the context window actually is
The 200K number that circulates in older write-ups is now the floor, not the ceiling. Sizes as of August 2026:
Context window per model in Claude Code, August 2026. Verify against the model configuration docs before budgeting.
| Model | Context window | Notes |
|---|---|---|
| Claude Sonnet 5 | 1M on the Anthropic API | No 200K variant and no [1m] suffix to select |
| Claude Opus 5, Opus 4.8, Opus 4.7 | 1M on the Anthropic API | 200K when run through Bedrock, Google Cloud, or Microsoft Foundry |
| Claude Opus 4.6, Sonnet 4.6 | 200K by default | 1M available through the [1m] variant, plan permitting |
| Claude Haiku 4.5 | 200K | No extended context option |
The 1M window is plan-gated on a subscription
Extended context is not uniformly available. On the API you get it outright. On a subscription it depends on your tier.
Extended context availability by plan, from the Claude Code model configuration docs, August 2026.
| Plan | Opus at 1M | Sonnet 4.6 at 1M |
|---|---|---|
| Max, Team, and Enterprise | Included with the subscription | Requires usage credits |
| Pro | Requires usage credits | Requires usage credits |
| API and pay as you go | Full access | Full access |
Select it explicitly when your account supports it:
/model opus[1m]
/model sonnet[1m]
/model claude-opus-4-8[1m]
Managing the context window
The context window is working memory for one conversation. Claude Code compacts automatically as you approach the limit, so filling it does not end your session. It does cost you a summarization pass, and summaries lose detail.
The four controls, and when each is the right one.
| Command | What it does | When to use it |
|---|---|---|
/context | Live breakdown of what is in context by category, with suggestions | First. Before you guess at the cause |
/compact | Summarizes the conversation so far, keeping decisions | Mid-task, when you want continuity |
/clear | Starts fresh with no history | Between unrelated tasks. Costs nothing |
/autocompact | Sets how full the window gets before the automatic pass runs | When the automatic pass fires later than you want |
Where auto-compaction fires by default
With no window size configured, Claude Code compacts at the model context limit, with several documented exceptions.
Default auto-compact thresholds, August 2026.
| Session | Compacts at |
|---|---|
| Sonnet 5 on the Anthropic API | About 967K tokens |
| Sonnet 4.6 and Opus 4.6 without extended context | The 200K boundary |
| Opus 4.8 and Opus 5 running with a 200K window | The 200K boundary |
| Cloud sessions | As the conversation approaches the model limit |
| Everything else, nothing set | The model context limit |
You can move that threshold. The command accepts 100K to 1M, and Claude Code caps it at the model window.
# For this session and later ones, saved as autoCompactWindow
/autocompact 500k
# For one launch only
claude --autocompact 500k
# In scripts and cloud environments (plain token count only)
export CLAUDE_CODE_AUTO_COMPACT_WINDOW=500000
# Back to the window tuned for your model
/autocompact auto
What survives compaction, and what does not
This is the part that produces the "Claude forgot the rule I gave it" complaint. Compaction rewrites message history, so anything that lived in message history is summarized away.
What happens to each instruction mechanism when a session compacts, from the Claude Code context window docs.
| Mechanism | After compaction |
|---|---|
| System prompt and output style | Unchanged. Not part of message history |
Project-root CLAUDE.md and unscoped rules | Re-injected from disk |
| Auto memory | Re-injected from disk |
Rules with paths: frontmatter | Lost until a matching file is read again |
Nested CLAUDE.md in subdirectories | Lost until a file in that subdirectory is read again |
| Invoked skill bodies | Re-injected, capped at 5,000 tokens per skill and 25,000 total |
The other lever is not compaction at all. Send large reads to a subagent. The file contents stay in the subagent context window and only the summary comes back into yours, which is the cheapest way to read a lot without paying for it on every subsequent turn.
Managing the usage quota
The quota is what your subscription buys. It tracks token cost rather than message count, it is shared with Claude chat and Cowork, and no slash command affects it.
Quota structure by plan, August 2026. Multipliers are usage per session against Pro.
| Plan | Session window | Weekly limits |
|---|---|---|
| Free | Resets every 5 hours | No Claude Code access |
| Pro, $20/mo | 5 hours, baseline | One limit across all models |
| Max 5x, $100/mo | 5 hours, 5x Pro | All models, plus a Sonnet-only limit |
| Max 20x, $200/mo | 5 hours, 20x Pro | All models, plus a Sonnet-only limit |
| Team Standard seat | 5 hours, 1.25x Pro | One limit across all models |
| Team Premium seat | 5 hours, 6.25x Pro | All models, plus a Sonnet-specific limit |
| API key | None | None. Per-minute throughput only |
Weekly limits reset at a fixed time each week assigned to your account. That time does not move with your usage or your billing date, so the reset you get this week is the reset you get every week.
The escape hatch changed
The old answer to an exhausted weekly cap was "wait, or go get an API key". As of August 2026 there is a third option built into the plan: usage credits let Pro, Max 5x, and Max 20x subscribers keep working past the included allowance, billed at standard API rates.
- Turn them on in Settings, then Usage, add a payment method, and prepay a balance.
- Set a monthly spending cap. You can raise it, or set it to unlimited, which you should not.
- Optionally enable auto-reload when the balance drops below a threshold, with a $2,000 daily redemption ceiling.
- Run
/usage-creditsinside Claude Code to manage them, after signing in with/login. The command is not available with API-key authentication.
Telling them apart instantly
What the message says, and what to do about it.
| If you see | It is | Do this |
|---|---|---|
| A context or auto-compact notice | Context window | Run /context, then /compact or /clear |
| "Conversation compacted" | Context window, already handled | Nothing. Check the summary kept what mattered |
| "You have hit your session limit" | Quota, five-hour window | Take the break, or use usage credits |
| "You have hit your weekly limit" | Quota, weekly | Switch model, use credits, or wait for the fixed reset |
| A model-specific limit message | Quota for that model only | Switch with /model and keep working |
| 429 with retry-after | API throughput | Retry with backoff. Not a quota problem |
Run /usage when you are not sure. It shows plan usage bars, a 24-hour or 7-day breakdown, and an attribution list that assigns recent usage to skills, subagents, plugins, and individual MCP servers. It also flags behaviors that account for 10 percent or more of recent usage, such as long context or cache misses, which is usually where the answer is.
Questions people ask
There are two. The context window is how much conversation fits in one request: 200K or 1M tokens depending on model and plan. The usage quota is how much you can consume against a five-hour session window and a weekly cap on your plan. They are unrelated and have different fixes.
Anthropic does not publish a daily token number. Consumption is measured against a five-hour session window and a weekly limit that resets at a fixed time assigned to your account. How far those go depends on model, context size, and how many sessions you run at once.
As of August 2026, Sonnet 5 runs at 1M tokens on the Anthropic API with no 200K variant. Opus 5, 4.8, and 4.7 also run at 1M there, and drop to 200K on Bedrock, Google Cloud, and Microsoft Foundry. Opus 4.6 and Sonnet 4.6 are 200K by default with a 1M variant. Haiku 4.5 is 200K.
No. /clear frees the context window, which is per session and costs nothing. The usage quota is per account and only recovers when the window resets, or when you enable usage credits and pay at standard API rates.
No. The 1M window is billed at standard model pricing with no premium above 200K. It costs more in practice because a filled window is re-sent on every turn, so quota and, on an API key, the bill both grow faster.
Run /autocompact 500k to set the threshold for this and later sessions, pass --autocompact for one launch, or set CLAUDE_CODE_AUTO_COMPACT_WINDOW in scripts. Accepted values run from 100K to 1M, and /autocompact auto returns to the model default.
Compaction rewrites message history. Project-root CLAUDE.md and auto memory are re-injected from disk, but rules with paths: frontmatter and nested CLAUDE.md files are lost until a matching file is read again. Move anything that must persist into the project-root file.
Yes, as of August 2026. Usage credits let Pro, Max 5x, and Max 20x subscribers continue past the included allowance at standard API rates, with a monthly spend cap and optional auto-reload. Note that the prompt cache lifetime drops from one hour to five minutes while you are on credits.
Sources
Every figure above was read from these pages on August 2026. Vendors reprice without notice; if you find a stale number, tell us.