Repository navigation
Conversation
Pins the dynamic route shape (base URL, OPENCODE_GO_API_KEY, x-opencode-session), that no other gateway inherits that header, the HIGH/MID/LOW matrix, the static route prices and the credential that activates the method. These tests fail on main today: opencode_go is not a known provider and AuthMethod has no OPENCODE_GO_API member.
Registers opencode_go on its documented base (opencode.ai/inference/go/openai/v1) with OPENCODE_GO_API_KEY, sends the mandatory x-opencode-session hint, and maps HIGH/MID/LOW to kimi-k3, glm-5.3 and deepseek-v4.1-flash. Four catalog records carry the published per-token rates so budget caps stay enforceable; the four generator outputs are regenerated rather than edited by hand.
Adds the gateway row to the setup guide and records the observed endpoint behaviour (missing-session 400, Go vs balance billing, tool calling and streaming per model) plus the proxy, lint and test runs behind the PR claim.
The previous note described the proxy-only checks and called out an unavailable Docker engine. The suite was subsequently run in WSL2 Ubuntu, the environment matching the CI runner: make ci-lint, ci-test (6267 passed), quality-cli, quality-telemetry, skill audit and graph checks, launcher go vet/test, pip-audit, actionlint and compose validation, plus the composed stack with a live tool call through opencode_go/kimi-k3.
The wizard does not offer OpenCode Go yet, and the two plans share a key format: a Go key pasted into the Zen option is billed to the balance instead of the Go plan with no error. Record the distinction next to the gateway table.
Links BitterSecurity#1218 under Unreleased and states that the onboarding-wizard entry which removes the silent balance-billing choice is a separate follow-up PR.
12 of 14 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds OpenCode Go as an OpenAI-compatible gateway, so a deployment that only sets
OPENCODE_GO_API_KEYresolves the tier chain toopencode_go/kimi-k3(HIGH),opencode_go/glm-5.3(MID) andopencode_go/deepseek-v4.1-flash(LOW), with those routes present in the generated static config and carrying thex-opencode-sessionheader the endpoint rejects requests without. OpenCode Zen is untouched. Go is a separate base URL, credential name and model inventory; a Go key also authenticates the pay-as-you-go base, so the base URL is what makes a request bill the Go plan instead of the credit balance — that is the only behavioural difference the code encodes.Changes
config/litellm_dynamic_config.py:opencode_goentry inOPENAI_COMPAT_GATEWAYS(documented basehttps://opencode.ai/inference/go/openai/v1, keyOPENCODE_GO_API_KEY) plusOPENCODE_GO_SESSION_HEADERS, applied only to that prefix.model-catalog/catalog.jsonandoverlay.json: fouropencode_go/*models with their published per-token rates and limits;User-Agentstays in the catalog,x-opencode-sessionlives in the overlay provider block. The generator's four outputs (config/litellm.yaml,config/litellm_prod_catalog.json,currentProdModels.ts,configuredModelRoutes.ts) are regenerated, not hand-edited;generate.py --checkis clean.decepticon_core/types/llm.py:AuthMethod.OPENCODE_GO_API, HIGH/MID/LOW matrix, and the routing-table row in the module docstring.decepticon/llm/factory.py: env detection, default priority next to Zen and before the local endpoints,decepticon-cli authlabel..env.example,docs/setup-guide.md,docs/verification/opencode-go-20261130.md.Intent
@PurpleCHOIms. No ADR: this is one more row in two existing tables, not an architectural choice.async_pre_call_hookto mint per-conversation ids is a separate change with its own middleware surface.Two decisions worth flagging for review:
$0pluspricing_zero_reason. Theminimax_planprecedent models a subscription whose plan has no per-token rate card. Go does publish one:GET .../modelsreturnscost.text, and Go's own usage windows are denominated in dollars from those rates. With realmodel_infoprices LiteLLM reports a non-zerox-litellm-response-cost, soDECEPTICON_BUDGET__*caps keep enforcing on these routes. With$0the routes would report no spend and a configured cap would silently not bind.kimi-k3, MID isglm-5.3. Every other gateway's HIGH is its most expensive frontier route, and kimi-k3 (3.00/15.00 per 1M) sits above glm-5.3 (1.40/4.40). The vouch discussion did not fix the mapping; tiering by published rate keeps it consistent with the rest of the table.Follow-up required: the onboarding wizard (separate PR)
decepticon onboardoffers no OpenCode entry at all — neither plan. That is not cosmetic, and it should not be read as "Go is unsupported":clients/launcher/cmd/onboard.go,methodOrder), which predates the OpenAI-compatible gateway family: Zen, Vercel, HF, Venice, NanoGPT, Synthetic, ZenMux, Qianfan, Cloudflare and Cheaper Inference are all absent from it too. The gap is pre-existing, not introduced here.OPENCODE_API_KEYin.env(the documented route for every gateway in this family), the request is served by Zen and billed to the credit balance instead of the monthly Go plan, with no error. Verified on 2026-11-30 with the same credential:zen/v1→usage.opencode.billing_source = "balance",inference/go→"go".This PR reduces the risk rather than removing it at the point of use: it adds the correct
.envroute, the tier mapping, the picker entry and an explicit warning indocs/setup-guide.md. Removing the footgun needs a second PR againstclients/launcher: one "OpenCode" wizard entry with a plan choice that writesOPENCODE_GO_API_KEYfor Go andOPENCODE_API_KEYfor Zen. That follow-up is #1219: two adjacent entries (OpenCode Zen / OpenCode Go) so the plan is chosen explicitly, and it depends on this PR (AuthMethod.OPENCODE_GO_APIand the route must exist first).Blast radius
.semgrep/**.No prompt, skill, OPSEC wording, RoE,
SafeCommand,EngagementContext, semgrep rule, compose file or dependency changes.Diff budget
large-diff-approvedfrom@PurpleCHOImsbecause:Composition, since the raw insertion count is large: exactly 10 non-test, non-doc files (the limit). Four are generator outputs (
config/litellm.yaml,config/litellm_prod_catalog.json,currentProdModels.ts,configuredModelRoutes.ts) that CI's drift check rejects editing by hand. Hand-written code is 30 lines (litellm_dynamic_config.py17,types/llm.py10,factory.py3); the remaining ~350 insertions are four catalog records, two overlay provider blocks and their generated form. One concern: registering one provider.End-to-end verification
Run on the branch head in WSL2 Ubuntu (same OS family as the CI runner) with Docker Engine 29.9.3, Node 22.23.5,
makeand Go onPATH, using a live Go key:make ci-test(the blocking PR lane:uv run --extra mcp pytest -n auto -q -m "not slow") →6267 passed, 14 skippedin 62.6s;make ci-lint→ ruff and format clean, basedpyright 0 errors;make quality-cli→npm audit0, streaming build,tsc --noEmit, build and vitest all exit 0;make quality-telemetry→ 0.make audit-skills-strict→ 329 files, 0 violations;make bootstrap-skill-graph+make check-skill-graph→ OK (2140 nodes, 5763 edges);go vet ./...+go test ./...→ vet 0, all packages ok;pip-auditover 191 pinned requirements → no known vulnerabilities;actionlint1.7.7 → clean;docker compose configfor base/dev/dev+watch → 3/3 valid;model-catalog/generate.py --check→ clean andtest_catalog.py→ 10 passed.make smokebuilds and brings the stack up; withDECEPTICON_SANDBOX_PROVIDER=docker(the defaultopenshellprovider needs theopenshellcompose profile) every service reports healthy.GET :4000/v1/modelslistsopencode_go/{kimi-k3,glm-5.3,deepseek-v4.1-flash,minimax-m3};POST :4000/v1/chat/completionsforopencode_go/kimi-k3with aread_filetool returnedfinish_reason: tool_calls,read_file({"path":"/etc/hostname"}), 255 tokens,x-litellm-model-api-base: https://opencode.ai/inference/go/openai/v1andx-litellm-response-cost: 0.001773; inside thelanggraphcontainer a loneOPENCODE_GO_API_KEYresolves HIGH/MID/LOW to the three routes above.x-opencode-session→ 400MissingSessionID; proxy without the key →Missing credentials …with no fallback group. Both are recorded in the verification note.Not reproduced locally: the hosted multi-arch
docker-build/docker-build-arm64lanes (arm64 emulation) and the live-providermake test-livesuite.Testing
make qualitypasses (Python + CLI + Web) — its four targets were run in WSL2 Ubuntu with Node 22 and each exits 0:ci-lint,ci-test(6267 passed, 14 skipped),quality-cli(audit, streaming build, typecheck, build, vitest) andquality-telemetry.make smokesucceeds (clean local build + OSS-style up + health checks) — images built and every service healthy withDECEPTICON_SANDBOX_PROVIDER=docker; the defaultopenshellprovider needs theopenshellcompose profile.pytest tests/passes —tests/is part of themake ci-testselection above (-m "not slow"), which is what CI runs.resolve_chainreturningopencode_go/kimi-k3/glm-5.3/deepseek-v4.1-flashfor a lone Go credential).ruff check(all checks passed),ruff format --check(943 files formatted),basedpyright(0 errors; 0 errors/0 warnings on the three touched runtime files),tsc --noEmitinclients/cliafter buildingclients/shared/streaming(clean),scripts/audit_model_payloads.py(300 routes, 296 concrete chat payloads passed, no provider inference).Quality Bar self-check
AI-assisted contribution attestation
Prepared with an AI coding agent and reviewed line by line. No AI co-author trailer is present. Every claim above was produced by running the command on this machine; the items listed as not run were not ticked. The diff adds one provider: no guard rail, isolation limit or OPSEC wording is touched.
Related Issues
Relates to the vouch discussion #1212. No issue is closed by this PR.