Q63: model calls are priced and agent and department budgets limit real spend

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:08:38 -04:00
1 parent acbafcd6de
commit 168572dd76
21 files changed
+454 -12

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
export const spendSchema = `
alter table providers add column input_cents_per_mtok real;
alter table providers add column cached_input_cents_per_mtok real;
alter table providers add column output_cents_per_mtok real;
alter table provider_requests add column agent_id text references agents(id) on delete set null;
alter table provider_requests add column task_run_id text references task_runs(id) on delete set null;
alter table provider_requests add column department text;
alter table provider_requests add column input_tokens integer;
alter table provider_requests add column output_tokens integer;
alter table provider_requests add column cached_input_tokens integer;
alter table provider_requests add column reasoning_tokens integer;
alter table provider_requests add column cost_cents real;
create index if not exists idx_provider_requests_agent_created on provider_requests(agent_id, created_at);
insert into schema_migrations(version, name, applied_at)
values (72, 'spend', datetime('now'));
`;
+2
View File
@@ -70,6 +70,7 @@ import { taskReviewLinkSchema } from "./migrations/068-task-review-link";
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";
interface Migration {
version: number;
@@ -149,6 +150,7 @@ const MIGRATIONS: Migration[] = [
{ version: 69, name: "goal_stall", sql: goalStallSchema },
{ version: 70, name: "run_actions", sql: runActionsSchema },
{ version: 71, name: "background_poll_failures", sql: backgroundPollFailuresSchema },
{ version: 72, name: "spend", sql: spendSchema },
];
const SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1].version;