-
Notifications
You must be signed in to change notification settings - Fork 4.1k
openai-compatible docs say providerOptions use camelCase, but chat/completion still require the raw provider name #14105
Description
Summary
The OpenAI Compatible Providers docs say:
Note that the providerOptions key will be in camelCase. If you set the provider name to provider-name, the options still need to be set on providerOptions.providerName.
However, in the currently published @ai-sdk/openai-compatible implementation, chat/completion appear to look up provider options by the raw provider name prefix, not a camelCased version of it.
Why this seems inconsistent
createOpenAICompatible({ name }) stores the raw provider name.
For chat/completion, the lookup path appears to be:
- provider name is derived from
config.provider.split('.')[0] parseProviderOptions(...)then checksproviderOptions?.[provider]exactly
Relevant source files in the published package:
src/chat/openai-compatible-chat-language-model.tssrc/completion/openai-compatible-completion-language-model.ts@ai-sdk/provider-utils/src/parse-provider-options.ts
In contrast, the image model explicitly merges both the raw key and toCamelCase(...), which suggests the current chat/completion behavior is not doing the same fallback.
Repro
const provider = createOpenAICompatible({
name: "provider-name",
baseURL: "https://api.example.com/v1",
apiKey: "dummy",
});
await generateText({
model: provider.chatModel("model-id"),
prompt: "hello",
providerOptions: {
providerName: {
reasoningEffort: "low",
},
},
});Expected from docs: providerOptions.providerName should be honored.
Observed from current published code: chat/completion appear to require providerOptions["provider-name"] instead.
Request
Could you clarify which behavior is intended?
Either:
- update chat/completion to honor the documented camelCase key behavior, or
- update the docs if the current exact raw-name lookup is the intended contract.
Thanks!