fix: improve OpenRouter model validation to support newer models #9598
+143
−8
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.
This PR attempts to address Issue #9597 where newer OpenRouter models (like gpt-5.1, gemini-3-pro-preview, and grok-4.1-fast:free) were being incorrectly marked as invalid after the model cache was populated.
Problem
The validation logic was too strict - it would reject any model not in the cached list when the cache had more than 1 model. This caused newer models to fail validation after a few minutes when the full model list was fetched.
Solution
>1to>10models before validation kicks in, preventing false negatives during initial cache populationopenai/gpt-5.1)google/gemini-3-pro-preview)x-ai/grok-4.1-fast:free)Testing
Fixes #9597
Feedback and guidance are welcome!
Important
Improve OpenRouter model validation by increasing threshold and adding pattern matching for newer models.
validate.ts, increase model validation threshold from>1to>10models to prevent false negatives.validateDynamicProviderModelId()to allow known formats (e.g.,openai/gpt-5.1,google/gemini-3-pro-preview).validate.spec.tsfor new validation logic, covering pattern matching and threshold changes.validate.test.tstovalidate.spec.tsfor consistency.validate.tsto usesettings:validationnamespace.This description was created by
for e3c1bc0. You can customize this summary. It will automatically update as commits are pushed.