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 {...@@ -4,7 +4,6 @@ import {
4 cacheSavingsUsd,4 cacheSavingsUsd,
5 createOverrideRateTable,5 createOverrideRateTable,
6 lookupRate,6 lookupRate,
7 normalizeModelName,
8 parseRateTable,7 parseRateTable,
9 priceUsage,8 priceUsage,
10} from "./usagePricing.ts";9} from "./usagePricing.ts";
...@@ -83,10 +82,6 @@ describe("usage pricing", () => {...@@ -83,10 +82,6 @@ describe("usage pricing", () => {
83 }82 }
84 });83 });
8584
86 it("keeps the existing model-name normalization contract", () => {
87 expect(normalizeModelName(" Anthropic/Claude-Opus-5 ")).toBe("claude-opus-5");
88 });
89
90 it("keeps the canonical Fable rate separate from DeepInfra in either order", () => {85 it("keeps the canonical Fable rate separate from DeepInfra in either order", () => {
91 const canonical = ["claude-fable-5", rate(1e-5, 1e-6)] as const;86 const canonical = ["claude-fable-5", rate(1e-5, 1e-6)] as const;
92 const deepInfra = ["deepinfra/anthropic/claude-fable-5", rate(1e-5)] as const;87 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 {...@@ -127,16 +127,6 @@ function normalizeRateKey(model: string): string {
127 return model.trim().toLowerCase();127 return model.trim().toLowerCase();
128}128}
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
140function bareModelName(key: string): string {130function bareModelName(key: string): string {
141 const slash = key.lastIndexOf("/");131 const slash = key.lastIndexOf("/");
142 return slash === -1 ? key : key.slice(slash + 1);132 return slash === -1 ? key : key.slice(slash + 1);