fix(provider): split providerOptions key on dot for openai-compatible, openai, and anthropic providers#25145
Merged
rekram1-node merged 1 commit intoanomalyco:devfrom Apr 30, 2026
Conversation
… providers
The AI SDK's @ai-sdk/openai-compatible, @ai-sdk/openai, and
@ai-sdk/anthropic modules all resolve the providerOptions key by
splitting the provider name on '.' and taking the first segment:
get providerOptionsName() {
return this.config.provider.split('.')[0].trim();
}
This means a provider named 'wafer.ai' will look for options under
providerOptions['wafer'], NOT providerOptions['wafer.ai'].
However, opencode's providerOptions() in transform.ts uses the raw
providerID as the key when sdkKey() returns undefined (which it does
for @ai-sdk/openai-compatible):
const key = sdkKey(model.api.npm) ?? model.providerID
return { [key]: options }
For provider 'wafer.ai', this puts options under
providerOptions['wafer.ai'] - a key the SDK never reads. The result
is that provider options like { reasoningEffort: 'medium' } are
silently dropped. No reasoning_effort is sent in the API request,
so models like DeepSeek-V4-Pro return no reasoning_content.
@sdk/openai and @sdk/anthropic are also affected in principle, but
currently protected by their sdkKey() mappings (returning 'openai'
and 'anthropic' respectively). Those mappings are not guaranteed to
stay in sync, so the dot-split is applied to all three packages.
Other AI SDK packages (xai, mistral, groq, cohere, togetherai, etc.)
use hardcoded providerOptions keys like 'xai' or 'cohere' rather than
deriving them from the provider name - applying .split('.')[0] would
break those, so they are excluded.
Fix: for SDKs that use the providerOptionsName dot-split pattern,
apply the same logic here so the key we write matches the key they
read.
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate Found:
Current PR #25145 is the one being checked (not a duplicate of itself). |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Contributor
Author
|
This also closes Aforementioned PR only solves for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #23622
Type of change
What does this PR do?
Providers with dots in their ID (e.g.
wafer.ai) that use@ai-sdk/openai-compatible,@ai-sdk/openai, or@ai-sdk/anthropicnever have theirproviderOptionssent to the API. This silently breaks features likereasoningEffort- reasoning models return no thinking content.Three AI SDK packages resolve the
providerOptionskey by splitting the provider name on.:So
"wafer.ai"readsproviderOptions["wafer"], but opencode writesproviderOptions["wafer.ai"]- key mismatch, options silently dropped.@ai-sdk/openaiand@ai-sdk/anthropichave the same dot-split but are currently protected bysdkKey()mappings. Those mappings aren't guaranteed to stay in sync, so the fix covers all three.Other AI SDK packages (xai, mistral, groq, cohere, togetherai, etc.) use hardcoded keys like
"xai"- not derived from the provider name. Applying.split(".")[0]would break those, so they are excluded.Fix: apply the same dot-split for the three packages that use the
providerOptionsNamepattern:Regression analysis:
wafer.aihas a dot among all models.dev openai-compatible providers - all others unaffected@ai-sdk/openaiand@ai-sdk/anthropicare covered but currently protected bysdkKey()mappings anywayHow did you verify your code works?
Manually tested the change on a fork of OpenCode.
Screenshots / recordings
N/A
Checklist