Repository navigation
[AISAGE-707] refactor(ai-gateway): resolve custom LLMs by catalog lookup and fail closed - #7780
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe incremental commit only stubs the custom LLM catalog in the openrouter-models test suite, and the two stubbed exports cover every catalog symbol reachable from the routes under test. Overview
Files Reviewed (1 file)
Verification Notes
Previous Review Summaries (4 snapshots, latest commit 8e5271d)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 8e5271d)Status: No Issues Found | Recommendation: Merge Executive SummaryThe incremental commit makes every benchmark/Enkrypt publication path fail closed when the custom LLM catalog has never been read, and the changed lines introduce no new defects. Overview
Files Reviewed (8 files)
Verification Notes
Previous review (commit 522abb3)Status: 1 Issue Found | Recommendation: Address before merge Executive SummaryReplacing the static Overview
Issue Details (click to expand)WARNING
Files Reviewed (34 files)
Verification Notes
Fix these issues in Kilo Cloud Previous review (commit 5e10cc9)Status: No Issues Found | Recommendation: Merge Executive SummaryThe incremental change since the previous review only relocates the existing Files Reviewed (1 file)
Verification Notes
Previous review (commit 0cdea4d)Status: No Issues Found | Recommendation: Merge Executive SummaryReviewed the private-custom-LLM flag refactor across 8 files; verified that Files Reviewed (8 files)
Verification Notes
Reviewed by deepseek-v4.1-flash-1017 · Input: 47.3K · Output: 5.1K · Cached: 442.9K Review guidance: REVIEW.md from base branch |
… of the kilo-internal/ prefix
5e10cc9 to
e262c2d
Compare
…ones from model policy
Summary
Code no longer decides that a model is a custom LLM by checking whether its id starts with
kilo-internal/. It asks a custom LLM catalog instead, and that prefix is no longer required. Access to custom LLMs is also hardened ahead of the free/public behaviour in #7778 and #7291.Custom LLM catalog (
custom-llm/custom-llm-catalog.ts)custom_llm2rows, keyed by lowercased public id. Lookups usefindCustomLlmandisCustomLlm.getCustomLlmsByIdreturns an empty map when nothing could be read.requireCustomLlmsByIdthrows instead. Model stats publication uses it, so an unreadable catalog never exposes custom LLM scores.Routing fails closed
getProviderchecks the catalog first, before direct BYOK, ChatGPT and Vercel BYOK.custom-llm-unavailablewhen either:custom-llm-unavailablewith the same 404 as an unknown model id, so callers cannot probe for custom LLMs.Model policy exemption requires a grant
isModelRestrictionExemptnow takes aCustomLlmGrantee(an organization and the member's groups).organization_ids/group_ids. Otherwise organization and group model policy applies as for any model.EffectiveOrganizationModelPolicycarries the grantee from the policy context. The legacyModelRestrictionspath takes it as an optional field, and without one no custom LLM is exempt.Public id rules (admin editor and router)
kilo-internal/prefix is no longer required, andCUSTOM_LLM_PREFIXis removed.GatewayModelIdSchema).:or~, or start withkilo/,kilo-auto/,kilocode/or a direct BYOK provider prefix.Other prefix checks replaced
listAvailableCustomLlmscarryisCustomLlm: true. Auto-routing pool validation, the custom router dialog, the admin benchmark options, the default model dialog and the mode picker use the flag instead of the prefix.This is a prep PR for #7291.
Verification
Visual Changes
The admin Custom LLMs editor accepts ids without
kilo-internal/and shows the id rules. I took no screenshots.Reviewer Notes
custom_llm2rows from the replica.