feat: add OpenCode Go as a third model router

↗ view on GitHub · duncanmcqueen · 2026-08-20 · 23b41c5a

OpenCode Go (opencode.ai's low-cost hosted gateway for open coding models
- GLM-5, Kimi K3, Qwen3.8 Max, MiniMax-M3, DeepSeek V4) joins OpenRouter
and the Vercel AI Gateway as a router, reusing the existing router
plumbing end to end rather than adding a parallel one:

- opencode-go/<model> ids stream through the shared router adapter
  against https://opencode.ai/zen/go/v1, with OPENCODE_GO_BASE_URL as the
  usual proxy/test override. OpenRouter's attribution headers and
  reasoning payload stay OpenRouter-only.
- New opencode-go user API key (OPENCODE_API_KEY env or encrypted
  per-user storage) with a Settings > API Keys field and a migration
  widening the user_api_keys provider CHECK.
- GET /models/opencode-go returns the live catalog with the key kept
  server-side; Settings > Routers gains an OpenCode Go picker, and the
  saved selection gates requests through the same user_router_models
  choke point that stops a hand-crafted request from spending the
  operator's env key on an arbitrary gateway model.
- Both model pickers and the Word add-in gain an "OpenCode Go" group.

Router slugs, model-id prefixes and API-key provider names are one string
per router, so routerForModelId, the selection lookups and the profile
payload are now driven by ROUTER_SLUGS instead of a hard-coded pair. The
one place the routers genuinely differ is catalog-id shape: OpenCode Go
publishes bare model names ("glm-5"), so id validation is per-router.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Repository open-legal-products/mike
Author duncanmcqueen <206344294+duncanmcqueen@users.noreply.github.com>
Authored
Committed
Parents 5b441de0
Stats 44 files changed , +953 , -221
Part of Add OpenCode Go as a third model router

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-23b41c5a.md from inside the repo you want the change in.

⬇ Download capture-commit-23b41c5a.md