OpenCode Claude Pro/Max Plugin — Plan & Documentation
This repository contains documentation and implementation notes for restoring Anthropic Claude Pro/Max subscription support in OpenCode via its plugin system.
This repository does NOT contain the plugin source code. It contains the plan, instructions, and notes needed for you (or an AI assistant) to build the plugin yourself.
Background
On March 19, 2026, OpenCode merged PR #18186 — "Remove anthropic references per legal requests." The PR was submitted by the OpenCode maintainers after receiving a legal request from Anthropic. It removed:
- The bundled
opencode-anthropic-authplugin (OAuth flow against claude.ai) - Claude Code beta headers and User-Agent logic
- The Claude Code system prompt (
anthropic-20250930.txt) - Provider hints and documentation for Claude Pro/Max login
The PR received 511 thumbs-down reactions and significant community discussion. OpenCode's documentation now includes this note:
"Using your Claude Pro/Max subscription in OpenCode is not officially supported by Anthropic."
Legal Disclaimer
Use at your own risk.
Anthropic's Consumer Terms of Service Section 3.7 states:
"Except when you are accessing our Services via an Anthropic API Key or where we otherwise explicitly permit it, to access the Services through automated or non-human means, whether through a bot, script, or otherwise."
Using OAuth tokens obtained through a Claude Pro/Max subscription in a third-party tool like OpenCode — rather than through claude.ai directly or via an Anthropic API key — may violate this clause. Anthropic has not publicly clarified whether plugin-based access through subscription OAuth tokens constitutes a violation, but the legal request that led to PR #18186 strongly suggests they consider it unauthorized.
By using any plugin or tool built from these instructions, you accept:
- You may be violating Anthropic's Terms of Service
- Your account could be suspended or terminated
- This project is not affiliated with, endorsed by, or supported by Anthropic
- No warranty is provided; the authors assume no liability
What's in This Repository
| File | Description |
|---|---|
IMPLEMENTATION_PLAN.md |
Full implementation plan with 28 annotated notes covering OAuth flow, header constants, CLI keychain integration, response streaming, and every pitfall discovered during development |
INSTRUCTION.md |
Step-by-step user-facing guide: install prerequisites, create the plugin, configure OpenCode, authenticate (CLI sync recommended), and troubleshoot common issues |
PROMPT.md |
Minimal prompt you feed to an AI agent — tells it what to build and points it at the plan |
README.md |
This file |
How to Build the Plugin
You don't need to write the plugin by hand. The plan document
(IMPLEMENTATION_PLAN.md) is detailed enough that OpenCode itself — or
Claude Code, or any capable AI coding assistant — can generate a working
plugin from it.
Recommended approach
- Clone this repo (or download the files)
- Open OpenCode (or Claude Code) in the repo directory
- Use
PROMPT.mdas your prompt — it tells the agent what to build and points it at the plan. You can just paste its contents or reference it directly (e.g. in OpenCode:@PROMPT.md implement the plugin) - Deploy the generated file to
~/.config/opencode/plugins/opencode-anthropic-auth.ts - Follow
INSTRUCTION.mdfor configuration and authentication
The plan covers all the non-obvious details: why curl must be used instead
of fetch() for token exchange, why the CLI sync method uses method: "auto"
not method: "code", which headers are required, how billing is injected as a
system message, how tool names need mcp_ prefixing/unprefixing, and more.
Reference Implementations
These community projects were analyzed during development:
- opencode-anthropic-auth-community — active community fork
- opencode-anthropic-auth — archived original
- opencode-claude-bridge — most mature alternative (curl-based OAuth, CLI keychain sync, full headers)
Recommended Authentication Method
Sync from Claude CLI is the recommended approach. It avoids all OAuth endpoint fragility (URL changes, User-Agent requirements, 429 rate limits, scope changes). Install the Claude Code CLI, log in once, and the plugin reads your tokens automatically:
npm install -g @anthropic-ai/claude-code claude login
Then in OpenCode, choose Anthropic (API key) > Sync from Claude CLI.
License
This repository is dedicated to the public domain under the CC0 1.0 Universal license. You can copy, modify, distribute, and use the documentation for any purpose without asking permission.