A Go gateway that makes OpenCode Zen speak fluent OpenAI and Anthropic
opencode2api fronts OpenCode Zen and Zen Go with Chat Completions, Responses, and Anthropic Messages endpoints, plus key pools, proxy rotation, and a built-in WebUI.
What it does It’s a single Go binary that sits between your OpenAI- or Anthropic-shaped clients and OpenCode Zen / Zen Go upstreams. It translates between three protocols — Chat Completions, Responses, and Anthropic Messages — handling text, images, reasoning, and tool calls in both JSON and SSE. It also manages upstream keys and proxies, with separate pools for Zen and Go tiers, retries, and session affinity. The WebUI ships inside the executable; no Node.js or database needed.
The interesting bit
Cross-protocol translation goes through a common representation, and the README is refreshingly honest about what that costs: Chat JSON output constraints and seed don’t survive the trip to Anthropic Messages. Meanwhile, requests already in the upstream’s native protocol are relayed verbatim rather than mangled through translation — a sensible split. There’s also a System One endpoint for structured state-plus-questions payloads, relayed as-is.
Key highlights
- Anonymous Zen access via the OpenCode
publiccredential, with automatic fallback to authenticated tiers when it fails - Direct, HTTP, HTTPS, SOCKS5, and SOCKS5H proxy support, including a proxy file for rotation
- Sticky
sota/sweetmodel groups with ordering, failure fallback, and streaming protection - Hot config reload with validation before a replacement gateway takes over
- Management port with a Playground, quota dashboard, token stats, and live logs
Caveats
- No embeddings, file uploads, image generation, or Responses retrieval/cancellation; no conversation history storage — clients supply their own context
- Cross-protocol requests lose some provider-specific options; unsupported content or tool types may be rejected
- The management console guide is Chinese-only, matching the project’s documentation lean
Verdict If you have OpenCode Zen or Go credentials and want to point standard OpenAI/Anthropic tooling at them — with pooling and failover for free — this is a well-engineered shim. If you need embeddings or history management, look elsewhere.
Frequently asked
- What is jasonxu114514/opencode2api?
- opencode2api fronts OpenCode Zen and Zen Go with Chat Completions, Responses, and Anthropic Messages endpoints, plus key pools, proxy rotation, and a built-in WebUI.
- Is opencode2api open source?
- Yes — jasonxu114514/opencode2api is open source, released under the GPL-3.0 license.
- What language is opencode2api written in?
- jasonxu114514/opencode2api is primarily written in Go.
- How popular is opencode2api?
- jasonxu114514/opencode2api has 1.2k stars on GitHub.
- Where can I find opencode2api?
- jasonxu114514/opencode2api is on GitHub at https://github.com/jasonxu114514/opencode2api.