You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(openai-compatible): honor camelCase providerOptions key in chat and completion models (#14135)
## Summary
Fixes#14105
The
[docs](https://ai-sdk.dev/providers/openai-compatible-providers#chat-model-options)
state that `providerOptions` keys should use camelCase (e.g.
`provider-name` → `providerName`), but chat and completion models only
looked up the raw provider name. The image model already had the correct
fallback behavior.
## Root Cause
When using `createOpenAICompatible({ name: 'provider-name' })`, the
image model merges both raw and camelCase keys:
```ts
// image model (correct)
...providerOptions[this.providerOptionsKey],
...providerOptions[toCamelCase(this.providerOptionsKey)],
```
But chat and completion models only checked the raw key:
```ts
// chat/completion (bug)
...providerOptions?.[this.providerOptionsName] // only raw key
```
This means `providerOptions.providerName` was ignored in chat/completion
while working in image.
## Fix
- Extracted `toCamelCase` into a shared module (`to-camel-case.ts`) used
by all three models
- Added camelCase key fallback in chat model (`parseProviderOptions` +
direct spread)
- Added camelCase key fallback in completion model (same pattern)
- Removed the local `toCamelCase` from image model (now uses shared
import)
The camelCase key takes precedence over the raw key (via `Object.assign`
ordering), matching the documented behavior.
## Changed Files
- `packages/openai-compatible/src/to-camel-case.ts` — new shared utility
-
`packages/openai-compatible/src/chat/openai-compatible-chat-language-model.ts`
— add camelCase fallback
-
`packages/openai-compatible/src/completion/openai-compatible-completion-language-model.ts`
— add camelCase fallback
-
`packages/openai-compatible/src/image/openai-compatible-image-model.ts`
— use shared import
---------
Co-authored-by: Aayush Kapoor <83492835+aayush-kapoor@users.noreply.github.com>
Co-authored-by: Aayush Kapoor <aayushkapoor34@gmail.com>
0 commit comments