feat(models,landing): add OpenRouter free models and a free-models article (#60)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Yaowei ZhengandClaude Fable 5 authored and GitHub committed 2026-07-26 15:05:44 +08:00
1 parent 6b8b631e37
commit 14b5e6384f
21 files changed
+477 -10

No files matched your search

+19
View File
@@ -15,6 +15,7 @@ import { MODEL_PROVIDERS } from "@prismshadow/penguin-core/model-catalog";
import {
groupModelRows,
hasConfiguredKey,
isFreeModel,
matchesQuery,
orderModelsLikeLibrary,
visibleChatModels,
@@ -252,3 +253,21 @@ describe("orderModelsLikeLibrary", () => {
]);
});
});
describe("isFreeModel", () => {
it("numeric buckets (the DTO shape): free ⇔ pricing exists and all three buckets are 0", () => {
expect(isFreeModel({ cacheRead: 0, cacheWrite: 0, output: 0 })).toBe(true);
expect(isFreeModel({ cacheRead: 0, cacheWrite: 0, output: 1.2 })).toBe(false);
expect(isFreeModel({ cacheRead: 0.5, cacheWrite: 6.25, output: 25 })).toBe(false);
// No pricing at all = costs merely unknown, not free.
expect(isFreeModel(undefined)).toBe(false);
});
it('string-typed edit fields (the model page\'s RowState shape): "" means unpriced, not $0', () => {
expect(isFreeModel({ cacheRead: "0", cacheWrite: "0", output: "0" })).toBe(true);
expect(isFreeModel({ cacheRead: "", cacheWrite: "", output: "" })).toBe(false);
// Partially filled pricing never counts as free.
expect(isFreeModel({ cacheRead: "0", cacheWrite: "", output: "0" })).toBe(false);
expect(isFreeModel({ cacheRead: "0", cacheWrite: "0", output: "3" })).toBe(false);
});
});