Skip to content

model-gateway: Add opencode go models support - #752

Open
itsfatodono wants to merge 1 commit into
Eigenwise:developfrom
itsfatodono:feature/gateway-opencode
Open

itsfatodono wants to merge 1 commit into
Eigenwise:developfrom
itsfatodono:feature/gateway-opencode

Conversation

@itsfatodono

@itsfatodono itsfatodono commented Nov 3, 2026 •

Copy link
Copy Markdown

Summary

Adds OpenCode Go (opencode.ai flat-rate subscription: DeepSeek, GLM, Kimi, Qwen, MiniMax, …) as a third gateway backend next to Codex and Grok.

  • claude-opencodego-<id> rows are passed through unchanged to Go's Anthropic Messages endpoint. Go translates server-side, so there is no translation layer.
  • Key setup: login --opencodego, read from stdin and saved to ~/.claude/model-gateway/opencode-go-key (0600). No key means no rows and no catalog fetch.
  • Rows come from Go's live catalog (tools + text input), cached on disk and refreshed every 6h. There is no hand-written list.
  • The gateway applies its own effort mapping, sends a per-session x-opencode-session, and strips Claude credentials (header allowlist).
  • doctor gets an OpenCode Go section. context-window --opencodego / --opencodego-compact-at are supported.

Live check against a real Go key, through the gateway (DeepSeek V4.1 Flash, same ~10.8k-token prompt three times):

Request Uncached input Cache read Allowance
1 10,835 0 $0.00098
2 83 10,752 $0.00003
3 83 10,752 $0.00005

billing_source: go on all three. Not yet verified end to end: streaming and tool loops inside a real Claude Code session.

Found while doing this, out of scope: #751 (usage records still target the removed loopback Collector).

Checklist

  • This PR targets develop, not main.

  • I have no board ref and am asking a maintainer to add one. Suggested fragment: minor, model-gateway, "Add opencode go models support".

  • Agent-facing surfaces updated: model-gateway SKILL.md, remote-control-compatibility SKILL.md, CLI help, refusal and error strings, README, getting-started page.

  • Verify command run and result:

    cd plugins/model-gateway && npm ci && npm test
    -> 721 tests, 707 pass, 9 fail, 5 skipped
    
    The 9 failures fail identically on a clean develoay-drain ×3, gateway-process-isolation ×1,wiring-mode ×5). None of them involve this change.
    
    CRAP: every new function is below 6. Legacy functions this PR touches that were already above 6 on develop: doctor 52,
    

handleRequest's end callback 73 → 75, resolveGatewaeshModels 10, validateCompactAtSettings 6. Theexisting Codex login body moved unchanged into codexLogin; it has no test coverage, as before.

Negative control

savedContextWindows now guards against a missing backend entry (windows[backend]?.source). Reverting that guard makes
context-window updates validate the backend and the, 1 fail), because a windows object without anopencodego entry throws.

Two things to check before you open it. The live test was just my three non-streaming requests, so I wrote it up that way and listed what's still unverified. The CRAP figures co measurement, not from the repo's own tool.

@Eigenwise

Copy link
Copy Markdown
Owner

Direction call from Kenny (2026-11-09): yes, OpenCode Go is welcome as a third backend. Thanks for being explicit about what you did and did not verify live. I'm routing this through our review flow this week (same shape as the Antigravity review on #644: default-off state byte-identical, header allowlist, no credential leakage, bounded process sites). I'll add the maintainer fragment (minor, model-gateway) when it lands. The 9 failures you saw on develop (gateway-drain, gateway-process-isolation, wiring-mode) pass on Windows here, so I'll look at them separately as Linux/mac issues; they won't be held against this PR.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants