Use your OpenCode Go subscription in the Codex app.
Codex expects a Responses API (/v1/responses). OpenCode Go exposes an OpenAI-compatible
Chat Completions API (/v1/chat/completions). This proxy bridges that gap in one local process:
Codex app
│
│ POST /v1/responses (Responses API)
▼
opencode-go-proxy ←── localhost:8787, zero deps, stdlib only
│
│ POST /v1/chat/completions (Chat Completions API)
▼
OpenCode Go ────── 13 models: DeepSeek, GLM, Kimi, MiMo, MiniMax, Qwen
OpenCode Go is $5 for the first month, then $10/month. You get access to 13 open coding models hosted in the US, EU, and Singapore. Codex is a great agent but doesn't speak Chat Completions natively — it requires Responses-shaped providers. This proxy fixes that.
# Install and run
uvx --from git+https://github.com/kartikkabadi/opencode-go-proxy \
opencode-go-proxy \
--bind 127.0.0.1 \
--port 8787
# Point Codex at it (~/.codex/config.toml)[model_providers.opencode-go]
name = "OpenCode Go"
base_url = "http://127.0.0.1:8787/v1"
experimental_bearer_token = "any-string-here"
wire_api = "responses"
[profiles.deepseek-v4-flash]
model_provider = "opencode-go"
model = "deepseek-v4-flash"
model_context_window = 1000000
approval_policy = "untrusted"
sandbox_mode = "workspace-write"
features = { memories = false }# Start Codex with a profile
codex -p deepseek-v4-flashAll 13 OpenCode Go models work through this proxy. The defaults are DeepSeek V4 Flash (cheapest general-purpose) and MiMo V2.5 (cheapest vision, used for image captioning). Switch to whatever you want — just change the model in your Codex profile.
| Model | Slug | Best for | Requests/mo on Go |
|---|---|---|---|
| DeepSeek V4 Flash | deepseek-v4-flash |
Everyday coding (default) | ~158k |
| DeepSeek V4 Pro | deepseek-v4-pro |
Complex reasoning | ~17k |
| MiMo V2.5 | mimo-v2.5 |
Vision/image captioning (default) | ~150k |
| MiMo V2.5 Pro | mimo-v2.5-pro |
Vision + reasoning | ~16k |
| GLM-5.2 | glm-5.2 |
Frontier open model | ~4.3k |
| GLM-5.1 | glm-5.1 |
Previous-gen GLM | ~4.3k |
| Kimi K2.7 Code | kimi-k2.7-code |
Code-specialized | ~9.3k |
| Kimi K2.6 | kimi-k2.6 |
General-purpose | ~5.8k |
| MiniMax M3 | minimax-m3 |
MiniMax flagship | ~16k |
| MiniMax M2.7 | minimax-m2.7 |
Previous-gen MiniMax | ~17k |
| Qwen3.7 Max | qwen3.7-max |
Strong reasoning | ~4.8k |
| Qwen3.7 Plus | qwen3.7-plus |
Mid-tier value | ~22k |
| Qwen3.6 Plus | qwen3.6-plus |
Previous-gen Qwen | ~16k |
Request counts are estimates from OpenCode Go docs based on typical usage patterns. Cheaper models = more requests per month.
Just create another profile and use codex -p <profile-name>:
[profiles.deepseek-v4-pro]
model_provider = "opencode-go"
model = "deepseek-v4-pro"
model_context_window = 1000000
approval_policy = "untrusted"
sandbox_mode = "workspace-write"
features = { memories = false }
[profiles.glm-5.2]
model_provider = "opencode-go"
model = "glm-5.2"
model_context_window = 272000
approval_policy = "untrusted"
sandbox_mode = "workspace-write"
features = { memories = false }
[profiles.kimi-k2.7-code]
model_provider = "opencode-go"
model = "kimi-k2.7-code"
model_context_window = 272000
approval_policy = "untrusted"
sandbox_mode = "workspace-write"
features = { memories = false }codex -p deepseek-v4-pro
codex -p glm-5.2
codex -p kimi-k2.7-codeThe proxy picks the upstream model based on what Codex sends:
- If the model slug is in the alias map, it's mapped
(e.g.
gpt-5.5→deepseek-v4-pro). - If the model slug is a known OpenCode Go model (from the catalog), it's used as-is.
- Otherwise, it falls back to
deepseek-v4-flash.
When images are present in a turn with tools, the proxy routes to MiMo V2.5 for image
captioning (it's the cheapest vision model on Go), then routes the main turn to your
configured model. Override the vision model with CODEX_IMAGE_MODEL.
The proxy resolves your OpenCode Go API key in this order:
$OPENCODE_GO_API_KEYenvironment variable- macOS keychain entry
opencode-go-api-key(override withCODEX_KEYCHAIN_SERVICE; macOS only)
# Option 1: env var (works everywhere)
export OPENCODE_GO_API_KEY="your-key-here"
# Option 2: macOS keychain (macOS only)
security add-generic-password -a "$USER" -s opencode-go-api-key -wGet your API key from OpenCode Zen after subscribing to Go.
lazycodex is a Codex plugin that adds multi-model orchestration, parallel background agents, and LSP/AST-aware tools. It pairs naturally with this proxy — you get OpenCode Go's models as the backend and lazycodex's agent harness on top.
npm install -g lazycodex-aiSee the lazycodex docs for setup.
- Responses
inputto chatmessagestranslation instructionsanddeveloperroles mapped to system messages- Function tool schema passthrough
- Custom/freeform tool adaptation (Codex
apply_patchworks) - Reasoning content replay across tool-call turns
- Real-time SSE streaming (not synthesized)
- Image captioning via MiMo V2.5 when tools are present (override with
CODEX_IMAGE_MODEL) - SSRF protection on image URLs (
data:image/andhttps://only) - Configurable body cap, bind address guard, keychain credential resolution
- Local health and model-list endpoints
uvx --from git+https://github.com/kartikkabadi/opencode-go-proxy opencode-go-proxy --helpuv sync
uv run opencode-go-proxy --helpA launchd plist is included at contrib/launchd/com.opencode-go.proxy.plist.
Copy it to ~/Library/LaunchAgents/ and load:
mkdir -p ~/Library/LaunchAgents ~/.codex/logs
cp contrib/launchd/com.opencode-go.proxy.plist ~/Library/LaunchAgents/
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.opencode-go.proxy.plistThe proxy is designed for launchd's KeepAlive — it restarts on crash and
starts at login. Logs go to ~/.codex/logs/opencode-go-proxy.{log,err}.
All flags have environment variable defaults:
| Flag | Env var | Default |
|---|---|---|
--bind |
OPENCODE_GO_PROXY_BIND |
127.0.0.1 |
--port |
OPENCODE_GO_PROXY_PORT |
8787 |
--chat-base-url |
CHAT_COMPLETIONS_BASE_URL |
https://opencode.ai/zen/go/v1 |
--api-key-env |
OPENCODE_GO_PROXY_API_KEY_ENV |
OPENCODE_GO_API_KEY |
--timeout-sec |
OPENCODE_GO_PROXY_TIMEOUT_SEC |
180 |
--max-body-mb |
OPENCODE_GO_PROXY_MAX_BODY_MB |
20 |
The proxy accepts both /responses and /v1/responses.
Without a catalog entry, Codex prints a model metadata warning every turn. A reference catalog
with all OpenCode Go models is included at contrib/opencode-go-catalog.json. Copy it to the
proxy's default catalog path so /models works out of the box:
mkdir -p ~/.codex/model-catalogs
cp contrib/opencode-go-catalog.json ~/.codex/model-catalogs/opencode-go.jsonmodel_catalog_json = "/home/you/.codex/model-catalogs/opencode-go.json"The catalog has minimal fields (slug, display_name, context_window, supported_in_api).
If you want Codex's full base_instructions for each model, copy your Codex installation's
bundled models.json and append the OpenCode Go entries from the reference catalog.
Every request emits compact JSON lines on stderr. Important events:
server.startrequest.receivedrequest.convertedcredential.sourceupstream.startupstream.doneresponse.convertedrequest.failed
Model metadata warning every turn
Set model_catalog_json in Codex config and copy the reference catalog:
cp contrib/opencode-go-catalog.json ~/.codex/model-catalogs/opencode-go.json
Connection refused on localhost:8787
Proxy isn't running. Start it: opencode-go-proxy or check launchctl list | grep opencode.
API key not found
Set OPENCODE_GO_API_KEY env var or add to macOS keychain:
security add-generic-password -a "$USER" -s opencode-go-api-key -w
Upstream rate limited (429) OpenCode Go has 5-hour/weekly/monthly usage limits. Switch to a cheaper model (DeepSeek V4 Flash or MiMo V2.5) to stretch your quota. See usage limits.
Streaming not working
Codex sends stream: true — the proxy handles this. If you see no SSE events, check stderr trace for upstream.error or upstream.network_error.
Codex says "model is not supported when using ChatGPT account"
You used codex -m deepseek-v4-flash instead of codex -p deepseek-v4-flash. The -m flag only changes the model name, not the provider. Use -p to select a profile.
uv run python -m pytest tests -v
uvx ruff check
uv buildSee CONTRIBUTING.md for guidelines.
MIT. See LICENSE.