fix(budget): reconcile #3691 and #3541 — free local providers are priceable at $0

#3691's regression test used llama-server as an 'unknown provider' example.
#3541 (same wave) prices ollama/llama-server at $0 via FREE_LOCAL_CHAT_PROVIDERS,
so that example is now priceable and the assertion inverted. Swapped in groq —
the paid-but-unpriced case #3691's own description cites — and added the
positive assertion that free local providers keep their cap enforced.
This commit is contained in:
Garry Tan
2026-08-01 07:40:48 +08:00
committed by Sina Matian
parent 4bb313cd80
commit ba27a186ec
+12 -1
View File
@@ -12,9 +12,20 @@ describe('isModelPriceable', () => {
expect(isModelPriceable('claude-haiku-4-5-20251001', 'chat')).toBe(true);
});
// NOTE: the examples here must be providers with genuinely unknown pricing.
// `ollama` and `llama-server` are NOT: they price at $0 via
// FREE_LOCAL_CHAT_PROVIDERS (local inference costs electricity, not tokens),
// so a cap against them is enforceable and must not be skipped. `litellm` is
// deliberately excluded from that set — a LiteLLM proxy can front a paid
// provider — and `groq` is the paid-but-unpriced case this regression bit.
test('unknown providers are not priceable, so a default cap must be skipped', () => {
expect(isModelPriceable('litellm:gemma4-12b', 'chat')).toBe(false);
expect(isModelPriceable('llama-server:local-model', 'chat')).toBe(false);
expect(isModelPriceable('groq:llama-3.3-70b', 'chat')).toBe(false);
});
test('free local providers ARE priceable at $0, so their cap stays enforced', () => {
expect(isModelPriceable('ollama:gemma3:27b', 'chat')).toBe(true);
expect(isModelPriceable('llama-server:local-model', 'chat')).toBe(true);
});
test('is a pure predicate — no throw on unusual model ids', () => {