fix(provider): guard reasoningSummary injection for @ai-sdk/openai-compatible providers#22352
Conversation
@ai-sdk/openai-compatible proxies such as LiteLLM do not support the reasoningSummary parameter and return an error when it is present: Unknown parameter: 'reasoningSummary' The variants() function already correctly scopes reasoningSummary to @ai-sdk/openai, @ai-sdk/azure, and @ai-sdk/github-copilot. Apply the same guard in options() to be consistent. Fixes anomalyco#22350, anomalyco#21237, anomalyco#18882
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate PRs Found
These PRs address the same underlying problem of guarding provider-specific parameters like |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
clean fix thxx |
Issue for this PR
Closes #21237
Closes #18882
Type of change
What does this PR do?
The bug: When using
@ai-sdk/openai-compatibleprovider (e.g. LiteLLM proxy) with any GPT-5.x model, opencode injectsreasoningSummary: "auto"into every request. LiteLLM does not recognize this parameter and rejects the request:Why it happens: In
options()(transform.ts:835),reasoningSummaryis set unconditionally for any provider whosemodel.api.idcontains"gpt-5". Thevariants()function in the same file already correctly guardsreasoningSummarybehind a provider check — only setting it for@ai-sdk/openai,@ai-sdk/azure, and@ai-sdk/github-copilot. Theoptions()function lacks this guard.The fix: Apply the same provider check in
options()as already exists invariants().reasoningSummaryis now only injected for the three providers that translate it into the OpenAI Responses API format (reasoning.summary). For@ai-sdk/openai-compatible, the parameter is skipped entirely, which is correct — compatible proxies pass options directly in the request body without any translation.How did you verify your code works?
Reproduced the error locally using a LiteLLM proxy with
gpt-5.4configured as an@ai-sdk/openai-compatiblemodel. After this fix, the request succeeds without theUnknown parameter: 'reasoningSummary'error. Models on native@ai-sdk/openaicontinue to sendreasoningSummary: "auto"as before.Screenshots / recordings
N/A — no UI change
Checklist