Repository navigation
fix: resolve model-specific OpenCode inference routes - #71
Merged
Merged
Conversation
DevJake
pushed a commit
to grikomsn/pi-provider-opencode-console
that referenced
this pull request
Oct 15, 2026
Go discovers `gemini-4-argon-contributor` with the Google SDK, but the generic `/zen/go/v1` base has no Google route. Selecting the right SDK alone still produces an HTML 404. Resolve generic OpenCode bases to canonical protocol-specific `/inference` routes before SDK URL composition. Keep model-level SDK metadata authoritative, add the Gemini fallback on both gateways, and align the `qwen3.8-max` fallback with its Messages protocol on Go and Chat Completions protocol on Console. Custom and explicit protocol endpoints retain their existing SDK normalization. Honor `PI_CODING_AGENT_DIR` for session storage so isolated pi runs use the same credential directory as the host. Add routing, discovery, Google streaming, and storage regressions, update the README, and include a patch Changeset. Fixes #21. Companion VS Code fix: grikomsn/opencode-copilot-chat#71. Upstream references: [inference API](https://opencode.ai/v2/docs/console/inference/) and [legacy gateway routing](https://github.com/anomalyco/opencode/blob/dev/packages/console/app/src/lib/inference-proxy.ts). Validation: - `npm run check`: typecheck and all 119 tests passed; the routing regressions failed before the fix. - `npm run package`: package dry run passed. - Isolated pi 1.2.0 with only this extension, separate agent state, no tools/MCP/context files, and ephemeral credentials: `qwen3.8-max` returned `ROUTE_OK` through Messages. - The same isolated Gemini request now reaches the inference API and returns a structured privacy-policy error because the workspace disallows endpoints that train on request data. Successful Gemini generation remains unverified under that policy; no privacy setting was changed. - Verified normal pi credentials were unchanged and removed temporary credentials after each run.
grikomsn
added a commit
to grikomsn/pi-provider-opencode-console
that referenced
this pull request
Oct 15, 2026
Discovery still uses the legacy `/zen` URLs after #22, and protocol URL construction repeats the OpenCode origin. Derive the Console server, catalog bases, and inference URLs from shared origin/base constants and a protocol-path table, following the neighboring Copilot providers' convention. Public discovery now uses `/inference/v1/models` and `/inference/go/v1/models`; legacy gateway bases in cached descriptors remain supported. Keep MiniMax's gateway-specific fallback. A live `minimax-m3` check returned 200 for Chat Completions on Console and `ModelProtocolUnsupported` for Messages. Go accepted both formats, and its metadata selects Messages. Explicit SDK metadata continues to take precedence over family fallbacks. Follow-up to merged #22; this branch starts from its merge commit and contains only the endpoint-constant cleanup, updated tests/docs, and a new patch Changeset. Companion VS Code change: grikomsn/opencode-copilot-chat#71. Validation: - `npm run check`: typecheck and all 120 tests passed. - `npm run package`: package dry run passed. - Canonical Console and Go catalog endpoints returned 200; the legacy bases remain covered by routing tests. - Isolated pi 1.2.0 discovered models through canonical Go discovery and returned `ROUTE_OK` using `qwen3.8-max`. Normal pi credentials were unchanged, and temporary credentials were removed.
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.
Gemini models on Go can resolve to the Google protocol while retaining a generic gateway base. The legacy
/zen/go/v1gateway has no Google route, so requests return an HTML 404. Console Google requests also need the/models/<id>path segment.Resolve generic OpenCode bases to canonical protocol-specific
/inferenceroutes for Chat Completions, Responses, Messages, and Google. Following the neighboring Copilot providers' convention, derive the Console server, discovery URLs, and inference URLs from shared origin/base constants and a protocol-path table. Discovery now uses canonical/inferenceendpoints; cached/zendescriptors remain supported. Preserve custom and explicit protocol endpoints, and use the Gemini fallback on both gateways when metadata is missing or unavailable.Keep the MiniMax mode condition: a live
minimax-m3check returned 200 through Chat Completions on Console andModelProtocolUnsupportedthrough Messages. Go accepted both formats, and its model metadata selects Messages. Regression tests cover the distinct defaults and explicit SDK overrides.Related: grikomsn/pi-provider-opencode-console#21. The original pi fix was merged in grikomsn/pi-provider-opencode-console#22. Upstream references: inference API and legacy gateway routing.
Validation:
npm run package: all 189 tests passed, followed by successful VSIX packaging.