Repository navigation
Description
On AI assistance: Claude (Opus 5.5 / 1M context) helped me narrow down the behavior and draft the wording below, including the repro steps. The actual issue and workflow are mine. — @balaji-dutt
Is OpenCode v2 support on the roadmap? I'm asking now because v2 is starting to reach users through the main install paths:
- The opencode.ai homepage and download page install v2 (
opencode.ai/v2/install,@opencode/cli,anomalyco/tap/opencode-v2). - Homebrew core's
opencodeformula moved to v2 on 2026-09-28 (Homebrew/homebrew-core@480c4e864d), sobrew upgrade opencodereplaces 1.x with 2.x unless the formula is pinned.
v1 is still published (opencode-ai on npm, opencode.ai/install, anomalyco/tap/opencode), and the README lists "OpenCode v1.2+".
What breaks on v2
From the v2 migration guide and the plugin migration guide:
- "V1 plugin implementations do not run in V2." The v2 loader (
packages/core/src/plugin/module.tsat v2.0.22) only accepts a default export of{ id, setup }or{ id, effect }. The{ id, server }export from Preserve MCP tools for Claude requests #19 fails with "Plugin must export a default definition with an id and an effect or setup function." - The bridge's core mechanism,
auth.loaderreturning a customfetchfor theanthropicprovider, has no v2 equivalent.
What v2 offers instead
From the guide's hook table and the v2.0.22 plugin types:
ctx.session.hook("http.request" | "http.response", ..., { providerID: "anthropic" })passes a mutable webRequest/Response(packages/plugin/src/promise/session.ts, wired inpackages/core/src/session/model-request.ts). That looks like it could cover the header and body rewrite and the SSE handling.ctx.integrationOAuth method registration and credential resolution (packages/plugin/src/promise/integration.ts) for theauth.methodsside.ctx.session.hook("context", ...)in place ofexperimental.chat.system.transform.- The guide's dual-export shape (
...Plugin.define({ id, setup })plusserver) lets one package serve v1 and v2.
So a port looks possible, but as a rewrite rather than a rename. Everything above comes from the v2 docs and the v2.0.22 source, not from running the bridge on v2. Open questions: whether http.request sees all Anthropic traffic (it fires for session model requests), and whether v2's built-in anthropic provider accepts the rewritten OAuth request.
Questions
- Do you plan to support v2? If so, as a dual v1/v2 package or as a separate major version?
- Until then, would you note in the README that the bridge requires OpenCode 1.x?
Activity
Migrate opencode to v2
marc-EnergyEssentials commentedon Nov 12, 2026
the fork from @negz worked OK for me
dotCipher commentedon Nov 19, 2026
OpenCode v2 support is now live in
v1.11.0(merged via #37, initiated by @TomasRichtr and hardened/verified against OpenCodev2.3.2).What shipped
1.11.0): exports{ id, setup, server }so OpenCode ≥ 2.0 loadssetup()while OpenCode 1.18.29 – 1.x continues usingserver().claude logintokens are persisted automatically on startup so Anthropic models appear immediately without/connect. ExistingANTHROPIC_API_KEYenv vars or stored API keys are never overridden.anthropicOAuth method (mode: "auto"+ remote redirect-URL paste with CSRFstateverification + persisted layered refresh) and provider-scopedhttp.request/http.response/ system-prompt hooks.feat: opencode v2 plugin support (setup) alongside v1 server()