mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-15 00:52:35 +00:00
fix(provider): split providerOptions key on dot for openai-compatible, openai, and anthropic providers (#25145)
This commit is contained in:
@@ -1058,7 +1058,20 @@ export function providerOptions(model: Provider.Model, options: { [x: string]: a
|
||||
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
|
||||
// providerOptions["openai"], but OpenAIResponsesLanguageModel checks
|
||||
// "azure" first. Pass both so model options work on either code path.
|
||||
|
||||
Reference in New Issue
Block a user