refactor(server): remove test-only pricing normalizer (#10017)
This commit is contained in:
1 parent
3e544f8cda
commit
270e021f2a
2 files changed
-15
No files matched your search
@@ -4,7 +4,6 @@ import {
|
||||
cacheSavingsUsd,
|
||||
createOverrideRateTable,
|
||||
lookupRate,
|
||||
normalizeModelName,
|
||||
parseRateTable,
|
||||
priceUsage,
|
||||
} from "./usagePricing.ts";
|
||||
@@ -83,10 +82,6 @@ describe("usage pricing", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps the existing model-name normalization contract", () => {
|
||||
expect(normalizeModelName(" Anthropic/Claude-Opus-5 ")).toBe("claude-opus-5");
|
||||
});
|
||||
|
||||
it("keeps the canonical Fable rate separate from DeepInfra in either order", () => {
|
||||
const canonical = ["claude-fable-5", rate(1e-5, 1e-6)] as const;
|
||||
const deepInfra = ["deepinfra/anthropic/claude-fable-5", rate(1e-5)] as const;
|
||||
|
||||
@@ -127,16 +127,6 @@ function normalizeRateKey(model: string): string {
|
||||
return model.trim().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Canonicalises a model name for lookup.
|
||||
*
|
||||
* Strips a `provider/` prefix and lowercases, since transcripts are
|
||||
* inconsistent about casing.
|
||||
*/
|
||||
export function normalizeModelName(model: string): string {
|
||||
return bareModelName(normalizeRateKey(model));
|
||||
}
|
||||
|
||||
function bareModelName(key: string): string {
|
||||
const slash = key.lastIndexOf("/");
|
||||
return slash === -1 ? key : key.slice(slash + 1);
|
||||
|
||||
Reference in new issue
Block a user