From ac5d26b773e896e80e769f266d844d3335c436d2 Mon Sep 17 00:00:00 2001 From: Sahil Chouksey Date: Fri, 13 Feb 2026 19:37:19 +0530 Subject: [PATCH 1/3] fix(provider): force github-copilot models to use bundled SDK with /responses endpoint support Models like gpt-5.3-codex require the /responses endpoint, which only the bundled @ai-sdk/github-copilot SDK supports. Without this fix, config-defined models fall back to @ai-sdk/openai-compatible which lacks the responses() method, causing 'model not accessible via /chat/completions' errors. This override must run after config processing to catch user-defined models not present in models.dev. --- packages/opencode/src/provider/provider.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.ts index 44bcf8adb3de..1e0ecf3a33b5 100644 --- a/packages/opencode/src/provider/provider.ts +++ b/packages/opencode/src/provider/provider.ts @@ -837,6 +837,17 @@ export namespace Provider { database[providerID] = parsed } + // Force github-copilot models to use @ai-sdk/github-copilot instead of @ai-sdk/openai-compatible. + // Models like gpt-5.3-codex require the /responses endpoint, which only @ai-sdk/github-copilot supports. + // This must run after config processing to catch user-defined models not present in models.dev. + for (const providerID of ["github-copilot", "github-copilot-enterprise"]) { + if (database[providerID]) { + for (const model of Object.values(database[providerID].models)) { + model.api.npm = "@ai-sdk/github-copilot" + } + } + } + // load env const env = Env.all() for (const [providerID, provider] of Object.entries(database)) { From e73b7546f56cf531d07de8053b5625f195e0507f Mon Sep 17 00:00:00 2001 From: Sahil Chouksey Date: Fri, 13 Feb 2026 19:44:14 +0530 Subject: [PATCH 2/3] fix(plugin): allow opencode-copilot-auth plugin to load from config The opencode-copilot-auth npm plugin was being skipped by an explicit check, preventing users from using the external plugin with the correct GitHub App client ID (Iv1.b507a08c87ecfe98) needed for token exchange. This allows the external plugin to load and take precedence over the built-in plugin when specified in opencode.json config, enabling models like gpt-5.3-codex that require proper OAuth token exchange for the /responses endpoint. --- packages/opencode/src/plugin/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/src/plugin/index.ts b/packages/opencode/src/plugin/index.ts index 24dc695d6350..040dc11d783e 100644 --- a/packages/opencode/src/plugin/index.ts +++ b/packages/opencode/src/plugin/index.ts @@ -53,7 +53,7 @@ export namespace Plugin { for (let plugin of plugins) { // ignore old codex plugin since it is supported first party now - if (plugin.includes("opencode-openai-codex-auth") || plugin.includes("opencode-copilot-auth")) continue + if (plugin.includes("opencode-openai-codex-auth")) continue log.info("loading plugin", { path: plugin }) if (!plugin.startsWith("file://")) { const lastAtIndex = plugin.lastIndexOf("@") From 4240fed25d103b17653575717c0440009fa1233f Mon Sep 17 00:00:00 2001 From: Sahil Chouksey Date: Fri, 13 Feb 2026 22:39:46 +0530 Subject: [PATCH 3/3] fix(copilot): skip x-initiator override when using bundled SDK The @ai-sdk/github-copilot SDK has its own fetch wrapper that sets x-initiator based on message content. Overriding it in the chat.headers hook causes 'invalid initiator' validation errors from Copilot API when the message structure doesn't match the forced 'agent' initiator. --- packages/opencode/src/plugin/copilot.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/opencode/src/plugin/copilot.ts b/packages/opencode/src/plugin/copilot.ts index 39ea0d00d28e..041de1db2ab0 100644 --- a/packages/opencode/src/plugin/copilot.ts +++ b/packages/opencode/src/plugin/copilot.ts @@ -308,6 +308,11 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise { output.headers["anthropic-beta"] = "interleaved-thinking-2025-05-14" } + // Skip x-initiator override when using @ai-sdk/github-copilot - it has its own + // fetch wrapper that sets x-initiator based on message content, and overriding + // it here causes "invalid initiator" validation errors from Copilot API + if (incoming.model.api.npm === "@ai-sdk/github-copilot") return + const session = await sdk.session .get({ path: {