Skip to content

Commit 84c8f51

Browse files
suibianwanwanclaude
andcommitted
fix(llm): map all providers to correct @ai-sdk npm package
customProviderFromEntry only handled "openai-compatible", leaving "anthropic", "openai", "google", etc. with npm=undefined. This caused the fallback to @ai-sdk/openai-compatible for all non-clickzetta custom providers, sending /v1/chat/completions instead of the protocol-correct endpoint (e.g. /v1/messages for Anthropic). Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent e364de6 commit 84c8f51

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

packages/opencode/src/config/profiles-llm.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,17 @@ function customProviderFromEntry(entry: ParsedLlmEntry) {
301301
if (!entry.model) return undefined
302302
return {
303303
name: entry.name,
304-
npm: entry.provider === "openai-compatible" ? "@ai-sdk/openai-compatible" : undefined,
304+
npm: (
305+
{
306+
"anthropic": "@ai-sdk/anthropic",
307+
"openai": "@ai-sdk/openai",
308+
"openai-compatible": "@ai-sdk/openai-compatible",
309+
"google": "@ai-sdk/google",
310+
"azure": "@ai-sdk/azure",
311+
"bedrock": "@ai-sdk/amazon-bedrock",
312+
"openrouter": "@openrouter/ai-sdk-provider",
313+
} as Record<string, string>
314+
)[entry.provider] ?? "@ai-sdk/openai-compatible",
305315
api: entry.baseURL,
306316
env: [],
307317
models: {

0 commit comments

Comments
 (0)