Standalone OpenCode plugin that recreates the pre-PR #18186 Anthropic login/runtime behavior as closely as possible.
Community plugin. Not built by the OpenCode team and not affiliated with them.
opencode auth login anthropicvia plugin authClaude Pro/MaxOAuth loginCreate an API KeyOAuth flow through Anthropic Console- manual Anthropic API key login
- Anthropic OAuth token exchange + refresh
- request header rewriting and beta header merging
?beta=trueon/v1/messages- Claude Code system prompt prefixing
- OpenCode → Claude prompt sanitization
- tool name prefix/remap behavior (
mcp_*)
- GitHub: https://github.com/DusKing1/opencode-anthropic-auth
- Package name:
@dusking1/opencode-anthropic-auth
Add the package to your OpenCode config:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@dusking1/opencode-anthropic-auth"]
}Then run:
opencode auth login anthropicLegacy
opencode-anthropic-authon npm is the deprecated original package, not this repo.
Build this repo:
npm install
npm run buildPoint OpenCode at the built entry file:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["file:///D:/GitHub/opencode-anthropic-auth/dist/index.js"]
}Then run:
opencode auth login anthropicnpm install
npm run typecheck
npm run buildEnterprise users may not be able to use Anthropic's OAuth-backed create_api_key endpoint.
If that flow fails, generate an Anthropic API key manually in Console and use Manually enter API Key (Enterprise recommended) instead.
If Console OAuth Create an API Key is unstable for your workspace, a practical workaround is:
- use real Claude Code / Console on an account that can successfully create a key,
- obtain a working Anthropic API key for the target workspace,
- choose
Manually enter API Key (Enterprise recommended)in OpenCode, - keep using this plugin so requests are still rewritten to match Claude Code-style Anthropic behavior.
This workaround bypasses the flaky OAuth create-key exchange while preserving the plugin's request/runtime compatibility layer.
The recovered 0.0.13 published package is kept in this repo under reference/0.0.13/ for comparison and rescue work.
It is reference-only and is not used by the current build/runtime.