jasonxu114514/opencode2api
A Go-based OpenCode Zen / Zen Go API proxy with OpenAI & Anthropic API compatibility, key/proxy pooling, automatic routing, and WebUI.
What it solves
This project provides a unified gateway that bridges different OpenCode inference protocols (Zen and Go). It allows users to manage multiple API keys, handle proxy connections, and route requests across different services without needing a database or a Node.js runtime.
How it works
The gateway acts as a translation layer between your applications and OpenCode services. It accepts standard requests (like Chat Completions or Anthropic Messages), translates them into the native protocol required by the upstream provider, and manages key rotation, retries, and session affinity. It includes a built-in WebUI for monitoring token usage, managing API keys, and configuring routing rules.
Who it’s for
It is designed for developers or power users who need to aggregate multiple OpenCode accounts, manage complex proxy setups, or provide a consistent API interface for applications that need to switch between different OpenCode models and tiers.
Highlights
- Protocol Translation: Seamlessly bridges Chat Completions, Responses, and Anthropic Messages endpoints.
- Key Management: Supports separate key pools for Zen and Go services with configurable tier preferences and automatic retries.
- Built-in WebUI: Includes a management console for diagnostics, token statistics, and live logs without external dependencies.
- Flexible Connectivity: Supports direct, HTTP, HTTPS, and SOCKS5 proxy connections.
- Dynamic Discovery: Automatically tracks model availability, limits, and pricing metadata from official sources.
- Lightweight: A single Go binary that requires no database or Node.js runtime to operate.
Related
- Project
- Project
- Project
- Project