Thanks for stopping by! This project routes OpenCode Go models into Codex and Claude Code with sanitization, quota guards and a tray app. Contributions of all sizes are welcome — bug fixes, new model metadata, docs, translations.
- Never commit secrets.
config.json,data/ledger.json,data/*.jsonlanddata/vision-cache.jsonare gitignored for a reason. Use placeholders (sk-...) in examples and tests. - Don't burn quota in tests. Prefer offline unit tests and tiny capped
requests (
max_tokens/max_output_tokenssmall, no tools). Never loop against the live API while debugging — check the ledger (GET /stats). - Keep the runtime zero-dependency.
src/proxy.mjsmust run on stock Node 18+. Dev-only deps (electron, electron-builder) stay indevDependencies. - English everywhere. Code, docs, UI strings and commit messages.
git clone https://github.com/moesuito/OpenCodeGoProxy
cd OpenCodeGoProxy
Copy-Item config.example.json config.json # add your own key for live tests
npm install # dev deps (electron, builder)
npm run proxy # proxy on :11447src/proxy.mjs— HTTP server, routes, ledger (/responses,/chat,/messages).src/policies.mjs— per-request sanitization + per-model policy.src/anthropic-bridge.mjs— Messages ↔ Chat/Responses translation (incl. SSE).src/vision.mjs— image decoder for proven-blind models (+ hash cache).src/model-meta.mjs— display names, reasoning maps, context windows,UNAVAILABLElist. New Go model? Start here.src/keypool.mjs,src/prices.mjs— rotation, budgets, cost math.src/catalog.mjs— Codex model-catalog generator.src/profile-codex.mjs,src/profile-claude.mjs,src/gui-api.mjs— Normal↔Proxy switching (all headless-testable, see below).app/— Electron tray shell + panel (renderer talks viaoc:callIPC only; neverimport()files from the renderer).
node --check <file>must pass for every touched.mjs/extracted renderer script.- Logic modules are headless-testable: point
CODEX_HOME/OC_CLAUDE_DIR/OPENCODE_GO_PROXY_CONFIGat temp dirs and drive the exported functions (seegui-api.mjsheader). Round-trips must restore byte-identical files. - Live API checks: single tiny request, then confirm in
/stats. If a test writes todata/, clean it up (never commitdata/). - UI changes: syntax-check the extracted
<script>and describe the manual click-test performed (tray panel can't be driven headless).
- One topic per PR, with before/after evidence (logs, ledger deltas, screenshots for UI).
- Update
docs/DOCUMENTATION.mdwhen behavior changes; update the troubleshooting table when you fix a real failure mode. - Versioning: runtime fixes → patch, features → minor,
package.json+commit -m "vX.Y.Z: ...". Releases (installer) are cut by maintainers withnpm run dist+gh release create.
- Vision data for untested models (quiz: does it describe a control image?).
contextForvalues for models marked fallback (omen-alphaand friends).- Pricing updates in
prices.mjswhen OpenCode Go docs change. - Docs screenshots / typo fixes.
MIT — see LICENSE. By contributing, you agree your work ships under it.