authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 00:28:52-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 00:28:52-07:00
log270e021f2a7ed34e3d81d1cdc9f1ca0c0ac85df4
tree21967370e56fbf31767ac1c2ced76724bc9816cf
parent3e544f8cda371dc565c806508a9ab38b80c96ff7
signature Signed by PGP key B5690EEEBB952194

refactor(server): remove test-only pricing normalizer (#10017)


2 files changed, 0 insertions(+), 15 deletions(-)

apps/server/src/usage/usagePricing.test.ts-5
......@@ -4,7 +4,6 @@ import {
44 cacheSavingsUsd,
55 createOverrideRateTable,
66 lookupRate,
7 normalizeModelName,
87 parseRateTable,
98 priceUsage,
109} from "./usagePricing.ts";
......@@ -83,10 +82,6 @@ describe("usage pricing", () => {
8382 }
8483 });
8584
86 it("keeps the existing model-name normalization contract", () => {
87 expect(normalizeModelName(" Anthropic/Claude-Opus-5 ")).toBe("claude-opus-5");
88 });
89
9085 it("keeps the canonical Fable rate separate from DeepInfra in either order", () => {
9186 const canonical = ["claude-fable-5", rate(1e-5, 1e-6)] as const;
9287 const deepInfra = ["deepinfra/anthropic/claude-fable-5", rate(1e-5)] as const;
apps/server/src/usage/usagePricing.ts-10
......@@ -127,16 +127,6 @@ function normalizeRateKey(model: string): string {
127127 return model.trim().toLowerCase();
128128}
129129
130/**
131 * Canonicalises a model name for lookup.
132 *
133 * Strips a `provider/` prefix and lowercases, since transcripts are
134 * inconsistent about casing.
135 */
136export function normalizeModelName(model: string): string {
137 return bareModelName(normalizeRateKey(model));
138}
139
140130function bareModelName(key: string): string {
141131 const slash = key.lastIndexOf("/");
142132 return slash === -1 ? key : key.slice(slash + 1);