fix: remove stream_options from xAI provider to fix Grok 4 API errors #6212
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.
Summary
This PR fixes API errors that occur when using the Grok 4 model by removing the
stream_optionsparameter from the xAI provider.Problem
Users reported that while Grok 3 works well, Grok 4 frequently encounters API errors that make it difficult to complete tasks. The issue was that the xAI provider was including
stream_options: { include_usage: true }in API requests, but Grok models do not support this parameter.Solution
stream_options: { include_usage: true }from theXAIHandler.createMessage()methodTesting
Related Issue
Fixes #6211
Important
Remove
stream_optionsfromXAIHandler.createMessage()to fix Grok 4 API errors and update tests accordingly.stream_options: { include_usage: true }fromXAIHandler.createMessage()inxai.tsto fix Grok 4 API errors.xai.tsexplaining Grok models don't supportstream_options.xai.spec.tsto reflect removal ofstream_optionsparameter.This description was created by
for dc45a26. You can customize this summary. It will automatically update as commits are pushed.