{"id":51034509,"url":"https://github.com/kartikkabadi/opencode-go-proxy","last_synced_at":"2026-06-22T04:00:59.023Z","repository":{"id":366436923,"uuid":"1276285633","full_name":"kartikkabadi/opencode-go-proxy","owner":"kartikkabadi","description":"Use your OpenCode Go subscription in the Codex app. Local Responses-to-Chat-Completions bridge for all 13 OpenCode Go models.","archived":false,"fork":false,"pushed_at":"2026-06-21T21:06:17.000Z","size":89,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-21T21:20:25.017Z","etag":null,"topics":["ai-agent","chat-completions","codex","deepseek","llm","opencode","opencode-go","proxy","python","responses-api"],"latest_commit_sha":null,"homepage":"https://opencode.ai/docs/go","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kartikkabadi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-21T19:30:03.000Z","updated_at":"2026-06-21T21:06:18.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kartikkabadi/opencode-go-proxy","commit_stats":null,"previous_names":["kartikkabadi/opencode-go-proxy"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/kartikkabadi/opencode-go-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kartikkabadi%2Fopencode-go-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kartikkabadi%2Fopencode-go-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kartikkabadi%2Fopencode-go-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kartikkabadi%2Fopencode-go-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kartikkabadi","download_url":"https://codeload.github.com/kartikkabadi/opencode-go-proxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kartikkabadi%2Fopencode-go-proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34633796,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agent","chat-completions","codex","deepseek","llm","opencode","opencode-go","proxy","python","responses-api"],"created_at":"2026-06-22T04:00:58.233Z","updated_at":"2026-06-22T04:00:59.014Z","avatar_url":"https://github.com/kartikkabadi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenCode Go Proxy\n\n[![CI](https://github.com/kartikkabadi/opencode-go-proxy/actions/workflows/ci.yml/badge.svg)](https://github.com/kartikkabadi/opencode-go-proxy/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)\n[![Zero deps](https://img.shields.io/badge/dependencies-zero-brightgreen.svg)](#)\n\nUse your [OpenCode Go](https://opencode.ai/docs/go) subscription in the [Codex app](https://github.com/openai/codex).\n\nCodex expects a Responses API (`/v1/responses`). OpenCode Go exposes an OpenAI-compatible\nChat Completions API (`/v1/chat/completions`). This proxy bridges that gap in one local process:\n\n```text\nCodex app\n    │\n    │  POST /v1/responses (Responses API)\n    ▼\nopencode-go-proxy  ←── localhost:8787, zero deps, stdlib only\n    │\n    │  POST /v1/chat/completions (Chat Completions API)\n    ▼\nOpenCode Go  ────── 13 models: DeepSeek, GLM, Kimi, MiMo, MiniMax, Qwen\n```\n\n## Why\n\nOpenCode Go is $5 for the first month, then $10/month. You get access to 13 open coding models\nhosted in the US, EU, and Singapore. Codex is a great agent but doesn't speak Chat Completions\nnatively — it requires Responses-shaped providers. This proxy fixes that.\n\n## Quick start\n\n```bash\n# Install and run\nuvx --from git+https://github.com/kartikkabadi/opencode-go-proxy \\\n  opencode-go-proxy \\\n  --bind 127.0.0.1 \\\n  --port 8787\n\n# Point Codex at it (~/.codex/config.toml)\n```\n\n```toml\n[model_providers.opencode-go]\nname = \"OpenCode Go\"\nbase_url = \"http://127.0.0.1:8787/v1\"\nexperimental_bearer_token = \"any-string-here\"\nwire_api = \"responses\"\n\n[profiles.deepseek-v4-flash]\nmodel_provider = \"opencode-go\"\nmodel = \"deepseek-v4-flash\"\nmodel_context_window = 1000000\napproval_policy = \"untrusted\"\nsandbox_mode = \"workspace-write\"\nfeatures = { memories = false }\n```\n\n```bash\n# Start Codex with a profile\ncodex -p deepseek-v4-flash\n```\n\n## Available models\n\nAll 13 OpenCode Go models work through this proxy. The defaults are DeepSeek V4 Flash\n(cheapest general-purpose) and MiMo V2.5 (cheapest vision, used for image captioning).\nSwitch to whatever you want — just change the model in your Codex profile.\n\n| Model | Slug | Best for | Requests/mo on Go |\n|-------|------|----------|-------------------|\n| DeepSeek V4 Flash | `deepseek-v4-flash` | Everyday coding (default) | ~158k |\n| DeepSeek V4 Pro | `deepseek-v4-pro` | Complex reasoning | ~17k |\n| MiMo V2.5 | `mimo-v2.5` | Vision/image captioning (default) | ~150k |\n| MiMo V2.5 Pro | `mimo-v2.5-pro` | Vision + reasoning | ~16k |\n| GLM-5.2 | `glm-5.2` | Frontier open model | ~4.3k |\n| GLM-5.1 | `glm-5.1` | Previous-gen GLM | ~4.3k |\n| Kimi K2.7 Code | `kimi-k2.7-code` | Code-specialized | ~9.3k |\n| Kimi K2.6 | `kimi-k2.6` | General-purpose | ~5.8k |\n| MiniMax M3 | `minimax-m3` | MiniMax flagship | ~16k |\n| MiniMax M2.7 | `minimax-m2.7` | Previous-gen MiniMax | ~17k |\n| Qwen3.7 Max | `qwen3.7-max` | Strong reasoning | ~4.8k |\n| Qwen3.7 Plus | `qwen3.7-plus` | Mid-tier value | ~22k |\n| Qwen3.6 Plus | `qwen3.6-plus` | Previous-gen Qwen | ~16k |\n\nRequest counts are estimates from [OpenCode Go docs](https://opencode.ai/docs/go) based on\ntypical usage patterns. Cheaper models = more requests per month.\n\n### Switching models\n\nJust create another profile and use `codex -p \u003cprofile-name\u003e`:\n\n```toml\n[profiles.deepseek-v4-pro]\nmodel_provider = \"opencode-go\"\nmodel = \"deepseek-v4-pro\"\nmodel_context_window = 1000000\napproval_policy = \"untrusted\"\nsandbox_mode = \"workspace-write\"\nfeatures = { memories = false }\n\n[profiles.glm-5.2]\nmodel_provider = \"opencode-go\"\nmodel = \"glm-5.2\"\nmodel_context_window = 272000\napproval_policy = \"untrusted\"\nsandbox_mode = \"workspace-write\"\nfeatures = { memories = false }\n\n[profiles.kimi-k2.7-code]\nmodel_provider = \"opencode-go\"\nmodel = \"kimi-k2.7-code\"\nmodel_context_window = 272000\napproval_policy = \"untrusted\"\nsandbox_mode = \"workspace-write\"\nfeatures = { memories = false }\n```\n\n```bash\ncodex -p deepseek-v4-pro\ncodex -p glm-5.2\ncodex -p kimi-k2.7-code\n```\n\n### How the default model is chosen\n\nThe proxy picks the upstream model based on what Codex sends:\n\n1. If the model slug is in the [alias map](src/opencode_go_proxy/protocol.py), it's mapped\n   (e.g. `gpt-5.5` → `deepseek-v4-pro`).\n2. If the model slug is a known OpenCode Go model (from the catalog), it's used as-is.\n3. Otherwise, it falls back to `deepseek-v4-flash`.\n\nWhen images are present in a turn with tools, the proxy routes to MiMo V2.5 for image\ncaptioning (it's the cheapest vision model on Go), then routes the main turn to your\nconfigured model. Override the vision model with `CODEX_IMAGE_MODEL`.\n\n## API key\n\nThe proxy resolves your OpenCode Go API key in this order:\n\n1. `$OPENCODE_GO_API_KEY` environment variable\n2. macOS keychain entry `opencode-go-api-key` (override with `CODEX_KEYCHAIN_SERVICE`; macOS only)\n\n```bash\n# Option 1: env var (works everywhere)\nexport OPENCODE_GO_API_KEY=\"your-key-here\"\n\n# Option 2: macOS keychain (macOS only)\nsecurity add-generic-password -a \"$USER\" -s opencode-go-api-key -w\n```\n\nGet your API key from [OpenCode Zen](https://opencode.ai/zen) after subscribing to Go.\n\n## Recommended: lazycodex\n\n[lazycodex](https://github.com/code-yeongyu/oh-my-openagent) is a Codex plugin that adds\nmulti-model orchestration, parallel background agents, and LSP/AST-aware tools. It pairs\nnaturally with this proxy — you get OpenCode Go's models as the backend and lazycodex's\nagent harness on top.\n\n```bash\nnpm install -g lazycodex-ai\n```\n\nSee the [lazycodex docs](https://github.com/code-yeongyu/oh-my-openagent) for setup.\n\n## Features\n\n- Responses `input` to chat `messages` translation\n- `instructions` and `developer` roles mapped to system messages\n- Function tool schema passthrough\n- Custom/freeform tool adaptation (Codex `apply_patch` works)\n- Reasoning content replay across tool-call turns\n- Real-time SSE streaming (not synthesized)\n- Image captioning via MiMo V2.5 when tools are present (override with `CODEX_IMAGE_MODEL`)\n- SSRF protection on image URLs (`data:image/` and `https://` only)\n- Configurable body cap, bind address guard, keychain credential resolution\n- Local health and model-list endpoints\n\n## Install\n\n### From source (no package manager)\n\n```bash\nuvx --from git+https://github.com/kartikkabadi/opencode-go-proxy opencode-go-proxy --help\n```\n\n### From a development checkout\n\n```bash\nuv sync\nuv run opencode-go-proxy --help\n```\n\n### Arch Linux (AUR)\n\n```bash\nyay -S opencode-go-proxy-git\nsystemctl --user enable --now opencode-go-proxy.service\n```\n\n### macOS (launchd)\n\nA launchd plist is included at `contrib/launchd/com.opencode-go.proxy.plist`.\nCopy it to `~/Library/LaunchAgents/` and load:\n\n```bash\nmkdir -p ~/Library/LaunchAgents ~/.codex/logs\ncp contrib/launchd/com.opencode-go.proxy.plist ~/Library/LaunchAgents/\nlaunchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.opencode-go.proxy.plist\n```\n\nThe proxy is designed for launchd's `KeepAlive` — it restarts on crash and\nstarts at login. Logs go to `~/.codex/logs/opencode-go-proxy.{log,err}`.\n\n## Configuration\n\nAll flags have environment variable defaults:\n\n| Flag | Env var | Default |\n|------|---------|---------|\n| `--bind` | `OPENCODE_GO_PROXY_BIND` | `127.0.0.1` |\n| `--port` | `OPENCODE_GO_PROXY_PORT` | `8787` |\n| `--chat-base-url` | `CHAT_COMPLETIONS_BASE_URL` | `https://opencode.ai/zen/go/v1` |\n| `--api-key-env` | `OPENCODE_GO_PROXY_API_KEY_ENV` | `OPENCODE_GO_API_KEY` |\n| `--timeout-sec` | `OPENCODE_GO_PROXY_TIMEOUT_SEC` | `180` |\n| `--max-body-mb` | `OPENCODE_GO_PROXY_MAX_BODY_MB` | `20` |\n\nThe proxy accepts both `/responses` and `/v1/responses`.\n\n## Model catalog\n\nWithout a catalog entry, Codex prints a model metadata warning every turn. A reference catalog\nwith all OpenCode Go models is included at `contrib/opencode-go-catalog.json`. Copy it to the\nproxy's default catalog path so `/models` works out of the box:\n\n```bash\nmkdir -p ~/.codex/model-catalogs\ncp contrib/opencode-go-catalog.json ~/.codex/model-catalogs/opencode-go.json\n```\n\n```toml\nmodel_catalog_json = \"/home/you/.codex/model-catalogs/opencode-go.json\"\n```\n\nThe catalog has minimal fields (slug, display_name, context_window, supported_in_api).\nIf you want Codex's full `base_instructions` for each model, copy your Codex installation's\nbundled `models.json` and append the OpenCode Go entries from the reference catalog.\n\n## Trace\n\nEvery request emits compact JSON lines on stderr. Important events:\n\n- `server.start`\n- `request.received`\n- `request.converted`\n- `credential.source`\n- `upstream.start`\n- `upstream.done`\n- `response.converted`\n- `request.failed`\n\n## Troubleshooting\n\n**Model metadata warning every turn**\nSet `model_catalog_json` in Codex config and copy the reference catalog:\n`cp contrib/opencode-go-catalog.json ~/.codex/model-catalogs/opencode-go.json`\n\n**Connection refused on localhost:8787**\nProxy isn't running. Start it: `opencode-go-proxy` or check `launchctl list | grep opencode`.\n\n**API key not found**\nSet `OPENCODE_GO_API_KEY` env var or add to macOS keychain:\n`security add-generic-password -a \"$USER\" -s opencode-go-api-key -w`\n\n**Upstream rate limited (429)**\nOpenCode 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](https://opencode.ai/docs/go#usage-limits).\n\n**Streaming not working**\nCodex sends `stream: true` — the proxy handles this. If you see no SSE events, check stderr trace for `upstream.error` or `upstream.network_error`.\n\n**Codex says \"model is not supported when using ChatGPT account\"**\nYou 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.\n\n## Development\n\n```bash\nuv run python -m pytest tests -v\nuvx ruff check\nuv build\n```\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## License\n\nMIT. See [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkartikkabadi%2Fopencode-go-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkartikkabadi%2Fopencode-go-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkartikkabadi%2Fopencode-go-proxy/lists"}