Skip to content

fix(usage): limit freetier --all to models with a valid free quota - #372

Open
pcbeingused33 wants to merge 1 commit into
modelstudioai:mainfrom
pcbeingused33:fix/freetier-all-valid-quota
Open

pcbeingused33 wants to merge 1 commit into
modelstudioai:mainfrom
pcbeingused33:fix/freetier-all-valid-quota

Conversation

@pcbeingused33

Copy link
Copy Markdown

Fixes #361

Root cause

bl usage freetier --all built its target list from the full model catalog (fetchAllModels), not from the free-tier models. Models are activated one at a time and the loop stops at the first failure. So when the catalog lists a model without a free quota before the real free-tier models, the server rejects it (for example TRAIN_UNSUPPORT_B) and nothing after it gets processed. That matches the report: one model succeeded, the next one had no free quota and failed, and the other free-tier models were never attempted.

Fix

When enabling auto-stop with --all, the catalog now goes through queryFreeTierQuota and keeps only the models that pass the same check bl usage free --all uses: quotaStatus === "VALID" and quotaInitTotal > 0. --model is unchanged. --off --all is also unchanged: it already skips models whose auto-stop is off, and a model whose quota has run out may still need auto-stop turned off.

Test

Added auto-stop --all enables only models with a valid free quota to packages/commands/tests/output/usage-output.test.ts. The catalog has a paid model plus a free-tier model, and only the free-tier one has a quota. Before the fix the paid model is sent to batchActivateFreeTierOnly. After the fix, only the free-tier model is sent. vp test packages/commands/tests/output/usage-output.test.ts: 178 passed. vp check: 0 errors.


This change was prepared with the help of an AI coding assistant; the fix and test were run locally before submitting.

`bl usage freetier --all` resolved its target list from the whole model
catalog, so enabling auto-stop hit models without a free quota first; the
server rejects those (e.g. TRAIN_UNSUPPORT_B) and the loop stops before
reaching the real free-tier models. Filter the catalog through the
free-tier quota API with the same VALID/initial-total check used by
`bl usage free --all`.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] usage freetier --all only targets 2 of 20 free-tier models (international site)

1 participant