Skip to content

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

@zhuhaow

Description

@zhuhaow

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 checks providerOptions?.[provider] exactly

Relevant source files in the published package:

  • src/chat/openai-compatible-chat-language-model.ts
  • src/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:

  1. update chat/completion to honor the documented camelCase key behavior, or
  2. update the docs if the current exact raw-name lookup is the intended contract.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai/providerrelated to a provider package. Must be assigned together with at least one `provider/*` labelbugSomething isn't working as documentedprovider/openai-compatibleIssues related to the @ai-sdk/openai-compatible providerreproduction provided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions