Repolode
jasonxu114514

jasonxu114514/opencode2api

A Go gateway that exposes OpenCode Zen and Zen Go models through Chat Completions, Responses and Anthropic Messages APIs, with key and proxy pooling and a WebUI.

Stars
1,099
Forks
192
Open issues
25
Last commit
15 hours ago

What is it?

opencode2api is a self-hosted gateway for OpenCode Zen and Zen Go. It accepts requests in Chat Completions, Responses, or Anthropic Messages format and translates them into each upstream's native protocol, so clients built for one API style can reach models served under another. The project ships as a single Go binary with the WebUI embedded, and needs no Node.js runtime or database.

Upstream Zen and Go keys are managed in separate pools, with configurable tier preference, retries, session affinity, and direct, HTTP, HTTPS, SOCKS5, or SOCKS5H proxy routing. Model discovery refreshes from OpenCode's catalog, and a separate management port offers configuration editing, a Playground, diagnostics, token statistics, live logs, and a Go subscription quota dashboard.

The gateway supports text, images, reasoning, function tools, and tool results where the target protocol can represent them. It does not implement embeddings, file uploads, image generation, or conversation storage.

Key features

  • 01Converts between Chat Completions, Responses and Anthropic Messages protocols, with JSON and SSE output.
  • 02Separate Zen and Go key pools with tier preference, retries and session affinity.
  • 03Routes through direct, HTTP, HTTPS, SOCKS5 or SOCKS5H proxies, including proxy files.
  • 04Includes a WebUI on a separate port for configuration, Playground, diagnostics and live logs.
  • 05Hot-reloads configuration, validating changes before new requests use them.
  • 06Creates and manages local API keys for clients.

Use cases

  • Pointing an OpenAI- or Anthropic-compatible coding tool at OpenCode Zen or Zen Go models.
  • Sharing a pool of upstream keys and proxies across several local clients.
  • Monitoring token usage and Go subscription quota from a single dashboard.

Topics

FAQ

What is opencode2api?
A Go gateway that exposes OpenCode Zen and Zen Go models through Chat Completions, Responses and Anthropic Messages APIs, with key and proxy pooling and a WebUI. opencode2api is a self-hosted gateway for OpenCode Zen and Zen Go. It accepts requests in Chat Completions, Responses, or Anthropic Messages format and translates them into each upstream's native protocol, so clients built for one API style can reach models served under another. The project ships as a single Go binary with the WebUI embedded, and needs no Node.js runtime or database.
Is opencode2api free to use? What license does it have?
opencode2api is open source under the GPL-3.0 license. Check the license terms before using it in commercial products.
Is opencode2api still maintained?
Actively maintained. The last commit to opencode2api was on Oct 19, 2026.
What can I use opencode2api for?
Pointing an OpenAI- or Anthropic-compatible coding tool at OpenCode Zen or Zen Go models. Sharing a pool of upstream keys and proxies across several local clients. Monitoring token usage and Go subscription quota from a single dashboard.
Where can I get opencode2api?
The source code and installation instructions are on GitHub: https://github.com/jasonxu114514/opencode2api

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects