Open
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge The PR adds a
The error handling is thorough, covering Files Reviewed (2 files)
|
Validates model ID against OpenRouter's /api/v1/models endpoint before
running any tasks. This prevents wasting compute on a full benchmark run
that will just score 0% because the model doesn't exist.
Features:
- Queries OpenRouter API to check if model exists
- Suggests close matches if model name looks like a typo
- Lists available models from the same provider as hints
- Gracefully skips validation if API key not set or API errors
- Exits with error code 1 immediately if model is invalid
Example output for typo:
❌ Model 'anthropic/claude-sonet-4' not found on OpenRouter.
Did you mean: anthropic/claude-sonnet-4?
1. Check specific model endpoint first (/api/v1/models/{id}) for fast path
- Only fetches full catalog when model not found (for suggestions)
- Reduces latency in happy path
2. Filter None values from model_ids set
- Prevents None from leaking into 'Did you mean' suggestions
4a4fdc6 to
31a714b
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.
Problem
Running a benchmark with a typo'd model name (e.g.
anthropic/claude-sonet-4instead ofclaude-sonnet-4) wastes a full benchmark run that just scores 0% on every task.Solution
Validate the model ID against OpenRouter's
/api/v1/modelsendpoint before running any tasks.Features
OPENROUTER_API_KEYnot set or API errorsExample Output
Or for completely wrong names: