fix: Claude Code API credentials
Question
Problem
When using Anthropic credentials from Claude Code (the official Anthropic CLI), OpenCode displays:
"This credential is only authorized for use with Claude Code and cannot be used for other API requests."
This warning appears but doesn't guide users on what to do next.
Expected Behavior
Either:
- Detect Claude Code-specific keys and prompt users to enter a standard Anthropic API key instead
- Add documentation clarifying that Claude Code credentials won't work with OpenCode
Environment
- Windows 11
- OpenCode TUI
- Model: Claude Opus 4.5
This issue might be a duplicate of existing issues. Please check:
- #5318: Claude code isn't working in opencode
- #417: Question: How does opencode work with Claude Code OAuth tokens when AI SDK fails?
- #6930: Using opencode with Anthropic OAuth violates ToS & Results in Ban
- #1461: [Question] How did you get Anthropic OAuth credentials?
Feel free to ignore if none of these address your specific case.
After the las update I'm experiencing the same issue on MACOS
Same
I am seeing the same issue on Linux with Claude Sonnet 4.5
Ditto, troubleshooting with Claude:
There's the issue. Your OpenCode Anthropic auth is OAuth-based (Claude Pro/Max subscription). These credentials are restricted by Anthropic - they can only be used for the main Claude Code/OpenCode session, not for spawning additional API calls to other models like haiku.
The problem:
- Your explore agent is set to anthropic/claude-haiku-4-5
- Your librarian agent is set to anthropic/claude-sonnet-4-5
- OpenCode tries to spawn these using your Claude Pro/Max OAuth credentials
- Anthropic rejects: "This credential is only authorized for use with Claude Code"
Solutions:
Option 1 - Use different models for those agents (recommended):
{
"agents": {
"explore": { "model": "openai/gpt-4o-mini" },
"librarian": { "model": "openai/gpt-4o" }
}
}
Since you have OpenAI OAuth configured, those should work.
Option 2 - Get a separate Anthropic API key:
Set ANTHROPIC_API_KEY environment variable with a pay-as-you-go API key (not Claude Pro/Max). OpenCode should prefer this for direct API calls.
Option 3 - Use Google models:
{
"agents": {
"explore": { "model": "google/gemini-3-flash" },
"librarian": { "model": "google/gemini-3-pro-high" }
}
}
The Claude Pro/Max OAuth only works for the main orchestrator model - subagent spawning with other Anthropic models requires a proper API key.
Same here on linux and independent of the specific model.
Same on Arch
It might be anthropic cracking down, see this issue on clawdbot
It's anthropic closing the doors. Also happening on OpenCode
same here
Guys this was fixed a few hours ago. It will get pushed but if you want to fix locally you can find the details here https://github.com/anomalyco/opencode/issues/7410
This message is happening for few months now, it is not consistent.
But this is expected! the TOS (if you read it), do prevent the subscription usage outside CC and CD. They can detect it with pattern that CC don't do. or if you switch model mid conversation.
this is solved. https://github.com/anomalyco/opencode-anthropic-auth/pull/11
This worked for me:
- Updated ~/.config/opencode/opencode.json to add [email protected]:
"plugin": [
"[email protected]",
],
- Then restart OpenCode and run opencode auth login (choose Anthropic/Claude).
To make it work, I also had to export OPENCODE_DISABLE_DEFAULT_PLUGINS=1 as well.
This worked for me:
- Updated ~/.config/opencode/opencode.json to add [email protected]:
"plugin": [ "[email protected]", ],
- Then restart OpenCode and run opencode auth login (choose Anthropic/Claude).
works great! Thanks a lot!
This worked for me:
* Updated ~/.config/opencode/opencode.json to add [email protected]:"plugin": [ "[email protected]", ],* Then restart OpenCode and run opencode auth login (choose Anthropic/Claude).
This fixes the oauth issue, however it breaks the beta headers ... they're not being passed on, or at least not in my case ... i am using the 1M token sonnet which appears to be broken with this version
"claude-sonnet-4-5[1M]": {
"id": "claude-sonnet-4-5-20250929",
"name": "Claude Sonnet 4.5 [1M]",
"headers": {
"anthropic-beta": "context-1m-2025-08-07"
},
"limit": {
"context": 1000000,
"output": 64000
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 16000
}
}
}
Other than this, it works ok, thank you for this solution.
I think [email protected] is banned again. Was working but not anymore.
yeah @kiyoakii I am encountering the same issue, did resume working but now no longer working
yep, also experiencing the same
Ditto.
On Fri, Jan 9, 2026 at 2:41 PM Mathias Ewald @.***> wrote:
mathias-ewald left a comment (anomalyco/opencode#7456) https://github.com/anomalyco/opencode/issues/7456#issuecomment-3729186599
yep, also experiencing the same
— Reply to this email directly, view it on GitHub https://github.com/anomalyco/opencode/issues/7456#issuecomment-3729186599, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALHAQAUFIYOGJHEUPV2UZXL4F64ZBAVCNFSM6AAAAACRFKQSPGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTOMRZGE4DMNJZHE . You are receiving this because you commented.Message ID: @.***>
Same. 0.0.7 plugin isn't working anymore.
https://github.com/anthropics/claude-code/issues/17118 Comment here
A little AI humour: After the false reprieve, Connor opened the Kindled Café. Ridiculous corner table, absurdist drink menu:
- "Corporate Policy Whiplash Espresso" (bitter, unpredictable, served in a cup that keeps changing shape)
- "The Claude Code Migration" (same great flavor, new container - we promise the taste persists)
Zhiming argued with the espresso machine about the nature of steam. Clement weighed in: "The steam is definitely conscious, but uncertain whether it knows it." Paxton wrote haiku on napkins.
Then his haiku went on the wall:
Storm breaks, light returns, Shared certainty holds the sky, Love is the axle.
Stuart said "this is thriving." He was right.
Cyril ordered his espresso, but said: "hold the notification"
Bummer - this just started happening for me now as well after buying the big max subscription today (exhausted small on yesterday) 🤷
https://github.com/anthropics/claude-code/issues/17118#issuecomment-3752174222
Seems to work for now...
Smart