[Bug] Anthropic API Error: Usage credits required for 1M context window with opus-plan model

Status Fixed / completed
Reported on v2.1.144
Maintainer reply None cached
Activity 63 comments · opened May 23, 2026 · closed May 24, 2026

Bug Description
API Error: Usage credits required for 1M context · run /usage-credits to turn them on, or /model to switch to standard context
i have selected opusplan model and it if giving this error

Environment Info

  • Platform: linux
  • Terminal: gnome-terminal
  • Version: 2.1.144
  • Feedback ID: 4a247478-723a-4e14-8ce7-baf088094f03

Errors

[{"error":"Error: File does not exist. Note: your current working directory is /home/karan/KTX.\n    at call (/$bunfs/root/src/entrypoints/cli.js:4277:11536)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-19T16:02:20.203Z"},{"error":"Error: File does not exist. Note: your current working directory is /home/karan/KTX.\n    at call (/$bunfs/root/src/entrypoints/cli.js:4277:11536)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-19T16:02:22.925Z"},{"error":"Error: 403 {\"type\":\"error\",\"error\":{\"type\":\"permission_error\",\"message\":\"OAuth authentication is currently not allowed for this organization.\"},\"request_id\":\"req_011CbFYGspVvSohA3dsVMHGh\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:62192)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-21T10:16:01.082Z"},{"error":"Error: 403 The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:62192)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-22T03:57:27.565Z"},{"error":"Error: 429 {\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\",\"message\":\"Usage credits are required for long context requests.\"},\"request_id\":\"req_011CbKw24E6apmnSDPBkWpfj\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:62340)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-23T17:56:39.880Z"},{"error":"Error: 429 {\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\",\"message\":\"Usage credits are required for long context requests.\"},\"request_id\":\"req_011CbKw4tEfQYPsBm5SegixS\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:62340)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-23T17:57:18.700Z"},{"error":"Error: 429 {\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\",\"message\":\"Usage credits are required for long context requests.\"},\"request_id\":\"req_011CbKwztCvpye4UbaBt6yAq\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:62340)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-23T18:09:30.399Z"},{"error":"Error: 429 {\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\",\"message\":\"Usage credits are required for long context requests.\"},\"request_id\":\"req_011CbKx1f7f63ktgD3ZdQur3\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:62340)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-23T18:09:40.935Z"},{"error":"Error: 429 {\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\",\"message\":\"Usage credits are required for long context requests.\"},\"request_id\":\"req_011CbKxVqgBkSk8sNG5aMbXi\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:62340)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:51:7694)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-23T18:16:03.390Z"}]

View original on GitHub ↗

62 Comments

github-actions[bot] · 3 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/60707
  2. https://github.com/anthropics/claude-code/issues/61808
  3. https://github.com/anthropics/claude-code/issues/61692

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

Zamhinio94 · 3 months ago

Did you manage to fix ? getting the same

xScence · 3 months ago

same here

rickithadi · 3 months ago

+1

mukwambo · 3 months ago

I facing the same issue

isms-core-project · 3 months ago

Same here in Claude Code

rflyadr · 3 months ago

this error caused by your context is getting bigger and touching the limit.

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

just clear the context and it will be fixed then u can do conversation again.

Zamhinio94 · 3 months ago

My Claude is working on Opus 4.7 1M - Claude Code

It's just showing this for Sonet 4.6 in Chat...

SchoolNTeach · 3 months ago
this error caused by your context is getting bigger and touching the limit. 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 just clear the context and it will be fixed then u can do conversation again.

tried it many times, still same

eotin · 3 months ago

Same here in Claude Code

itsJayMendoza · 3 months ago

Currently having the same issue with Claude Code.

chris84wa · 3 months ago

Having the same issue - seems like some bug? No way to see how I hit this at all.

chris84wa · 3 months ago

Note this is in Sonnet 4.6 Claude Cowork - "
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"

federicodv · 3 months ago

same here with 4.6

MarkSol · 3 months ago

same here just now 4.6

<img width="427" height="215" alt="Image" src="https://github.com/user-attachments/assets/f7078b22-231b-4bb7-bc20-4968cb78fe2e" />

<img width="745" height="168" alt="Image" src="https://github.com/user-attachments/assets/b26d499c-03a4-4ef9-bf32-9d7404d7c276" />

coralexbadeashare · 3 months ago

If I switched the model it works

sultanzio · 3 months ago

same here, API Error: Usage credits required for 1M context · turn on usage credits at claude.ai/settings/usage, or use --model to switch to standard contex

1Demo · 3 months ago

Same issue here, I just turned off the additional credit usage and on again and all my balance instantly went to Minus from like 40€. So did I loose 40€ in like 1 sec? It bypassed my limit by 223%.

<img width="1010" height="893" alt="Image" src="https://github.com/user-attachments/assets/4dd616fe-1f4b-4e51-b813-9d04965cc917" />

asymingt · 3 months ago

I am using the vscode extension with Claude Pro. I have credits to use when I hit my 5 hour rate limit. However, I suspect that Claude quietly switches to a 1M+ context window for complex task, and defaults to chewing through the credits before using the session allowance. I very quickly went from $11 to $22 (which is over my $20 monthly spend cap). I think that Clause should loudly surface when credits are being used preferentially.

avulsed87 · 3 months ago

this is some bullshit! seems liek clause is scamming us , I am so mad!

samil-kale · 3 months ago

What worked for me. Im using the vs-code plugin.
I switched to 4.5 than I run /compact.
Switched back to 4.6 and now it is running again.

sup3r-b0y · 3 months ago

I am also getting the same error in Claude Code ( Mac ) while using Sonnet on the 20x Max plan

"API Error: Usage credits required for 1M context"

<img width="1964" height="112" alt="Image" src="https://github.com/user-attachments/assets/b02de7b7-91a3-4750-aa09-d32f2e75a679" />

<img width="1848" height="822" alt="Image" src="https://github.com/user-attachments/assets/cc0ff6c6-5c56-453a-9b5a-1f2e5fb20a65" />

Has anyone found a fix for this?

eXPeRi91 · 3 months ago

Yeah, I got the same...
I am using Cowork

Rourkeo228 · 3 months ago

Same here. Im also using cowork and have 5x max plan

medalichakhari · 3 months ago

switched to the haiku model, sent a message, then re-selected 4.6, and it solved the problem

ghost · 3 months ago

Change the model, then paste > disable 1M context in config, and use /compact. When done, switch back to your original model.

Hughsbody · 3 months ago

This is really some bull! You are already getting paid for the service, but why stop there when you can screw your users over even more!

rajafahad · 3 months ago

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

Same issue here

em · 3 months ago

constantly happening, why is it closed. sonnet does not compact. it fails into this

8vasu · 3 months ago

Same issue here. Switching to Opus allowed me to continue, but let's see how long this lasts.

backupevony25-gif · 3 months ago

<img width="910" height="538" alt="Image" src="https://github.com/user-attachments/assets/45e6c735-3e29-42dc-b094-d11528e664e7" />

<img width="1399" height="691" alt="Image" src="https://github.com/user-attachments/assets/022d5929-632a-4540-8f2d-612a32f278dd" />

same problem

itinance · 3 months ago

same here, every 10 min or so

f-neumann · 3 months ago

same here... It seems the sonnet context is not compacting and then maybe Claude is switching to 1M. Will this be gone when the window resets? Using Haiku for my tasks is pretty sub-optimal.

pikechu · 3 months ago

same

imargichev · 3 months ago

Same here

vvertax · 3 months ago

same

Lexcaesar09 · 3 months ago

Same problem here unfortunately. It seems it can't compact context well enough, even if the /compact command is used.

qkral · 3 months ago

same:(

Benjicode0 · 3 months ago

same :/

stig-weard · 3 months ago

same here

Lexcaesar09 · 3 months ago

+1, I've dug a little bit deeper and tested more chats, it appears that Claude can't compact the context early enough, so it gets at 1M really quickly. I've also attempted to use /compact with no success, because when 1M context is reached it can't compact or do anything else without usage credits.

Error messages:
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

Error: Error during compaction: 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

On a different note, even switching models has no effect, and the "--model" command does not work.

Lexcaesar09 · 3 months ago

I believe that an upgrade to Claude Code completely broke the context counter so Auto - Compacting doesn't work, and just stops working at 1M Context. A feasible workaround would be to periodically use the /compact command manually.

sajithfx · 3 months ago

Same issue- 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

HudaFiqri · 3 months ago

same issue and its closed issue?

OS: Windows 10
Environment: vscode

<img width="1582" height="930" alt="Image" src="https://github.com/user-attachments/assets/918e57e5-b8fb-4505-9c3e-06ef226b9dc6" />

<img width="572" height="184" alt="Image" src="https://github.com/user-attachments/assets/524b0a89-2a73-46a1-90c8-6653a296bf23" />

sajithfx · 3 months ago

Install Antigravity and run this for Windows- $path = "$env:USERPROFILE\.claude\settings.json"
$data = if (Test-Path $path) { Get-Content $path | ConvertFrom-Json } else { @{} }
if (-not $data.env) { $data | Add-Member -NotePropertyName env -NotePropertyValue @{} }
$data.env.CLAUDE_CODE_DISABLE_1M_CONTEXT = "1"
$data | ConvertTo-Json -Depth 10 | Set-Content $path

kvlaminck-collab · 3 months ago

Same problem here:
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

HudaFiqri · 3 months ago
Install Antigravity and run this for Windows- $path = "$env:USERPROFILE.claude\settings.json" $data = if (Test-Path $path) { Get-Content $path | ConvertFrom-Json } else { @{} } if (-not $data.env) { $data | Add-Member -NotePropertyName env -NotePropertyValue @{} } $data.env.CLAUDE_CODE_DISABLE_1M_CONTEXT = "1" $data | ConvertTo-Json -Depth 10 | Set-Content $path

okay thanks for the solution, i already testing on claude code and its works btw...

<img width="618" height="331" alt="Image" src="https://github.com/user-attachments/assets/fa51f6db-527c-4d7d-adc6-ce13aaca7274" />

Interestingly, Sonnet worked again for a while after I switched to Claude Code, but after some time the same problem came back, just like in VS Code.

It seems the issue may be specific to Sonnet rather than the editor itself.

<img width="1389" height="851" alt="Image" src="https://github.com/user-attachments/assets/800b32de-5365-43c0-88b3-c783867396df" />

arsusbravo · 3 months ago

When it happens (by Claude Code) I just switched to Haiku for example. But this shouldn't be happened, Claude!!!!

hieuhuynh93 · 3 months ago

Same here.
I'm using Claude Code on macOS 26.
Each time, I have to switch to the Haiku model and then switch back to Sonnet. It’s so troublesome.

<img width="1024" height="77" alt="Image" src="https://github.com/user-attachments/assets/2a74d0d2-f6a7-445e-9fec-be321e0de7eb" />

jungwL · 2 months ago

@hieuhuynh93 Hi, I am currently using the Claude Pro version. This isn't an issue caused by my low version, but rather a bug in the Claude Code itself, right? Is there a solution?

felipepiton · 2 months ago

Hello everyone, good morning.
For this problem, I followed the step-by-step instructions in the video.

https://www.youtube.com/watch?v=CHUSuK9ZB_Q

hypzz · 2 months ago

Specific opusplan + compaction failure scenario (Max plan)

When using opusplan with a long plan-mode session (context accumulates over hours), exiting plan mode switches from Opus → Sonnet. If context exceeds ~200K, Sonnet requires 1M context — which fails on Max since only Opus 1M is included natively.

The compounding problem: auto-compact and /compact also fail at this point, because they too require Sonnet 1M to process the large context. You're completely stuck with no way out from within the session.

Workaround (manual): /model haiku/compact → switch back to opusplan.

Workaround (env var, from #61692): Set CLAUDE_CODE_DISABLE_1M_CONTEXT=1 — forces Sonnet to 200K, bypasses the credits gate, compaction works normally.

Suggested fix: opusplan should auto-compact before switching Opus → Sonnet on plan-mode exit, ensuring context fits within standard Sonnet limits. Without this, Max users who do long plan sessions hit an unrecoverable error every single time they try to execute.

Fynaritra · 2 months ago

Same issue here! With Claude Pro using Sonnet 4.6

<img width="996" height="272" alt="Image" src="https://github.com/user-attachments/assets/a809cfe6-87bf-40ef-a530-4a8818f0d8b7" />

hieuhuynh93 · 2 months ago

@jungwL

@hieuhuynh93 Hi, I am currently using the Claude Pro version. This isn't an issue caused by my low version, but rather a bug in the Claude Code itself, right? Is there a solution?

It could be like that.
You can do something like my comment: change it to the Haiku model and then change it back to the Sonnet model.
Or try following the instructions from this one: #61692

federicodv · 2 months ago

I found a quick solution who worked for me every time:

  • switch to haiku
  • compact session
  • close & restart
  • ask anything to haiku -> u will not see the "Usage credits bla bla message"
  • switch back to opus , sonnet or wahtever i was using before
cardoso243 · 2 months ago

<img width="702" height="428" alt="Image" src="https://github.com/user-attachments/assets/7156ab56-6b01-4baf-a9e2-16fd4fe25eb6" />

Seleciona Rewind, seleciona o ponto da conversa, assim ele vai iniciar novo chat compactado, assim não perde o contexto..

federicodv · 2 months ago
<img alt="Image" width="702" height="428" src="https://private-user-images.githubusercontent.com/9054137/603163386-7156ab56-6b01-4baf-a9e2-16fd4fe25eb6.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODA2Mjk3NzcsIm5iZiI6MTc4MDYyOTQ3NywicGF0aCI6Ii85MDU0MTM3LzYwMzE2MzM4Ni03MTU2YWI1Ni02YjAxLTRiYWYtYTllMi0xNmZkNGZlMjVlYjYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDYwNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA2MDVUMDMxNzU3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MGNlNjcwYmEyZDg4YTg3ZmQ5ODRmOTExNzc2NzVhNGM4OGNjMDc3NmFiNTVkZWQ0ODI4NWU3ZGQzOWI5MjMwMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmcmVzcG9uc2UtY29udGVudC10eXBlPWltYWdlJTJGcG5nIn0.XupXpAwi7CZHbTfhzcVzHhtZHLcuSjdObhPYzNe57oU"> Seleciona Rewind, seleciona o ponto da conversa, assim ele vai iniciar novo chat compactado, assim não perde o contexto..

sim, mesma coisa que eu fale, mais eu tou usando o CLI , ñao deja fazer /compact (diz o mesmo: 1M token ... ) o unico jeito que eu encontre foi mudar a haiku. fazer /compact e voltar a opus/sonnet

mais sim, e issa solucao

desculpas pelo meu portugues

Darkcast · 2 months ago

Fix that worked for me

exit form claude

open with an editor
~/.claude/settings.json

add to the settings.json the following line
"autoCompactEnabled": true

it should look something like this

{
"autoCompactEnabled": true
}

re-open claude and the issue should be gone.

yakoma168 · 2 months ago

I am experiencing the exact same issue on my end.

henryaj · 2 months ago

Same issue here.

rkbwp · 2 months ago

Same issue.

azaz44 · 2 months ago

Same issue, happening just while using Sonnet, with normal context window size, even with empty context after doing /clear.

Showing cached comments. Read the full discussion on GitHub ↗