ianjwhite99/opencode-with-claude
OpenCode plugin to use your Claude Max/Pro subscription with OpenCode via Meridian
opencode-with-claude – A plugin that bundles the Claude‑Max proxy for OpenCode
What it does
- Provides an OpenCode plugin that automatically starts and stops the Meridian proxy (a local server that talks to Anthropic’s Claude Max via the Claude Agent SDK).
- The proxy is launched when you start OpenCode and shut down when you quit, so you only have one process to manage.
- Supports both OpenCode 1.x (the original CLI) and OpenCode 2 (
@opencode/cli) from the same npm package. - Handles session‑tracking headers and lets multiple OpenCode windows run side‑by‑side, each getting its own free port if the default 3456 is taken.
How to use it
- Install globally with npm or Homebrew.
- Install the Claude Agent SDK (
@anthropic-ai/claude-code) and log in once (claude auth login). - Add the plugin name (or a file URL when using Homebrew) to your
opencode.json(different key names for the two OpenCode generations). - Run
opencode; the plugin starts the proxy, rewrites the Anthropic provider’sbaseURLto point at the local server, and forwards requests.
Key features
- Lifecycle management – OpenCode owns the proxy, eliminating the need for a separate CLI or Docker container.
- Multi‑instance support – each OpenCode process gets its own proxy port.
- Profile handling – reads Meridian’s
profiles.jsonandsettings.jsonso you can switch between personal, work, or token‑based Claude accounts. - Runtime configuration – you can point the plugin at a newer Meridian build via the
MERIDIAN_PATHenv‑var without waiting for a new plugin release. - Session headers – the plugin adds explicit
x‑meridian‑profileand other identity headers, keeping OpenCode’s hidden title/summary requests out of the session lease.
Installation & updates
- npm:
npm install -g opencode-with-claudeandnpm update -g opencode-with-claude. - Homebrew:
brew install ianjwhite99/tap/opencode-with-claudeandbrew upgrade opencode-with-claude(the formula is auto‑bumped after each npm publish).
Troubleshooting tips
- Ensure the Claude CLI is installed (
npm install -g @anthropic-ai/claude-code). - Run
claude auth loginto create a valid session. - If the proxy won’t start, check authentication status, internet connectivity, and that the chosen port isn’t already in use.
- You can expose the proxy beyond localhost by setting
CLAUDE_PROXY_HOST(use with caution).
Development notes
- Written in TypeScript; the
src/folder contains the plugin entry point, proxy lifecycle code, and helpers for reading Meridian config. - Unit tests live in
test/unit/; a scripttest/run.shlaunches OpenCode 1.x with the built plugin for manual testing. - The plugin exports a single object with
id,server()(for OpenCode 1) andsetup()(for OpenCode 2).
License – MIT.
Bottom line – If you use OpenCode and have a Claude Max subscription, this plugin gives you a seamless, single‑process way to route OpenCode’s Anthropic‑style requests through the official Claude Agent SDK, with profile management and easy updates.
Related
- Project
- Project
- Project
- Project
- Project