Repository navigation
fix: use a bundled provider package for the responses protocol - #2
Merged
moutansos merged 1 commit intoOct 2, 2026
Merged
Conversation
OpenCode imports provider packages from its own compiled bundle, so the openai-compatible/responses subpath the plugin referenced is not reachable. Every responses request failed at model init with: Cannot initialize <provider>/<model>: Cannot find package '@opencode/ai' imported from /$bunfs/root/chunk-6mdchvy2.js Register @opencode/ai/providers/openai/responses instead, which the bundle does provide, and cover it with the existing package-selection test. Fixes the reported responses-protocol failure.
Owner
|
Thanks for the fix! |
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.
What
Fix the
responsesprotocol.src/index.tsregistered@opencode/ai/providers/openai-compatible/responses; the compiled OpenCodebundle does not contain that subpath, so model init failed with:
The provider and model were listed in
/modelsand selectable, so the failureonly appeared on the first prompt, and only with
protocol: "responses".protocol: "chat"was unaffected.Fixes #1.
Change
Plus a comment explaining that OpenCode resolves these names from inside its own
bundle, so only bundled subpaths are importable, and the corresponding
assertion in
src/index.test.ts.Why this target
@opencode/ai/providers/openai/responsesis in the bundle (opencode --version2.0.15, Linux x64).a Responses-compatible endpoint.
@opencode/aitarball andresolves from a plugin's own
node_modules, which is why the original codelooks correct in isolation. It only breaks at model init inside the compiled
CLI.
Verification
bun run checkon this branch: 22 tests pass, build andtsc --emitDeclarationOnlyclean.End-to-end against a live CLIProxyAPI, using a capture proxy in front of
/v1to record requests:@opencode/ai/providers/openai-compatible/responses(before)Cannot find package '@opencode/ai'; onlyGET /v1/modelsrecorded@opencode/ai/providers/openai-compatible-responses@opencode/ai/providers/openai/responses(this PR)POST /v1/responsesrecordedConfirmed on two models (
gpt-6-luna,gemini-3.7-flash-high) through thepatched plugin, with
/v1/responsesreceiving the traffic.Notes
The Responses facade here is generic (
openai-compatible-responsesroutesemantics) rather than OpenAI-specific: it still uses the provider's own
baseURLand bearer token from plugin options, so nothing about the endpointbecomes OpenAI-only. The OpenAI
gpt-5*default options that come with thatfacade (
store: false,reasoning.encrypted_content) match CLIProxyAPI'sstateless Responses usage.