-
Notifications
You must be signed in to change notification settings - Fork 1
fix: improve ProviderModelNotFoundError with suggestion for OpenRouter models #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #135
…r models When users specify a model like "z-ai/glm-4.7" instead of "openrouter/z-ai/glm-4.7", the error message now includes a helpful suggestion if the model exists in another provider (like OpenRouter). Changes: - Added suggestion field to ModelNotFoundError schema - Modified getModel() to search for the model in other providers when provider not found - Updated error handler in index.js to include suggestion as a hint in error output - Added OpenRouter documentation to MODELS.md with examples and model format - Created case study documentation for issue #135 Example: Before: "ProviderModelNotFoundError" After: "ProviderModelNotFoundError" with hint "Did you mean: openrouter/z-ai/glm-4.7?" Fixes #135 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This reverts commit 5d2cdda.
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
|
🤖 AI Work Session Started Starting automated work session at 2026-01-26T10:14:02.533Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback. |
Resolved conflicts in MODELS.md by accepting the comprehensive OpenRouter documentation from main branch. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
Summary
This PR fixes issue #135 where users get a confusing
ProviderModelNotFoundErrorwhen using incorrect model format for OpenRouter models.Problem
User tried to use
agent --model z-ai/glm-4.7but the correct format isagent --model openrouter/z-ai/glm-4.7. The error message didn't provide any guidance on the correct format.Root Cause
The
parseModel()function splits on/, soz-ai/glm-4.7is parsed as:providerID:z-aimodelID:glm-4.7Since there's no provider named
z-ai(the provider isopenrouter), aProviderModelNotFoundErroris thrown.Solution
Improved Error Messages: When a provider is not found, the code now checks if the model exists in another provider and adds a helpful suggestion to the error output.
Files Changed
js/src/provider/provider.ts- Added suggestion field to error and model lookup logicjs/src/index.js- Pass suggestion as hint in error outputjs/.changeset/improve-provider-error-messages.md- Changeset for this fixNote: OpenRouter documentation was already added to the repository in the main branch.
Testing
Correct Usage
Fixes #135
🤖 Generated with Claude Code