You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classify Go models as free when every configured base and 200K token rate is zero
keep free models on Go subscription billing without applying exhausted quota or balance fallback checks
Checks
bun typecheck (packages/console/app)
bun x prettier --check src/routes/zen/util/handler.ts
bun test (packages/console/app): 5 passed, 2 unrelated failures in existing Google usage normalization expectations (outputTokens expected 3, received 5)
AI code review — automated review for reference, author can ignore or act on any point.
The intent reads clearly: zero-cost Go models should stay on lite billing without hitting the exhausted-quota / balance-fallback checks below (packages/console/app/src/routes/zen/util/handler.ts, ~lines 911–916). A few things worth tightening:
Vacuous "free" classification.Object.values(modelInfo.cost).every((cost) => cost === 0) returns true when modelInfo.cost is an empty object {}. If a model can ever reach this path with missing/unset pricing, it gets classified as free and bypasses quota validation entirely. If that's possible in practice, guard with something like Object.keys(modelInfo.cost).length > 0 && ....
costPeak is not considered. The free check inspects cost and cost200K but ignores costPeak. A model with all-zero base rates but a nonzero peak rate would be treated as free while still being charged peak pricing on the usage path (~line 1049). Probably not reachable for current Go models, but folding (!modelInfo.costPeak || modelInfo.costPeak === 0) into the predicate makes the invariant explicit.
No test covers the new branch. The PR description lists existing suites passing, but nothing exercises the new classification. Consider extracting the predicate into a small exported helper (similar to the pricing.ts module pattern) so it can be unit-tested directly — e.g., free-with-200K-absent, free-with-zero-200K, non-free-with-nonzero-cost, and the empty-cost-object edge from point 1.
Confirm scope: returning "lite" skips both quota exhaustion and the balance fallback. That matches the title ("allow free Go models past quota"), just confirming it's also intended for workspaces with no balance at all, since these requests will now always succeed unmetered.
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
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
Checks
bun typecheck(packages/console/app)bun x prettier --check src/routes/zen/util/handler.tsbun test(packages/console/app): 5 passed, 2 unrelated failures in existing Google usage normalization expectations (outputTokensexpected 3, received 5)Requested by: @fwang (Frank via Slack)