Q65: every call path records real tokens, cache, reasoning and cost

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-08 11:24:54 -04:00
1 parent 1367a8900e
commit c2f8e656f6
15 files changed
+187 -37

No files matched your search

@@ -0,0 +1,12 @@
export const usageWindowTokensSchema = `
alter table provider_usage_windows add column input_tokens integer not null default 0;
alter table provider_usage_windows add column output_tokens integer not null default 0;
alter table provider_usage_windows add column cached_input_tokens integer not null default 0;
alter table provider_usage_windows add column reasoning_tokens integer not null default 0;
alter table provider_usage_windows add column cost_cents real not null default 0;
alter table provider_usage_windows add column requests_without_usage integer not null default 0;
alter table provider_usage_windows add column unpriced_requests integer not null default 0;
insert into schema_migrations(version, name, applied_at)
values (73, 'usage_window_tokens', datetime('now'));
`;
+2
View File
@@ -71,6 +71,7 @@ import { goalStallSchema } from "./migrations/069-goal-stall";
import { runActionsSchema } from "./migrations/070-run-actions";
import { backgroundPollFailuresSchema } from "./migrations/071-background-poll-failures";
import { spendSchema } from "./migrations/072-spend";
import { usageWindowTokensSchema } from "./migrations/073-usage-window-tokens";
interface Migration {
version: number;
@@ -151,6 +152,7 @@ const MIGRATIONS: Migration[] = [
{ version: 70, name: "run_actions", sql: runActionsSchema },
{ version: 71, name: "background_poll_failures", sql: backgroundPollFailuresSchema },
{ version: 72, name: "spend", sql: spendSchema },
{ version: 73, name: "usage_window_tokens", sql: usageWindowTokensSchema },
];
const SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1].version;