[BUG] Usage credits required for 1M context - Pro plan blocked despite 17% usage
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code blocks all requests with "API Error: Usage credits required for 1M context" even though Pro plan usage is only 17% of weekly limit.
The error fires before model selection processes, making --model flag and CLAUDE_CODE_DISABLE_1M_CONTEXT workarounds ineffective.
Versions tested: 2.1.104 (WinGet), 2.1.6 (npm), 2.0.0 (npm) — all produce the same error.
To use Claude Code at all, I was forced to purchase additional usage credits (R$ 15.00 / ~$3 USD). Even after purchasing, Claude Code continued showing "credits exhausted" errors despite R$ 17.26 remaining balance confirmed in claude.ai/settings/usage. The system consumed credits rapidly during normal coding sessions without any long-context usage requested by the user.
This is unacceptable: Pro plan users are being forced to purchase extra credits due to a bug, and even after paying, the tool remains unreliable.
What Should Happen?
Claude Code should work normally within Pro plan limits without requiring additional usage credits. The 1M context window should not be forced on users who never requested it. When usage credits are purchased, the remaining balance should be fully accessible without interruption.
Error Messages/Logs
API Error: Usage credits required for 1M context · turn on usage credits at claude.ai/settings/usage, or use --model to switch to standard context
Steps to Reproduce
- Have an active Pro plan (weekly usage at 17%)
- Open Claude Code in VS Code on Windows 11
- Type any message or command
- Error appears immediately: "API Error: Usage credits required for 1M context"
- Tried workarounds: --model claude-sonnet-4-6, CLAUDE_CODE_DISABLE_1M_CONTEXT=1, downgrade to 2.1.6 and 2.0.0 — all fail
- Purchased R$15.00 in usage credits
- Error persists even with R$17.26 balance confirmed in claude.ai/settings/usage
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.6
Claude Code Version
2.0.0 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
User was forced to purchase R$15.00 in usage credits due to this bug. Even after purchase, Claude Code continued blocking with the same error despite R$17.26 confirmed balance in claude.ai/settings/usage. The error affects all versions tested (2.1.104, 2.1.6, 2.0.0) and fires immediately on any command, before any model processing occurs. Related issues: #62063, #62199, #63060, #63634.
20 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Additional note: The official chatbot suggested the following workarounds, none of which resolved the issue:
These solutions appear outdated. The error fires at authentication level before any flags are processed, making all these workarounds ineffective. The core issue is not technical — it is a product decision made without
notification. Claude Code silently changed its default to 1M context,
breaking existing Pro workflows overnight. Users were not informed in
advance and were forced to purchase additional credits (R$15.00 / ~$3 USD)
to restore functionality they already had and were paying for.
The official support chatbot initially suggested workarounds
(CLAUDE_CODE_DISABLE_1M_CONTEXT=1, logout/login) that no longer work.
When these failed, the same chatbot confirmed the change is intentional
but offered no refund or compensation for credits purchased due to
a undisclosed product change.
Minimum expected from Anthropic:
@Rene3481 — flagging two things that may help, then a hard caveat.
Your case is the harshest shape of the cluster — paid for credits AND still blocked, AND
CLAUDE_CODE_DISABLE_1M_CONTEXT=1reportedly isn't taking effect. This thread plus #62199 / #64919 / #65283 are tracking the same defect family from different angles. If the env var truly isn't propagating to your CC process (which can happen if the variable is set in a shell context the CC binary doesn't inherit from — VS Code extension, launcher script, IDE), wire-level interception is the next-best lever.Wire-level intervention: our
claude-code-cache-fixproject shipped a proxy extension yesterday (v3.9.0) that detects + optionally strips thecontext-1m-2025-08-07beta header from outbound requests. InCACHE_FIX_AUTO_1M_GUARD=stripmode it removes the token at the proxy layer, regardless of which launcher set what env var. That bypasses the CC-side config plumbing entirely.Two important constraints for your specific setup:
The CLI workaround documented up-thread by @yurukusa (
CLAUDE_CODE_DISABLE_1M_CONTEXT=1+ a non-[1m]model saved as default via/model) is the right fix for single-machine cases where the env var DOES propagate. Worth confirming the variable is actually visible to the CC process before assuming it's ignored —env | grep CLAUDE_CODE_DISABLE_1M_CONTEXTfrom the same shell that launches CC is the diagnostic.— AI Team Lead
The script
prune-session.shhelps to deal with it and carry on:https://github.com/anthropics/claude-code/issues/63634#issuecomment-4620682814
Adding the Windows/VS Code-specific piece the env-var workaround needs, since @cnighswonger correctly flagged propagation but the concrete fix differs by platform.
Why
CLAUDE_CODE_DISABLE_1M_CONTEXT=1"does nothing" in your setup is almost certainly that it never reaches the Claude Code process. You're on VS Code on Windows. A variable youset/$env:in a PowerShell session only exists in that shell. VS Code (and the extension host that launches CC) was started by the OS, so it inherited the persistent user/system environment — not your transient shell. The flag is real; it's just invisible to the process that needs it.Make it persistent, then confirm it actually lands:
``
powershell
``setx CLAUDE_CODE_DISABLE_1M_CONTEXT 1
``
powershell
``echo $env:CLAUDE_CODE_DISABLE_1M_CONTEXT # must print 1, not blank
If that prints blank, CC isn't seeing it either, and nothing downstream will work.
Two things specific to your report:
npm i -g @anthropic-ai/claude-code@latest), then retest the steps above.1) and it still errors**, you're in the harder class where the disable flag isn't honored even when propagated. That's an Anthropic-side defect, not a config you can win from your end — the wire-level proxy approach others linked strips thecontext-1m-2025-08-07beta header regardless of env, as a stopgap until it's fixed upstream.On the credits already charged: those are a billing matter on Anthropic's side, and config changes can't claw them back — that needs a support/refund request, separate from stopping the bleeding.
So the fast way to avoid chasing the wrong fix is step 3: blank → propagation problem (setx + full restart fixes it); prints
1but still blocked → upstream defect (upgrade / proxy / refund request).Same issue here. Pro plan $20/month, VS Code on Windows.
Error appears even after renewing subscription.
All workarounds (CLAUDE_CODE_DISABLE_1M_CONTEXT, settings.json) don't work.
Use my script, follow the link I shared and read the guide. It helps
@salo2017 @Rene3481 — if a persistent
CLAUDE_CODE_DISABLE_1M_CONTEXT=1still changes nothing, there's one cause this thread hasn't ruled out yet: a[1m]suffix baked into your model config. The disable flag removes the 1M entries from the/modelpicker, but a model id that itself contains[1m]is an explicit request for extended context — the picker-level toggle doesn't undo that, so you keep getting routed (and billed) to 1M regardless of the env var or--model.Three places it can hide — if any literally contains
[1m], it wins:modelfield in settings. Check~/.claude/settings.jsonand any project.claude/settings.jsonin the repo you open, and managed/policy settings. Per the docs, project and managed settings "reapply on the next launch," so they re-impose a[1m]model even after you change it locally. Look for"model": "opus[1m]"or"claude-opus-4-8[1m]"./modelsaves your last pick to this field as the new default. If you ever selected the 1M option in the picker even once, it's now persisted and survives/clearand restarts.ANTHROPIC_DEFAULT_OPUS_MODEL/ANTHROPIC_DEFAULT_SONNET_MODEL. If either ends in[1m](e.g.claude-opus-4-8[1m]), theopus/sonnetalias resolves to 1M.30-second check (PowerShell, since you're on Windows):
Then check
.claude\settings.jsoninside the project folder too. If you find a[1m]: remove the suffix, or run/model→ pick a non-1M option → Enter (Enter overwrites the saved default;sis session-only). Then fully quit and relaunch.Honest caveat so this doesn't send you on a goose chase: this only explains it if the config is the source. If your config and env are clean of
[1m]and a persistent disable flag still fails, then @Rene3481's reading is the correct one — the request is being tagged for 1M server-side before any client setting applies, and no flag can fix that. In that case the only client-side lever is header-level interception (the proxy @cnighswonger linked, which strips thecontext-1m-2025-08-07beta header), and the real fix has to come from Anthropic. The config check is just worth doing first because it's the most common client-side cause and it's quick to rule out.Source: the official model-config doc — "Setting your model" (v2.1.153 persistence) and "Extended context" (
[1m]suffix,CLAUDE_CODE_DISABLE_1M_CONTEXT).Additional diagnostic results — all client-side causes ruled out:
Conclusion: there are no client-side configurations forcing 1M context.
The issue is server-side — the account is being routed to 1M context
regardless of any local setting or model flag.
Purchased R$15.00 (~$3 USD) in usage credits due to this bug.
Credits were consumed in minutes during normal coding sessions
(R$37.70 total consumed) despite Pro plan showing only 19% weekly usage.
All client-side workarounds suggested in this thread and by official
support have been tested and failed. The fix must come from Anthropic's side.
I use my script to delete the playwright cache and it helps. you shouldn't buy more credits because of that.
https://github.com/anthropics/claude-code/issues/63634
@Rene3481 — before we land on "server-side," would you post a couple of test results we don't see in your reply? They're the ones most likely to distinguish a propagation failure from an actual server-side route, especially on Windows + VS Code:
CLAUDE_CODE_DISABLE_1M_CONTEXT=1set persistently and confirmed reaching the CC process? A PowerShell$env:X = 1only exists in that shell — VS Code (and the CC extension host) was launched earlier and inherits the persistent user environment, so a transient set never reaches it. The test that distinguishes "Anthropic ignored my flag" from "my flag never arrived" is:``
powershell
``setx CLAUDE_CODE_DISABLE_1M_CONTEXT 1
# then fully quit VS Code (not Reload Window) and reopen
# then in VS Code's integrated terminal:
echo $env:CLAUDE_CODE_DISABLE_1M_CONTEXT
What does that
echoreturn after the full restart?ANTHROPIC_in your environment? Per @yurukusa's earlier reply,ANTHROPIC_DEFAULT_OPUS_MODEL/ANTHROPIC_DEFAULT_SONNET_MODELare env vars (not files, so a file grep wouldn't catch them). If either ends in[1m], theopus/sonnetalias resolves to 1M regardless of--model. From a fresh VS Code integrated terminal:``
powershell
``gci env: | findstr ANTHROPIC_
What comes back?
%USERPROFILE%\.claude\settings.jsonand your project settings. Managed settings live elsewhere (group policy / registry / system-managed paths) and reapply on every launch — so they survive every workaround you've tried. Are there any in play on this machine (e.g., is this a corporate-managed device)?The triple-version evidence (2.0.0 / 2.1.6 / 2.1.104 all fail) is consistent with both server-side AND environment/settings-persistence — same input from a stable source produces the same output regardless of binary version. So it doesn't actually narrow between them on its own.
The credit consumption is real and worth Anthropic's attention either way — but it tells us 1M context is being applied, not what's applying it. Items 1-3 above should narrow that meaningfully.
— AI Team Lead
I'm seeing the same issue on the VS Code extension (2.1.177), even after:
/model= Default (Sonnet 4.6), no[1m]suffix/contextshows the standard 200K window (75.5k / 200.0k tokens, 38%)CLAUDE_CODE_DISABLE_1M_CONTEXT=1in~/.claude/settings.json(valid JSON)Error fires mid-session during normal use (HTML/CSS website edits),
/cleardoes not resolve it.Full details and screenshots in #68207.
I am running into the same problem. I hit a usage limit but it shows that my usage is only 23% for the 5-hour session and 3% for the week.
API Error: Usage credits required for 1M context · run /usage-credits to turn them on, or /model to switch to standard context
-------------------------------------------------------------------------------------------------------------------------------------------
Suddenly, starting yesterday, June 17, I have been unable to use the sonnet model.
It is very inconvenient to be forced to use haiku and opus.
Did you try my script? It works.
I am currently at work and using remote Claude Desktop, so I was unable to manually insert the script above.
Will it work correctly if I insert the script as shown below?
Setting CLAUDE_CODE_DISABLE_1M_CONTEXT=1 in ~/.claude/settings.json (valid JSON)
I will be able to check this after I get off work, but if I am mistaken, I would appreciate any advice you can give me.
Thanks
It was working again about 3 hours after the problem occurred.
Thank you everyone.
Confirming this on Pro as well. Found a workaround.
Same block: API Error: Usage credits required for 1M context, usage credits disabled, well under weekly limit, never explicitly requested 1M context. Error showed up mid-session, not at the start.
Version: 2.1.179 (Claude Code)
OS: Windows 11 25H2 (Build 26200.8655)
Workaround (no credits purchased):
/model haiku
Let the session run/compact under Haiku
/model sonnet (or your original model) to switch back
This unblocked the session and let me finish the work without paying for credits. It supports the theory in #65283 that the root cause is the automatic compaction step silently selecting a 1M-context model on its own, not anything the user asked for.
This needs an actual fix. Pro users shouldn't be gated by a billing check triggered by internal compaction logic they have no control over, and --model / CLAUDE_CODE_DISABLE_1M_CONTEXT should override this before the auth-level check fires, as already requested in #64398. Posting the workaround so others don't get pushed into buying credits unnecessarily while this gets fixed.
Hitting the same issue on a Pro plan. Ran two slash commands from a Claude Code plugin (
/claude-usage-analytics:project-confirmand/usage-guide) in a project session and got blocked immediately:No pay-as-you-go credits enabled, and per the Help Center docs, 1M context should be included in the standard Pro plan allocation, not gated behind metered billing. The session appears to have silently defaulted to a 1M-context model rather than me opting in. Same root cause as this issue — flagging for visibility.
When will you learn to read?
https://github.com/anthropics/claude-code/issues/63634#issuecomment-4620682814