fix(groq): add dedicated @ai-sdk/groq provider to avoid reasoning_content errors#13735
Merged
GeorgeDong32 merged 1 commit intomainfrom Mar 23, 2026
Merged
fix(groq): add dedicated @ai-sdk/groq provider to avoid reasoning_content errors#13735GeorgeDong32 merged 1 commit intomainfrom
GeorgeDong32 merged 1 commit intomainfrom
Conversation
…tent errors Groq rejects `reasoning_content` in assistant messages, which the OpenAI-compatible provider sends by default in AI SDK v6. Switch Groq to use the dedicated @ai-sdk/groq provider so the SDK properly handles Groq's message format on multi-turn conversations. Closes #12327 Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: suyao <[email protected]>
eeee0717
approved these changes
Mar 23, 2026
EurFelux
approved these changes
Mar 23, 2026
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.
What this PR does
Before this PR:
Groq uses the OpenAI-compatible provider (
type: 'openai'). In AI SDK v6, the OpenAI provider sendsreasoning_contentin assistant messages by default, which Groq's API rejects on multi-turn conversations.After this PR:
Groq uses the dedicated
@ai-sdk/groqprovider, which properly handles Groq's message format and does not send unsupported fields likereasoning_content.Fixes #12327
Why we need it and why it was done in this way
The following tradeoffs were made:
Added
@ai-sdk/groqas a new dependency (~small bundle impact via dynamic import).The following alternatives were considered:
reasoning_contentfrom messages before sending to Groq — fragile and would need to be maintained as message format evolves.@ai-sdk/groqprovider (chosen) — the SDK handles Groq's API format natively, consistent with how other providers (Anthropic, Google, DeepSeek, etc.) have dedicated packages.Breaking changes
None.
Special notes for your reviewer
providerInitialization.ts(lazy-loaded), consistent with other non-core providers like Mistral, Cerebras, Perplexity.groq: 'groq'is added infactory.tsto ensure the provider ID resolves to the dedicated provider instead of falling through to OpenAI compatible.Checklist
Release note