@thinkai/tai-api-contract 2.240.0 → 2.242.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -242,6 +242,27 @@ export interface paths {
242
242
  patch?: never;
243
243
  trace?: never;
244
244
  };
245
+ "/admin/ecg-platform-cost/summary": {
246
+ parameters: {
247
+ query?: never;
248
+ header?: never;
249
+ path?: never;
250
+ cookie?: never;
251
+ };
252
+ /**
253
+ * ECG spend on ThinkAI-held keys (embeddings, rerank) by workspace
254
+ * @description Rolls up embedding and rerank usage that ThinkAI pays for (the platform keys, not the workspace's own model key) for the given UTC range, defaulting to the current UTC calendar month. Tokens are what the provider reported; calls where it reported nothing are estimated from the characters sent and counted in `estimatedCalls`. `byWorkspace` lists the highest-spending workspaces up to `workspaceLimit`; `otherWorkspaces` is the remainder, so the rows shown plus `otherWorkspaces` always equal `totals`. A deleted workspace's spend is kept and reported with a null workspace.
255
+ * **Authorization:** Bearer JWT required. Caller email must appear in `PLATFORM_ADMIN_EMAILS`. This is ThinkAI's cost and is never returned to workspace members.
256
+ */
257
+ get: operations["adminGetEcgPlatformCostSummary"];
258
+ put?: never;
259
+ post?: never;
260
+ delete?: never;
261
+ options?: never;
262
+ head?: never;
263
+ patch?: never;
264
+ trace?: never;
265
+ };
245
266
  "/admin/workspaces/{workspaceId}/automation-cost/budget": {
246
267
  parameters: {
247
268
  query?: never;
@@ -12864,10 +12885,16 @@ export interface components {
12864
12885
  sourceReconcile?: components["schemas"]["IngestCoverageSourceReconcileDto"] | null;
12865
12886
  dataTrust: components["schemas"]["DataTrustDto"];
12866
12887
  };
12888
+ /** @description ADR 006: dirty weeks waiting for repo-week facts to merge into tai_workspace_dashboard_metrics (Insights lag behind ledger fetch). */
12889
+ IngestCoverageMetricsRollupDto: {
12890
+ /** @description Number of workspace weeks with pending metrics rollup. */
12891
+ dirtyWeekCount: number;
12892
+ };
12867
12893
  IngestCoverageDto: {
12868
12894
  pipelines: components["schemas"]["IngestCoveragePipelineDto"][];
12869
12895
  /** Format: date-time */
12870
12896
  generatedAt?: string;
12897
+ metricsRollup?: components["schemas"]["IngestCoverageMetricsRollupDto"] | null;
12871
12898
  };
12872
12899
  IngestRunDto: {
12873
12900
  /** Format: uuid */
@@ -13090,6 +13117,45 @@ export interface components {
13090
13117
  estimatedSpendCents: number;
13091
13118
  invocationCount: number;
13092
13119
  };
13120
+ PlatformEcgSpendBucketDto: {
13121
+ /** Format: int64 */
13122
+ calls: number;
13123
+ /** Format: int64 */
13124
+ tokens: number;
13125
+ /**
13126
+ * Format: int64
13127
+ * @description Calls whose token count was estimated because the provider reported none.
13128
+ */
13129
+ estimatedCalls: number;
13130
+ };
13131
+ PlatformEcgSpendSummaryDto: {
13132
+ /** Format: date-time */
13133
+ from: string;
13134
+ /** Format: date-time */
13135
+ to: string;
13136
+ totals: components["schemas"]["PlatformEcgSpendBucketDto"];
13137
+ byKind: (components["schemas"]["PlatformEcgSpendBucketDto"] & {
13138
+ /** @enum {string} */
13139
+ kind: "embed" | "rerank";
13140
+ })[];
13141
+ byChannel: (components["schemas"]["PlatformEcgSpendBucketDto"] & {
13142
+ /** @enum {string} */
13143
+ channel: "web_chat" | "mcp" | "background";
13144
+ })[];
13145
+ /** @description Highest token spend first, at most `workspaceLimit` rows. */
13146
+ byWorkspace: (components["schemas"]["PlatformEcgSpendBucketDto"] & {
13147
+ /**
13148
+ * Format: uuid
13149
+ * @description Null for spend of a workspace that has since been deleted.
13150
+ */
13151
+ workspaceId: string | null;
13152
+ workspaceName: string | null;
13153
+ })[];
13154
+ /** @description Spend of the workspaces not listed in `byWorkspace`. */
13155
+ otherWorkspaces: components["schemas"]["PlatformEcgSpendBucketDto"] & {
13156
+ count: number;
13157
+ };
13158
+ };
13093
13159
  AutomationCostSummaryDto: {
13094
13160
  rows: components["schemas"]["AutomationCostSummaryRowDto"][];
13095
13161
  totals: components["schemas"]["AutomationCostSummaryTotalsDto"];
@@ -16223,6 +16289,7 @@ export type PutStrictInsightsOnTrustDto = components['schemas']['PutStrictInsigh
16223
16289
  export type InsightsStrictTrustHideNotifyDto = components['schemas']['InsightsStrictTrustHideNotifyDto'];
16224
16290
  export type InsightsStrictTrustHideNotifyResultDto = components['schemas']['InsightsStrictTrustHideNotifyResultDto'];
16225
16291
  export type IngestCoveragePipelineDto = components['schemas']['IngestCoveragePipelineDto'];
16292
+ export type IngestCoverageMetricsRollupDto = components['schemas']['IngestCoverageMetricsRollupDto'];
16226
16293
  export type IngestCoverageDto = components['schemas']['IngestCoverageDto'];
16227
16294
  export type IngestRunDto = components['schemas']['IngestRunDto'];
16228
16295
  export type IngestRunListDto = components['schemas']['IngestRunListDto'];
@@ -16249,6 +16316,8 @@ export type ActivityLogPageDto = components['schemas']['ActivityLogPageDto'];
16249
16316
  export type AutomationCostOperationDto = components['schemas']['AutomationCostOperationDto'];
16250
16317
  export type AutomationCostSummaryRowDto = components['schemas']['AutomationCostSummaryRowDto'];
16251
16318
  export type AutomationCostSummaryTotalsDto = components['schemas']['AutomationCostSummaryTotalsDto'];
16319
+ export type PlatformEcgSpendBucketDto = components['schemas']['PlatformEcgSpendBucketDto'];
16320
+ export type PlatformEcgSpendSummaryDto = components['schemas']['PlatformEcgSpendSummaryDto'];
16252
16321
  export type AutomationCostSummaryDto = components['schemas']['AutomationCostSummaryDto'];
16253
16322
  export type AutomationCostBudgetStatusDto = components['schemas']['AutomationCostBudgetStatusDto'];
16254
16323
  export type AutomationCostBudgetViewDto = components['schemas']['AutomationCostBudgetViewDto'];
@@ -17388,6 +17457,75 @@ export interface operations {
17388
17457
  };
17389
17458
  };
17390
17459
  };
17460
+ adminGetEcgPlatformCostSummary: {
17461
+ parameters: {
17462
+ query?: {
17463
+ /** @description Inclusive start (ISO-8601). Defaults to start of current UTC month. */
17464
+ from?: string;
17465
+ /** @description Exclusive end (ISO-8601). Defaults to end of current UTC month. The window may span at most 366 days. */
17466
+ to?: string;
17467
+ /** @description How many workspaces to list in `byWorkspace`. */
17468
+ workspaceLimit?: number;
17469
+ };
17470
+ header?: never;
17471
+ path?: never;
17472
+ cookie?: never;
17473
+ };
17474
+ requestBody?: never;
17475
+ responses: {
17476
+ /** @description Totals and splits (zeros and empty lists when nothing was spent). */
17477
+ 200: {
17478
+ headers: {
17479
+ [name: string]: unknown;
17480
+ };
17481
+ content: {
17482
+ "application/json": components["schemas"]["PlatformEcgSpendSummaryDto"];
17483
+ };
17484
+ };
17485
+ /** @description Unparseable date, backwards or over-wide window, or `workspaceLimit` out of range. */
17486
+ 400: {
17487
+ headers: {
17488
+ [name: string]: unknown;
17489
+ };
17490
+ content: {
17491
+ "application/json": components["schemas"]["ErrorMessageDto"];
17492
+ };
17493
+ };
17494
+ /** @description Missing or invalid JWT. */
17495
+ 401: {
17496
+ headers: {
17497
+ [name: string]: unknown;
17498
+ };
17499
+ content: {
17500
+ "application/json": components["schemas"]["ErrorMessageDto"];
17501
+ };
17502
+ };
17503
+ /** @description Caller is not a platform admin. */
17504
+ 403: {
17505
+ headers: {
17506
+ [name: string]: unknown;
17507
+ };
17508
+ content: {
17509
+ /**
17510
+ * @example {
17511
+ * "error": "Forbidden",
17512
+ * "code": "forbidden"
17513
+ * }
17514
+ */
17515
+ "application/json": components["schemas"]["ErrorMessageDto"];
17516
+ };
17517
+ };
17518
+ /** @description The batch database (`READINESS_DATABASE_URL`) is not configured on this API instance. */
17519
+ 503: {
17520
+ headers: {
17521
+ [name: string]: unknown;
17522
+ };
17523
+ content: {
17524
+ "application/json": components["schemas"]["ErrorMessageDto"];
17525
+ };
17526
+ };
17527
+ };
17528
+ };
17391
17529
  adminGetAutomationCostBudget: {
17392
17530
  parameters: {
17393
17531
  query?: {