@thinkai/tai-api-contract 2.53.0 → 2.54.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.
@@ -1,7 +1,7 @@
1
1
  openapi: 3.0.3
2
2
  info:
3
3
  title: ThinkAI API
4
- version: 2.53.0
4
+ version: 2.54.0
5
5
  description: >
6
6
  Contract surface for the AI Driven SDLC backend used by ThinkAI.
7
7
  Workspace-scoped routes use `/workspaces/{workspaceId}/...`.
@@ -2216,7 +2216,16 @@ paths:
2216
2216
  in: query
2217
2217
  description: >
2218
2218
  Org-chart team id — aggregate engagement for members mapped to that team
2219
- (team detail pages). Mutually exclusive with `memberExternalId`.
2219
+ (team detail pages). Mutually exclusive with `memberExternalId` and
2220
+ `scopeExternalIds`.
2221
+ schema:
2222
+ type: string
2223
+ - name: scopeExternalIds
2224
+ in: query
2225
+ description: >
2226
+ Comma-separated AI-tool member external IDs — aggregate engagement for
2227
+ exactly those seats (team detail when scoped via slim reads). Mutually
2228
+ exclusive with `memberExternalId` and `scopeTeamId`.
2220
2229
  schema:
2221
2230
  type: string
2222
2231
  - name: provider
@@ -2479,6 +2488,20 @@ paths:
2479
2488
  type: string
2480
2489
  enum: [4w, 8w, q]
2481
2490
  default: 4w
2491
+ - name: from
2492
+ in: query
2493
+ schema:
2494
+ type: string
2495
+ format: date
2496
+ description: >
2497
+ Inclusive start day (YYYY-MM-DD). When set with `to`, overrides `rangeId` calendar
2498
+ buckets for the aggregation window.
2499
+ - name: to
2500
+ in: query
2501
+ schema:
2502
+ type: string
2503
+ format: date
2504
+ description: Inclusive end day (YYYY-MM-DD). Requires `from`.
2482
2505
  - name: windowEnd
2483
2506
  in: query
2484
2507
  schema:
@@ -2552,6 +2575,18 @@ paths:
2552
2575
  type: string
2553
2576
  enum: [4w, 8w, q]
2554
2577
  default: 4w
2578
+ - name: from
2579
+ in: query
2580
+ schema:
2581
+ type: string
2582
+ format: date
2583
+ description: Inclusive start day (YYYY-MM-DD). When set with `to`, overrides `rangeId`.
2584
+ - name: to
2585
+ in: query
2586
+ schema:
2587
+ type: string
2588
+ format: date
2589
+ description: Inclusive end day (YYYY-MM-DD). Requires `from`.
2555
2590
  - name: windowEnd
2556
2591
  in: query
2557
2592
  schema:
@@ -2608,6 +2643,18 @@ paths:
2608
2643
  type: string
2609
2644
  enum: [4w, 8w, q]
2610
2645
  default: 4w
2646
+ - name: from
2647
+ in: query
2648
+ schema:
2649
+ type: string
2650
+ format: date
2651
+ description: Inclusive start day (YYYY-MM-DD). When set with `to`, overrides `rangeId`.
2652
+ - name: to
2653
+ in: query
2654
+ schema:
2655
+ type: string
2656
+ format: date
2657
+ description: Inclusive end day (YYYY-MM-DD). Requires `from`.
2611
2658
  - name: windowEnd
2612
2659
  in: query
2613
2660
  schema:
@@ -3230,6 +3277,176 @@ paths:
3230
3277
  "403":
3231
3278
  $ref: "#/components/responses/Forbidden"
3232
3279
 
3280
+ /workspaces/{workspaceId}/integrations/ai-tool/{provider}/summary:
3281
+ get:
3282
+ tags: [Integrations]
3283
+ summary: AI-tool provider summary for a date window
3284
+ description: >
3285
+ Pre-aggregated spend, token, and active-user totals plus weekly buckets for the
3286
+ AI Usage & Spend overview. Replaces downloading the full `/snapshot` payload for
3287
+ KPI cards and sparklines.
3288
+ operationId: getWorkspaceAiToolProviderSummary
3289
+ parameters:
3290
+ - $ref: "#/components/parameters/WorkspaceId"
3291
+ - name: provider
3292
+ in: path
3293
+ required: true
3294
+ schema:
3295
+ type: string
3296
+ enum: [cursor, claude]
3297
+ - name: from
3298
+ in: query
3299
+ required: true
3300
+ schema:
3301
+ type: string
3302
+ format: date
3303
+ - name: to
3304
+ in: query
3305
+ required: true
3306
+ schema:
3307
+ type: string
3308
+ format: date
3309
+ responses:
3310
+ "200":
3311
+ description: Provider summary
3312
+ content:
3313
+ application/json:
3314
+ schema:
3315
+ $ref: "#/components/schemas/AiToolProviderSummaryDto"
3316
+ "400":
3317
+ description: Invalid query
3318
+ content:
3319
+ application/json:
3320
+ schema:
3321
+ type: object
3322
+ required: [error]
3323
+ properties:
3324
+ error: { type: string, example: invalid_query }
3325
+ "401":
3326
+ $ref: "#/components/responses/Unauthorized"
3327
+ "403":
3328
+ $ref: "#/components/responses/Forbidden"
3329
+
3330
+ /workspaces/{workspaceId}/integrations/ai-tool/{provider}/daily-series:
3331
+ get:
3332
+ tags: [Integrations]
3333
+ summary: AI-tool daily spend and usage series for charts
3334
+ description: >
3335
+ Daily chart points (spend and tokens) with optional product/model breakdown.
3336
+ Scoped to the requested date window; intended for the overview trend chart.
3337
+ operationId: getWorkspaceAiToolProviderDailySeries
3338
+ parameters:
3339
+ - $ref: "#/components/parameters/WorkspaceId"
3340
+ - name: provider
3341
+ in: path
3342
+ required: true
3343
+ schema:
3344
+ type: string
3345
+ enum: [cursor, claude]
3346
+ - name: from
3347
+ in: query
3348
+ required: true
3349
+ schema:
3350
+ type: string
3351
+ format: date
3352
+ - name: to
3353
+ in: query
3354
+ required: true
3355
+ schema:
3356
+ type: string
3357
+ format: date
3358
+ - name: externalId
3359
+ in: query
3360
+ required: false
3361
+ schema:
3362
+ type: array
3363
+ items:
3364
+ type: string
3365
+ style: form
3366
+ explode: true
3367
+ description: >
3368
+ Optional member external IDs. When set, the series includes only those members
3369
+ (team drill-down, user detail). Repeat the parameter or pass comma-separated values.
3370
+ responses:
3371
+ "200":
3372
+ description: Daily series
3373
+ content:
3374
+ application/json:
3375
+ schema:
3376
+ $ref: "#/components/schemas/AiToolDailySeriesDto"
3377
+ "400":
3378
+ description: Invalid query
3379
+ content:
3380
+ application/json:
3381
+ schema:
3382
+ type: object
3383
+ required: [error]
3384
+ properties:
3385
+ error: { type: string, example: invalid_query }
3386
+ "401":
3387
+ $ref: "#/components/responses/Unauthorized"
3388
+ "403":
3389
+ $ref: "#/components/responses/Forbidden"
3390
+
3391
+ /workspaces/{workspaceId}/integrations/ai-tool/{provider}/model-breakdown:
3392
+ get:
3393
+ tags: [Integrations]
3394
+ summary: AI-tool model spend rollup for a date window
3395
+ description: >
3396
+ Aggregated spend and token totals per LLM model for the Costs by LLM Model page
3397
+ and team drill-downs. Optionally scoped to specific member external IDs.
3398
+ operationId: getWorkspaceAiToolProviderModelBreakdown
3399
+ parameters:
3400
+ - $ref: "#/components/parameters/WorkspaceId"
3401
+ - name: provider
3402
+ in: path
3403
+ required: true
3404
+ schema:
3405
+ type: string
3406
+ enum: [cursor, claude]
3407
+ - name: from
3408
+ in: query
3409
+ required: true
3410
+ schema:
3411
+ type: string
3412
+ format: date
3413
+ - name: to
3414
+ in: query
3415
+ required: true
3416
+ schema:
3417
+ type: string
3418
+ format: date
3419
+ - name: externalId
3420
+ in: query
3421
+ required: false
3422
+ schema:
3423
+ type: array
3424
+ items:
3425
+ type: string
3426
+ style: form
3427
+ explode: true
3428
+ description: Optional member external IDs to scope the rollup (org/team filter).
3429
+ responses:
3430
+ "200":
3431
+ description: Model breakdown
3432
+ content:
3433
+ application/json:
3434
+ schema:
3435
+ $ref: "#/components/schemas/AiToolModelBreakdownDto"
3436
+ "400":
3437
+ description: Invalid query
3438
+ content:
3439
+ application/json:
3440
+ schema:
3441
+ type: object
3442
+ required: [error]
3443
+ properties:
3444
+ error: { type: string, example: invalid_query }
3445
+ "401":
3446
+ $ref: "#/components/responses/Unauthorized"
3447
+ "403":
3448
+ $ref: "#/components/responses/Forbidden"
3449
+
3233
3450
  /workspaces/{workspaceId}/integrations/ai-tool/{provider}/status:
3234
3451
  get:
3235
3452
  tags: [Integrations]
@@ -8695,6 +8912,239 @@ components:
8695
8912
  items:
8696
8913
  $ref: "#/components/schemas/AiUsageSpendUsageTrendsWeekDto"
8697
8914
 
8915
+ AiToolProviderSummaryWeekBucketDto:
8916
+ type: object
8917
+ additionalProperties: false
8918
+ required: [weekLabel, spendCents, tokenCount, activeUsers]
8919
+ properties:
8920
+ weekLabel:
8921
+ type: string
8922
+ spendCents:
8923
+ type: integer
8924
+ minimum: 0
8925
+ tokenCount:
8926
+ type: integer
8927
+ minimum: 0
8928
+ activeUsers:
8929
+ type: integer
8930
+ minimum: 0
8931
+
8932
+ AiToolProviderSummaryTopMoverDto:
8933
+ type: object
8934
+ additionalProperties: false
8935
+ required: [externalId, label, deltaSpendCents, currentSpendCents]
8936
+ properties:
8937
+ externalId:
8938
+ type: string
8939
+ label:
8940
+ type: string
8941
+ deltaSpendCents:
8942
+ type: integer
8943
+ currentSpendCents:
8944
+ type: integer
8945
+ minimum: 0
8946
+
8947
+ AiToolProviderSummaryDto:
8948
+ type: object
8949
+ additionalProperties: false
8950
+ required:
8951
+ - provider
8952
+ - from
8953
+ - to
8954
+ - seatCounts
8955
+ - totals
8956
+ - weekBuckets
8957
+ - generatedAt
8958
+ properties:
8959
+ provider:
8960
+ type: string
8961
+ from:
8962
+ type: string
8963
+ format: date
8964
+ to:
8965
+ type: string
8966
+ format: date
8967
+ status:
8968
+ $ref: "#/components/schemas/AiToolRefreshStatusDto"
8969
+ seatCounts:
8970
+ type: object
8971
+ additionalProperties: false
8972
+ required: [total, active, removed]
8973
+ properties:
8974
+ total:
8975
+ type: integer
8976
+ minimum: 0
8977
+ active:
8978
+ type: integer
8979
+ minimum: 0
8980
+ removed:
8981
+ type: integer
8982
+ minimum: 0
8983
+ totals:
8984
+ type: object
8985
+ additionalProperties: false
8986
+ required: [spendCents, tokenCount, activeUsers, totalEngineers]
8987
+ properties:
8988
+ spendCents:
8989
+ type: integer
8990
+ minimum: 0
8991
+ tokenCount:
8992
+ type: integer
8993
+ minimum: 0
8994
+ activeUsers:
8995
+ type: integer
8996
+ minimum: 0
8997
+ totalEngineers:
8998
+ type: integer
8999
+ minimum: 0
9000
+ weekBuckets:
9001
+ type: array
9002
+ items:
9003
+ $ref: "#/components/schemas/AiToolProviderSummaryWeekBucketDto"
9004
+ topMovers:
9005
+ type: array
9006
+ items:
9007
+ $ref: "#/components/schemas/AiToolProviderSummaryTopMoverDto"
9008
+ hasTokenMetrics:
9009
+ type: boolean
9010
+ generatedAt:
9011
+ type: string
9012
+ format: date-time
9013
+
9014
+ AiToolDailySeriesPointDto:
9015
+ type: object
9016
+ additionalProperties: false
9017
+ required: [day, label, spendCents, tokenCount, products, models]
9018
+ properties:
9019
+ day:
9020
+ type: string
9021
+ format: date
9022
+ label:
9023
+ type: string
9024
+ spendCents:
9025
+ type: integer
9026
+ minimum: 0
9027
+ tokenCount:
9028
+ type: integer
9029
+ minimum: 0
9030
+ products:
9031
+ type: object
9032
+ additionalProperties:
9033
+ type: integer
9034
+ minimum: 0
9035
+ description: Spend cents by product label.
9036
+ models:
9037
+ type: object
9038
+ additionalProperties:
9039
+ type: integer
9040
+ minimum: 0
9041
+ description: Spend cents by model name.
9042
+
9043
+ AiToolDailySeriesDto:
9044
+ type: object
9045
+ additionalProperties: false
9046
+ required:
9047
+ - provider
9048
+ - from
9049
+ - to
9050
+ - points
9051
+ - productKeys
9052
+ - modelKeys
9053
+ - totals
9054
+ - generatedAt
9055
+ properties:
9056
+ provider:
9057
+ type: string
9058
+ from:
9059
+ type: string
9060
+ format: date
9061
+ to:
9062
+ type: string
9063
+ format: date
9064
+ points:
9065
+ type: array
9066
+ items:
9067
+ $ref: "#/components/schemas/AiToolDailySeriesPointDto"
9068
+ productKeys:
9069
+ type: array
9070
+ items:
9071
+ type: string
9072
+ modelKeys:
9073
+ type: array
9074
+ items:
9075
+ type: string
9076
+ totals:
9077
+ type: object
9078
+ additionalProperties: false
9079
+ required: [spendCents, tokenCount]
9080
+ properties:
9081
+ spendCents:
9082
+ type: integer
9083
+ minimum: 0
9084
+ tokenCount:
9085
+ type: integer
9086
+ minimum: 0
9087
+ hasProductBreakdown:
9088
+ type: boolean
9089
+ hasModelBreakdown:
9090
+ type: boolean
9091
+ hasSpend:
9092
+ type: boolean
9093
+ hasTokens:
9094
+ type: boolean
9095
+ generatedAt:
9096
+ type: string
9097
+ format: date-time
9098
+
9099
+ AiToolModelBreakdownItemDto:
9100
+ type: object
9101
+ additionalProperties: false
9102
+ required: [modelName, spendCents, tokenCount, activeUsers]
9103
+ properties:
9104
+ modelName:
9105
+ type: string
9106
+ spendCents:
9107
+ type: integer
9108
+ minimum: 0
9109
+ tokenCount:
9110
+ type: integer
9111
+ minimum: 0
9112
+ activeUsers:
9113
+ type: integer
9114
+ minimum: 0
9115
+
9116
+ AiToolModelBreakdownDto:
9117
+ type: object
9118
+ additionalProperties: false
9119
+ required: [provider, from, to, models, totals, generatedAt]
9120
+ properties:
9121
+ provider:
9122
+ type: string
9123
+ from:
9124
+ type: string
9125
+ format: date
9126
+ to:
9127
+ type: string
9128
+ format: date
9129
+ models:
9130
+ type: array
9131
+ items:
9132
+ $ref: "#/components/schemas/AiToolModelBreakdownItemDto"
9133
+ totals:
9134
+ type: object
9135
+ additionalProperties: false
9136
+ required: [spendCents, tokenCount]
9137
+ properties:
9138
+ spendCents:
9139
+ type: integer
9140
+ minimum: 0
9141
+ tokenCount:
9142
+ type: integer
9143
+ minimum: 0
9144
+ generatedAt:
9145
+ type: string
9146
+ format: date-time
9147
+
8698
9148
  AiToolMemberSummaryDto:
8699
9149
  type: object
8700
9150
  additionalProperties: false
@@ -8719,6 +9169,14 @@ components:
8719
9169
  minimum: 0
8720
9170
  mostUsedModel:
8721
9171
  type: string
9172
+ productBreakdownCents:
9173
+ type: object
9174
+ additionalProperties:
9175
+ type: integer
9176
+ minimum: 0
9177
+ description: >
9178
+ Per-product spend in cents for the requested window (Claude Enterprise).
9179
+ Omitted when no product-level daily rows exist for the member.
8722
9180
 
8723
9181
  AiToolMembersListDto:
8724
9182
  type: object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.53.0",
3
+ "version": "2.54.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",