Skip to content

Commit b7214e4

Browse files
committed
fix: cloudflare-ai-gateway sdk.chat undefined error
The @ai-sdk/openai-compatible SDK does not have a .chat() method - it only exposes .languageModel() and .chatModel(). This caused the error: sdk.chat is not a function. (In 'sdk.chat(modelID)', 'sdk.chat' is undefined) Change to use .languageModel() which is the standard method available on all AI SDK providers. Fixes anomalyco#4977
1 parent a89089c commit b7214e4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎packages/opencode/src/provider/provider.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ export namespace Provider {
371371
return {
372372
autoload: true,
373373
async getModel(sdk: any, modelID: string, _options?: Record<string, any>) {
374-
return sdk.chat(modelID)
374+
return sdk.languageModel(modelID)
375375
},
376376
options: {
377377
baseURL: `https://gateway.ai.cloudflare.com/v1/${accountId}/${gateway}/compat`,

0 commit comments

Comments
 (0)