fix: handle GPT-5.x models not supporting the stop API parameter#5144
Open
lucasgomide wants to merge 1 commit intomainfrom
Open
fix: handle GPT-5.x models not supporting the stop API parameter#5144lucasgomide wants to merge 1 commit intomainfrom
stop API parameter#5144lucasgomide wants to merge 1 commit intomainfrom
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
stop API parameter
f13d617 to
31f52ce
Compare
31f52ce to
0553210
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
0553210 to
73b6698
Compare
GPT-5.x models reject the `stop` parameter at the API level with "Unsupported parameter: 'stop' is not supported with this model". This breaks CrewAI executions when routing through LiteLLM (e.g. via
OpenAI-compatible gateways like Asimov), because the LiteLLM fallback path always includes `stop` in the API request params.
The native OpenAI provider was unaffected because it never sends `stop` to the API — it applies stop words client-side via `_apply_stop_words()`. However, when the request goes through LiteLLM (custom endpoints, proxy gateways),
`stop` is sent as an API parameter and GPT-5.x rejects it.
Additionally, the existing retry logic that catches this error only matched the OpenAI API error format ("Unsupported parameter") but missed
LiteLLM's own pre-validation error format ("does not support parameters"), so the self-healing retry never triggered for LiteLLM-routed calls.
73b6698 to
5ed8633
Compare
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.

Note
Medium Risk
Changes request parameter construction and retry logic for LiteLLM/OpenAI calls; incorrect model detection could alter stop-word behavior or truncation for some models.
Overview
Prevents GPT‑5 family models from receiving the unsupported
stopAPI parameter by gating it behindsupports_stop_words()in both the LiteLLM fallback (LLM._prepare_completion_params) and native OpenAI provider (OpenAICompletion.supports_stop_words).Improves the “retry without
stop” detection to also match LiteLLM’sUnsupportedParamsErrormessage format, and adds unit/integration coverage (including a VCR cassette) to ensure GPT‑5 calls succeed while still applying stop words client-side.Written by Cursor Bugbot for commit 5ed8633. This will update automatically on new commits. Configure here.