@thinkai/tai-api-contract 2.240.0 → 2.241.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;
@@ -13090,6 +13111,45 @@ export interface components {
13090
13111
  estimatedSpendCents: number;
13091
13112
  invocationCount: number;
13092
13113
  };
13114
+ PlatformEcgSpendBucketDto: {
13115
+ /** Format: int64 */
13116
+ calls: number;
13117
+ /** Format: int64 */
13118
+ tokens: number;
13119
+ /**
13120
+ * Format: int64
13121
+ * @description Calls whose token count was estimated because the provider reported none.
13122
+ */
13123
+ estimatedCalls: number;
13124
+ };
13125
+ PlatformEcgSpendSummaryDto: {
13126
+ /** Format: date-time */
13127
+ from: string;
13128
+ /** Format: date-time */
13129
+ to: string;
13130
+ totals: components["schemas"]["PlatformEcgSpendBucketDto"];
13131
+ byKind: (components["schemas"]["PlatformEcgSpendBucketDto"] & {
13132
+ /** @enum {string} */
13133
+ kind: "embed" | "rerank";
13134
+ })[];
13135
+ byChannel: (components["schemas"]["PlatformEcgSpendBucketDto"] & {
13136
+ /** @enum {string} */
13137
+ channel: "web_chat" | "mcp" | "background";
13138
+ })[];
13139
+ /** @description Highest token spend first, at most `workspaceLimit` rows. */
13140
+ byWorkspace: (components["schemas"]["PlatformEcgSpendBucketDto"] & {
13141
+ /**
13142
+ * Format: uuid
13143
+ * @description Null for spend of a workspace that has since been deleted.
13144
+ */
13145
+ workspaceId: string | null;
13146
+ workspaceName: string | null;
13147
+ })[];
13148
+ /** @description Spend of the workspaces not listed in `byWorkspace`. */
13149
+ otherWorkspaces: components["schemas"]["PlatformEcgSpendBucketDto"] & {
13150
+ count: number;
13151
+ };
13152
+ };
13093
13153
  AutomationCostSummaryDto: {
13094
13154
  rows: components["schemas"]["AutomationCostSummaryRowDto"][];
13095
13155
  totals: components["schemas"]["AutomationCostSummaryTotalsDto"];
@@ -16249,6 +16309,8 @@ export type ActivityLogPageDto = components['schemas']['ActivityLogPageDto'];
16249
16309
  export type AutomationCostOperationDto = components['schemas']['AutomationCostOperationDto'];
16250
16310
  export type AutomationCostSummaryRowDto = components['schemas']['AutomationCostSummaryRowDto'];
16251
16311
  export type AutomationCostSummaryTotalsDto = components['schemas']['AutomationCostSummaryTotalsDto'];
16312
+ export type PlatformEcgSpendBucketDto = components['schemas']['PlatformEcgSpendBucketDto'];
16313
+ export type PlatformEcgSpendSummaryDto = components['schemas']['PlatformEcgSpendSummaryDto'];
16252
16314
  export type AutomationCostSummaryDto = components['schemas']['AutomationCostSummaryDto'];
16253
16315
  export type AutomationCostBudgetStatusDto = components['schemas']['AutomationCostBudgetStatusDto'];
16254
16316
  export type AutomationCostBudgetViewDto = components['schemas']['AutomationCostBudgetViewDto'];
@@ -17388,6 +17450,75 @@ export interface operations {
17388
17450
  };
17389
17451
  };
17390
17452
  };
17453
+ adminGetEcgPlatformCostSummary: {
17454
+ parameters: {
17455
+ query?: {
17456
+ /** @description Inclusive start (ISO-8601). Defaults to start of current UTC month. */
17457
+ from?: string;
17458
+ /** @description Exclusive end (ISO-8601). Defaults to end of current UTC month. The window may span at most 366 days. */
17459
+ to?: string;
17460
+ /** @description How many workspaces to list in `byWorkspace`. */
17461
+ workspaceLimit?: number;
17462
+ };
17463
+ header?: never;
17464
+ path?: never;
17465
+ cookie?: never;
17466
+ };
17467
+ requestBody?: never;
17468
+ responses: {
17469
+ /** @description Totals and splits (zeros and empty lists when nothing was spent). */
17470
+ 200: {
17471
+ headers: {
17472
+ [name: string]: unknown;
17473
+ };
17474
+ content: {
17475
+ "application/json": components["schemas"]["PlatformEcgSpendSummaryDto"];
17476
+ };
17477
+ };
17478
+ /** @description Unparseable date, backwards or over-wide window, or `workspaceLimit` out of range. */
17479
+ 400: {
17480
+ headers: {
17481
+ [name: string]: unknown;
17482
+ };
17483
+ content: {
17484
+ "application/json": components["schemas"]["ErrorMessageDto"];
17485
+ };
17486
+ };
17487
+ /** @description Missing or invalid JWT. */
17488
+ 401: {
17489
+ headers: {
17490
+ [name: string]: unknown;
17491
+ };
17492
+ content: {
17493
+ "application/json": components["schemas"]["ErrorMessageDto"];
17494
+ };
17495
+ };
17496
+ /** @description Caller is not a platform admin. */
17497
+ 403: {
17498
+ headers: {
17499
+ [name: string]: unknown;
17500
+ };
17501
+ content: {
17502
+ /**
17503
+ * @example {
17504
+ * "error": "Forbidden",
17505
+ * "code": "forbidden"
17506
+ * }
17507
+ */
17508
+ "application/json": components["schemas"]["ErrorMessageDto"];
17509
+ };
17510
+ };
17511
+ /** @description The batch database (`READINESS_DATABASE_URL`) is not configured on this API instance. */
17512
+ 503: {
17513
+ headers: {
17514
+ [name: string]: unknown;
17515
+ };
17516
+ content: {
17517
+ "application/json": components["schemas"]["ErrorMessageDto"];
17518
+ };
17519
+ };
17520
+ };
17521
+ };
17391
17522
  adminGetAutomationCostBudget: {
17392
17523
  parameters: {
17393
17524
  query?: {