Skip to content

fix(openai-compatible): honor camelCase providerOptions key in chat and completion models#14135

Open
seojcarlos wants to merge 1 commit intovercel:mainfrom
seojcarlos:fix/openai-compatible-camelcase-provider-options
Open

fix(openai-compatible): honor camelCase providerOptions key in chat and completion models#14135
seojcarlos wants to merge 1 commit intovercel:mainfrom
seojcarlos:fix/openai-compatible-camelcase-provider-options

Conversation

@seojcarlos
Copy link
Copy Markdown

Summary

Fixes #14105

The docs state that providerOptions keys should use camelCase (e.g. provider-nameproviderName), 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:

// image model (correct)
...providerOptions[this.providerOptionsKey],
...providerOptions[toCamelCase(this.providerOptionsKey)],

But chat and completion models only checked the raw key:

// 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

…nd completion models

The docs state that providerOptions keys are camelCased (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.

This extracts the toCamelCase helper into a shared module and
adds the camelCase key fallback to both chat and completion
models, matching the existing image model pattern.

Fixes vercel#14105
@tigent tigent bot added ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label bug Something isn't working as documented provider/openai-compatible Issues related to the @ai-sdk/openai-compatible provider labels Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label bug Something isn't working as documented provider/openai-compatible Issues related to the @ai-sdk/openai-compatible provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

openai-compatible docs say providerOptions use camelCase, but chat/completion still require the raw provider name

1 participant