|
@@ -1058,7 +1058,20 @@ export function providerOptions(model: Provider.Model, options: { [x: string]: a
|
|
|
return result
|
|
return result
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const key = sdkKey(model.api.npm) ?? model.providerID
|
|
|
|
|
|
|
+ // AI SDK packages that resolve providerOptionsName by splitting the
|
|
|
|
|
+ // provider name on "." (e.g. "wafer.ai" -> "wafer") need the same
|
|
|
|
|
+ // logic here so the key we write matches the key they read.
|
|
|
|
|
+ // Other SDKs (xai, mistral, groq, cohere, etc.) use hardcoded keys
|
|
|
|
|
+ // like "xai" or "cohere" - applying .split(".")[0] would break those.
|
|
|
|
|
+ const usesDotSplitOptions =
|
|
|
|
|
+ model.api.npm === "@ai-sdk/openai-compatible" ||
|
|
|
|
|
+ model.api.npm === "@ai-sdk/openai" ||
|
|
|
|
|
+ model.api.npm === "@ai-sdk/anthropic"
|
|
|
|
|
+ const key =
|
|
|
|
|
+ sdkKey(model.api.npm) ??
|
|
|
|
|
+ (usesDotSplitOptions
|
|
|
|
|
+ ? model.providerID.split(".")[0]
|
|
|
|
|
+ : model.providerID)
|
|
|
// @ai-sdk/azure delegates to OpenAIChatLanguageModel which reads from
|
|
// @ai-sdk/azure delegates to OpenAIChatLanguageModel which reads from
|
|
|
// providerOptions["openai"], but OpenAIResponsesLanguageModel checks
|
|
// providerOptions["openai"], but OpenAIResponsesLanguageModel checks
|
|
|
// "azure" first. Pass both so model options work on either code path.
|
|
// "azure" first. Pass both so model options work on either code path.
|