Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | /**
* Monthly statements — `GET /app/statements` (svc-core
* `app/services/statements`). One workspace's calendar month (UTC) as
* figures: its spend and what governed it, aggregate only. A closed month is
* the statement written when it ended, kept unchanged; the month under way
* is a draft. See `docs/guides/cost-monitoring.md#monthly-statements`.
*/
export interface StatementPeriod {
/** `2026-10`. */
key: string;
/** "October 2026". */
label: string;
start: string;
end: string;
}
/** A group's figures: measured spend (null when nothing in it could be
* priced — unknown, never $0) and what budgets count it as. */
export interface StatementFigures {
spend_usd?: number | null;
counted_usd?: number | null;
unpriced_calls?: number;
decisions?: number;
calls?: number;
input_tokens?: number;
output_tokens?: number;
}
export interface StatementRow extends StatementFigures {
key: string;
label: string;
/** A project's cost centre, on the by-project table (schema 2). */
cost_centre?: string | null;
}
/** What the month comes to under the workspace's plan (svc-core
* `services/plans.py`): an estimate to invoice by hand, not an invoice. */
export interface StatementCharges {
title: string;
plan: {
kind: string;
currency: string;
fee_usd: number;
markup_percent: number;
included_usd: number;
};
currency: string;
fee_usd: number;
usage_usd: number;
included_usd: number;
usage_above_usd: number;
markup_percent: number;
usage_charge_usd: number;
total_usd: number;
/** Calls no catalogue could price: not charged. */
unpriced_calls: number;
note?: string | null;
}
export interface StatementTable {
title: string;
rows: StatementRow[];
}
export interface StatementBudget {
key: string;
label: string;
/** A cost cap, or the platform's allowance. */
kind: "rule" | "platform";
cap_usd?: number | null;
period?: string | null;
period_label?: string | null;
spent_usd?: number | null;
/** Turns it refused up front, stopped part-way, let through past it. */
refused: number;
stopped: number;
let_through: number;
}
export interface Statement {
schema_version: number;
workspace: {
key: string;
kind: string;
counts_projects: boolean;
/** As they stood when it was written (schema 2). */
name?: string | null;
cost_centre?: string | null;
};
period: StatementPeriod;
/** Written when the month closed, and kept unchanged. */
closed: boolean;
generated_at: string;
/** SHA-256 of the kept statement — a closed one only. */
content_sha256?: string | null;
spend: StatementFigures & {
failed_spend_usd?: number | null;
previous_month?: {
key: string;
spend_usd?: number | null;
counted_usd?: number | null;
} | null;
};
/** Set when the workspace has a plan (schema 2). */
charges?: StatementCharges | null;
by_source?: StatementTable | null;
by_agent?: StatementTable | null;
by_model?: StatementTable | null;
by_kind?: StatementTable | null;
by_project?: StatementTable | null;
daily: (StatementFigures & { date: string })[];
budgets: StatementBudget[];
governance: {
rules_in_force?: Record<string, number>;
rule_outcomes?: Record<string, number>;
};
reviews: {
raised?: number;
decided?: number;
decided_by_status?: Record<string, number>;
open_at_end?: number;
median_hours_to_decision?: number | null;
};
evaluations: { runs_completed?: number; regressions_caught?: number };
decisions: {
governed?: number;
verified?: number;
verdicts?: Record<string, number>;
corrections_captured?: number;
};
}
export interface StatementSummary {
period: StatementPeriod;
closed: boolean;
closed_at?: string | null;
spend_usd?: number | null;
counted_usd?: number | null;
decisions: number;
}
export interface StatementList {
workspace: string;
/** The month so far, as a draft. */
current: StatementSummary;
/** Closed months, newest first. */
closed: StatementSummary[];
}
|