Models-first provider connect and multi-protocol OpenCode Go - #323
Merged
Conversation
Ship @corbits/provider-opencode-go as a TUI-free package: pre-seeded models with per-model protocol metadata, endpoint routing for chat completions / responses / Anthropic messages, API-key validation, subscription usage fetch with clean degrade, and gateway error classification for quota and rate-limit shapes (including HTTP 400).
Ship @corbits/first-class-providers with the seven connect targets (Codex, xAI, Zen, Anthropic, OpenAI, Google, OpenCode Go), auth mode metadata, pre-seeded models, and adapter hints so Corbits only wires connect and inference.
Add settings flags, catalog builders, and per-model protocol routing so Go models resolve to the correct adapter and base URL. Register a generic openai-responses adapter for responses-protocol models and keep settings load from dropping optional keys including otel.
Reclassify GoUsageLimitError and provider rate-limit payloads in the retry normalizer so long-window quota aborts cleanly and short rate limits stay retryable, including when the gateway returns HTTP 400.
Remove the standalone login command entry points and add Ctrl+A / c Connect on /model for first-class providers. OAuth paths reuse existing Codex and xAI flows; API-key providers prompt, validate, and persist so models are selectable without restart.
When the active provider is OpenCode Go, fetch and format rolling usage for the status bar and degrade cleanly on auth or network failure instead of blocking the session.
Update product, architecture, and implementation docs for Connect from /model, first-class provider packages, and per-model protocol routing on the Go gateway.
Editing a Go or Anthropic catalog entry without re-submitting connect flags was dropping anthropic/opencodeGo and breaking multi-protocol routing. Seed connectDraft from existing provider flags, preserve flags in buildProviderEntry, and stop matching bare provider_rate_limit_exceeded so non-Go proxies are not misclassified. Align remaining /login and /agent copy with models-first Connect.
Connecting an already-saved API-key provider (e.g. OpenCode Go) failed with name conflict. Seed Connect as edit when the catalog already has that id so key rotation works in place while keeping operator-customized models and protocol flags.
Accidental staging from a parallel PR review; not part of models-first Connect or OpenCode Go work.
Bare Go 429s were stuck as quota_exhausted because reclassification required body markers while intx defaults 429 to quota. Recognize known Go context via requestURL, provider id, or opencodeGo so short rate limits reclassify as retryable. Prefer clear usage-limit markers on 403 over unauthorized. Cover empty-key re-Connect apiKey preservation.
TheGreatAxios
force-pushed
the
stack/opencode-models-first-connect
branch
from
August 5, 2026 06:26
2e85f72 to
fa36256
Compare
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
/loginwith models-first Connect on/model(c/ Ctrl+A) for seven first-class providers (Codex, xAI, Zen, Anthropic, OpenAI, Google, OpenCode Go).@corbits/provider-opencode-goand@corbits/first-class-providers(catalog, auth metadata, protocol routing, usage).GoUsageLimitError, free-limit, provider rate limits) including the observed HTTP 400 rate-limit quirk, so quota aborts and short limits stay retryable.Commits
/loginentry points)Test plan
bun run typecheckbun run buildpermission.wait spansinsrc/perf/permission-subagent-spans.test.ts)/model→ Connect (c/Ctrl+A) → API-key providers persist and models appear without restart