Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

opencode-anthropic-auth

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.

What it restores

  • opencode auth login anthropic via plugin auth
  • Claude Pro/Max OAuth login
  • Create an API Key OAuth flow through Anthropic Console
  • manual Anthropic API key login
  • Anthropic OAuth token exchange + refresh
  • request header rewriting and beta header merging
  • ?beta=true on /v1/messages
  • Claude Code system prompt prefixing
  • OpenCode → Claude prompt sanitization
  • tool name prefix/remap behavior (mcp_*)

Repository

Install

Published package

Add the package to your OpenCode config:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["@dusking1/opencode-anthropic-auth"]
}

Then run:

opencode auth login anthropic

Legacy opencode-anthropic-auth on npm is the deprecated original package, not this repo.

Local checkout

Build this repo:

npm install
npm run build

Point 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 anthropic

Develop

npm install
npm run typecheck
npm run build

Enterprise note

Enterprise 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.

Practical workaround

If Console OAuth Create an API Key is unstable for your workspace, a practical workaround is:

  1. use real Claude Code / Console on an account that can successfully create a key,
  2. obtain a working Anthropic API key for the target workspace,
  3. choose Manually enter API Key (Enterprise recommended) in OpenCode,
  4. 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.

Reference material

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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages