fix(usage): price Claude fast-mode requests at the fast rate (#13599)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Theo BrowneandClaude Opus 5.5 authored and GitHub committed 2026-09-25 00:58:13 -07:00
1 parent 86054b6df2
commit e3e7cc3fc2
8 files changed
+129 -38

No files matched your search

@@ -15,6 +15,7 @@ function claudeLine(overrides: {
contentType: string;
model?: string;
outputTokens?: number;
speed?: string;
}): string {
return JSON.stringify({
type: "assistant",
@@ -31,6 +32,7 @@ function claudeLine(overrides: {
cache_creation_input_tokens: 66818,
cache_read_input_tokens: 1000,
output_tokens: overrides.outputTokens ?? 286,
...(overrides.speed === undefined ? {} : { speed: overrides.speed }),
},
},
});
@@ -51,6 +53,15 @@ describe("parseClaudeLine", () => {
reasoningTokens: 0,
});
expect(record?.dedupeKey).toBe("msg_1:");
expect(record?.fast).toBe(false);
});
it("marks fast-mode requests", () => {
const line = (speed: string) =>
parseClaudeLine(claudeLine({ messageId: "msg_1", contentType: "text", speed }));
expect(line("fast")?.fast).toBe(true);
expect(line("standard")?.fast).toBe(false);
});
it("gives every content block of one message the same dedupe key", () => {