Repository navigation
refactor(gateway): extract isFreeModel from models.ts - #3398
Merged
Merged
Conversation
models.ts is reachable from client bundles via constants like PRIMARY_DEFAULT_MODEL and preferredModels (imported by ModelCombobox.tsx, AutoFixConfigForm.tsx, OrganizationProvidersAndModelsPage.tsx, etc.). Future implementations of isFreeModel will need to consult server-only resources (e.g. a Redis-backed membership set), and folding those imports into models.ts would drag the relevant clients into client bundles. Move the function to its own apps/web/src/lib/ai-gateway/is-free-model.ts. No behavior change; body is identical. isOpenRouterStealthModel becomes exported so the new file can use it.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryClean extraction of Files Reviewed (8 files)
Fix these issues in Kilo Cloud Reviewed by claude-sonnet-4.6 · 207,477 tokens Review guidance: REVIEW.md from base branch |
RSO
approved these changes
May 21, 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
isFreeModelfromapps/web/src/lib/ai-gateway/models.tsinto a newapps/web/src/lib/ai-gateway/is-free-model.ts. No behavior change.models.tsis reachable from client bundles via constants likePRIMARY_DEFAULT_MODELandpreferredModels(imported byModelCombobox.tsx,AutoFixConfigForm.tsx,OrganizationProvidersAndModelsPage.tsx, etc.). Follow-up work needsisFreeModelto consult a Redis-backed membership set; doing that insidemodels.tswould drag the Redis client into client bundles and breaknext buildwithModule not found: 'net'/'tls'/'dns/promises'. Splitting now sets up a clean home for the function before that follow-up lands.isOpenRouterStealthModelis exported (was file-private) so the new module can use it.Verification
pnpm --filter web typecheckclean.pnpm --filter web test -- src/lib/ai-gateway/models.test.ts— 18/18 pass (test file's import ofisFreeModelwas updated to point at the new module).Visual Changes
N/A.
Reviewer Notes
route.ts,embeddings/route.ts,fim/completions/route.ts,processUsage.ts,agent-runner.ts,openrouter/index.ts).is-free-model.tswithout touching any client-reachable file.