fix(proxy): handle 404 with model-not-found guidance#1748
Merged
chrarnoldus merged 7 commits intomainfrom Mar 31, 2026
Merged
Conversation
After user BYOK error handling, return a helpful message when the upstream provider responds with 404, indicating the model does not exist or is no longer available. Recommends switching to kilo-auto/balanced, with explicit /model instructions for kiloclaw/openclaw users.
The 404 handler should apply to all users, not just BYOK users.
Contributor
Author
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Fix these issues in Kilo Cloud Other Observations (not in diff)N/A Files Reviewed (1 files)
Reviewed by gpt-5.4-20260305 · 116,430 tokens |
When the user has no credits, recommend kilo-auto/free instead of kilo-auto/balanced in the 404 model-not-found message.
BYOK users get a plain message pointing them to check the model name and their API provider, while non-BYOK users still get the auto model recommendation.
markijbema
approved these changes
Mar 31, 2026
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
When an upstream provider returns a 404 for a BYOK request, users previously received an opaque error. This change adds a dedicated handler in
makeErrorReadablethat tells the user the model does not exist or is no longer available, and recommends switching tokilo-auto/balanced. For KiloClaw/OpenClaw users, the message includes explicit/modelswitch instructions.Changes:
featureparameter tomakeErrorReadableto detect kiloclaw/openclaw clientsmakeErrorReadable(src/lib/llm-proxy-helpers.ts)src/app/api/openrouter/[...path]/route.tsto passfeatureVerification
FeatureValueandKILO_AUTO_BALANCED_MODELare already importednode_modules), but types are consistent with existing patternsVisual Changes
N/A
Reviewer Notes
byokErrorMessageslookup (401/402/403/429), so it only fires when no other BYOK-specific message matches first.forbiddenFreeModelResponsefor consistency.