Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ and this project follows [Semantic Versioning](https://semver.org/).

## [Unreleased]

### Fixed

- Point the `responses` protocol at `@opencode/ai/providers/openai/responses`.
The previous `@opencode/ai/providers/openai-compatible/responses` path is not
part of OpenCode's bundled provider modules, so every request failed at model
init with `Cannot initialize <provider>/<model>: Cannot find package
'@opencode/ai' imported from /$bunfs/root/chunk-*.js`, even though the model
was listed in `/models`.

## [0.2.1] - 2026-09-16

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe("plugin", () => {
await plugin.setup(ctx)

expect(registered[0]?.info.package).toBe(
"@opencode/ai/providers/openai-compatible/responses",
"@opencode/ai/providers/openai/responses",
)
} finally {
globalThis.fetch = originalFetch
Expand Down
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ const DEFAULT_MODEL_METADATA_URL = "https://models.dev/api.json"
const DEFAULT_REFRESH_MS = 5 * 60_000

const CHAT_PACKAGE = "@opencode/ai/providers/openai-compatible"
const RESPONSES_PACKAGE = "@opencode/ai/providers/openai-compatible/responses"
// OpenCode resolves these package names from inside its own compiled bundle, not
// from `node_modules`. Only the subpaths the bundle itself contains can be
// imported, so Responses must use the OpenAI facade; the sibling
// `openai-compatible-responses` module (and the `openai-compatible/responses`
// subpath) are not bundled and fail at model init with `Cannot find package
// '@opencode/ai' imported from /$bunfs/root/chunk-*.js`.
const RESPONSES_PACKAGE = "@opencode/ai/providers/openai/responses"
const MESSAGES_PACKAGE = "@opencode/ai/providers/anthropic"
const ANTHROPIC_NPM = "@ai-sdk/anthropic"
const DEFAULT_ANTHROPIC_EFFORTS = ["low", "medium", "high"] as const
Expand Down
Loading