mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-14 19:02:17 +03:00
Validado em lote numa worktree combinada com #12524, #12538, #12277 e #12367 sobre o tip de release/v3.8.51: os quatro boardaram sem conflito (áreas disjuntas — zai-web, nvidia, clova, cursor/devin/fable). typecheck:core limpo, check:provider-consistency OK (272 entradas REGISTRY, 355 providers canônicos), check:known-symbols OK, e 305/305 nos testes tocados pelos quatro PRs. Os IDs de modelo adicionados foram conferidos individualmente. Obrigado, @backryun.
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import { getModelPricing, KNOWN_MODEL_PRICING } from "../../open-sse/services/providerCostData.ts";
|
|
|
|
test("provider-specific pricing wins over a generic model fallback", () => {
|
|
const genericKey = "provider-price-test-model";
|
|
const providerKey = `devin-cli/${genericKey}`;
|
|
const previousGeneric = KNOWN_MODEL_PRICING[genericKey];
|
|
const previousProvider = KNOWN_MODEL_PRICING[providerKey];
|
|
|
|
KNOWN_MODEL_PRICING[genericKey] = {
|
|
inputCostPer1M: 9,
|
|
outputCostPer1M: 90,
|
|
isFree: false,
|
|
};
|
|
KNOWN_MODEL_PRICING[providerKey] = {
|
|
inputCostPer1M: 1,
|
|
outputCostPer1M: 10,
|
|
isFree: false,
|
|
};
|
|
|
|
try {
|
|
assert.deepEqual(getModelPricing("devin-cli", genericKey), {
|
|
inputCostPer1M: 1,
|
|
outputCostPer1M: 10,
|
|
isFree: false,
|
|
});
|
|
} finally {
|
|
if (previousGeneric) KNOWN_MODEL_PRICING[genericKey] = previousGeneric;
|
|
else delete KNOWN_MODEL_PRICING[genericKey];
|
|
if (previousProvider) KNOWN_MODEL_PRICING[providerKey] = previousProvider;
|
|
else delete KNOWN_MODEL_PRICING[providerKey];
|
|
}
|
|
});
|
|
|
|
test("tier pricing reads the exact Devin provider/model rate", () => {
|
|
assert.deepEqual(getModelPricing("devin-cli", "gpt-5-6-luna-max"), {
|
|
inputCostPer1M: 0.2,
|
|
outputCostPer1M: 1.2,
|
|
isFree: false,
|
|
});
|
|
assert.deepEqual(getModelPricing("devin-cli", "gpt-5-6-luna-max-priority"), {
|
|
inputCostPer1M: 0.4,
|
|
outputCostPer1M: 2.4,
|
|
isFree: false,
|
|
});
|
|
});
|