From ba27a186ec7553b4e3f6bac85e298f8a9dcb2b6d Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Sat, 1 Aug 2026 06:15:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(budget):=20reconcile=20#3691=20and=20#3541?= =?UTF-8?q?=20=E2=80=94=20free=20local=20providers=20are=20priceable=20at?= =?UTF-8?q?=20$0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #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. --- test/extract-atoms-unpriced-model.test.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/extract-atoms-unpriced-model.test.ts b/test/extract-atoms-unpriced-model.test.ts index e4d1d0a41..2ed0dd8dc 100644 --- a/test/extract-atoms-unpriced-model.test.ts +++ b/test/extract-atoms-unpriced-model.test.ts @@ -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', () => {