mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-18 12:52:25 +03:00
Landed with the design call resolved per the owner's pick — **option 1**: the synced store is now endpoint-agnostic (persistDiscoveredModels and managedModelImport no longer drop non-chat models at write time), and chat selectability moved to read time (auto-pool expansion in autoStrategy applies filterChatSelectableModels; the models-route projection already had its chatOnly filter). Your discovery test now passes end-to-end (3/3): /api/show capabilities persist per connection and image/embedding requests route through the advertising host. Reconciliation notes: conflicted areas merged onto the current tip (adobe discovery import, requestedModel preflight signature, resolvedProvider fast-path coexists with the synced-route override — explicit resolution wins); carried base-red drains (#10055 memoization, #11071 test variants) dropped as already-landed; the managed-model-import exclusion test was propagated to the new contract (image/video models persist; the read filter still hides them from chat pickers — pinned by a new assertion). Full battery: 205/206 focused (the one red is a confirmed periodic-timer timing flake on the loaded devbox — 20/20 isolated), autoCombo vitest 30/30, combo suites 46/46, gates + typecheck clean. Thank you @yourspraveen — the capability probe + routing design was right; it just needed the store contract opened up. Fixes #11087.
43 lines
1.7 KiB
TypeScript
43 lines
1.7 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import {
|
|
FREE_TIER_BUDGETS,
|
|
FREE_TIER_TOS,
|
|
computeFreeTierTotals,
|
|
} from "../../open-sse/config/freeTierCatalog.ts";
|
|
|
|
test("FREE_TIER_BUDGETS holds positive integer monthly-token budgets", () => {
|
|
assert.ok(Object.keys(FREE_TIER_BUDGETS).length >= 19);
|
|
for (const [id, tokens] of Object.entries(FREE_TIER_BUDGETS)) {
|
|
assert.ok(Number.isInteger(tokens) && tokens > 0, `${id} must be a positive integer`);
|
|
}
|
|
assert.equal(FREE_TIER_BUDGETS.mistral, 1_000_000_000);
|
|
assert.equal(FREE_TIER_BUDGETS["cloudflare-ai"], 122_000_000);
|
|
assert.equal(FREE_TIER_BUDGETS.cerebras, 30_000_000);
|
|
// LongCat is excluded from this recurring-monthly catalog: its free tier is a
|
|
// one-time 10M-token signup grant (not recurring), so it must not appear here.
|
|
assert.equal(FREE_TIER_BUDGETS.longcat, undefined);
|
|
});
|
|
|
|
test("FREE_TIER_TOS marks proxy-prohibited providers as avoid", () => {
|
|
for (const id of ["kiro", "amazon-q", "blackbox", "fireworks"]) {
|
|
assert.equal(FREE_TIER_TOS[id], "avoid", `${id} must be flagged avoid`);
|
|
}
|
|
});
|
|
|
|
test("computeFreeTierTotals sums the documented budgets", () => {
|
|
const t = computeFreeTierTotals();
|
|
assert.equal(t.providerCount, 19);
|
|
assert.ok(t.documentedMonthlyTokens >= 1_350_000_000);
|
|
assert.ok(t.documentedMonthlyTokens <= 1_450_000_000);
|
|
assert.equal(typeof t.headline, "string");
|
|
assert.match(t.headline, /1\.3/);
|
|
});
|
|
|
|
test("computeFreeTierTotals can exclude ToS-avoid providers", () => {
|
|
const all = computeFreeTierTotals();
|
|
const clean = computeFreeTierTotals({ excludeTosAvoid: true });
|
|
assert.equal(all.documentedMonthlyTokens - clean.documentedMonthlyTokens, 25_000);
|
|
assert.equal(clean.providerCount, 18);
|
|
});
|