Repository navigation
fix: use max_completion_tokens for OpenAI connection tests and fix parameter error classification - #46
Merged
Conversation
…misclassifying parameter errors
…classification, and sampling
…back, and stream trim check
…essages, Grok sampling, and mid-stream errors
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.
Summary
buildConnectionTest): Sendmax_completion_tokens: 16instead ofmax_tokens: 1when testingopenai(/v1/chat/completions), since OpenAI deprecatedmax_tokensand rejects it with HTTP 400 (Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.) on reasoning and newer GPT-5+/GPT-6+ models (o1,o3,o4-mini,gpt-5*,gpt-6*).classifyConnectionFailure): Do not classify HTTP 400/422 parameter, capability, or context-length errors that mention"with this model"/"for this model"(or haveerror.codeunsupported_parameter/unsupported_valueorerror.param !== 'model') asproviderSetup.modelUnknown(field: 'model'). Genuine unknown/invalid model errors (status === 404,code === 'model_not_found',param === 'model',"model: ...","not a valid model ID", etc.) still highlight themodelfield.samplingOptions): Omittemperaturefor OpenAI reasoning and fixed-temperature models (o1*,o3*,o4*,codex*,gpt-4o*-search-preview*, andgpt-5*/gpt-6*+ exceptgpt-*-chat*, both direct andopenai/...on OpenRouter) so OpenRouter requests do not send unsupportedtemperaturevalues to OpenAI reasoning models and@ai-sdk/openaidoes not emit unsupported-temperature warnings on every call.isTokenLimitError): Excludeunsupported_parameter/unsupported_valuemessages fromTOKEN_LIMIT_PATTERNso an error mentioning'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.never triggers hierarchical summarization or content-truncation retries.Testing
pnpm checkpnpm test(653/653 passing)node tools/ui/flows.mjs --theme=light --only=popup-setup,popup-setup-models,popup-setup-models-failure,settings-model-missing