@1claw/openapi-spec 0.61.39 → 0.61.40

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.
Files changed (3) hide show
  1. package/openapi.json +692 -1
  2. package/openapi.yaml +301 -1
  3. package/package.json +1 -1
package/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "1Claw API",
5
- "version": "0.61.39",
5
+ "version": "0.61.40",
6
6
  "description": "Secure secret management for AI agents. Provides vaults, secrets,\npolicy-based access control, agent identity, Intents API,\nsharing, billing, and audit logging. Automations (workflow_spec,\nwebhook tokens, event triggers, Assist), cloud runtimes with\ninteractive shell sessions, agent memory, and discovery.\n\n## Domains\n\n`api.1claw.co` is canonical: it is the OIDC issuer, the `aud` the API\nmints, and the first entry in `servers` — a generated client takes its\nbase URL from there, and the previous ordering pointed every SDK at the\ndomain the issuer had already left. `api.1claw.xyz` still answers and is\nstill accepted on token validation, because tokens minted before the\nmove carry it; it is never minted now.\n\nOne deliberate exception: the Shroud attestation identity token is\nrequested from GCP with `audience: https://api.1claw.xyz`, so\n`/v1/shroud/attestation` reports that as its `expected_audience`. That\nis accurate rather than stale — the audience is a verification contract\nwith anyone already checking the token, and moving it is a breaking\nchange for them, not a rename.\n\nAll endpoints require JWT Bearer authentication unless marked with\n`security: []`.\n",
7
7
  "contact": {
8
8
  "email": "ops@1claw.co"
@@ -79,6 +79,10 @@
79
79
  "name": "Organization",
80
80
  "description": "Org membership and roles"
81
81
  },
82
+ {
83
+ "name": "Spend",
84
+ "description": "AI spend — inference cost per agent, provider and model, against budgets and caps"
85
+ },
82
86
  {
83
87
  "name": "Billing",
84
88
  "description": "Subscriptions, credits, and usage"
@@ -6610,6 +6614,301 @@
6610
6614
  }
6611
6615
  }
6612
6616
  },
6617
+ "/v1/spend/ai": {
6618
+ "get": {
6619
+ "tags": [
6620
+ "Spend"
6621
+ ],
6622
+ "summary": "AI spend",
6623
+ "operationId": "getAiSpend",
6624
+ "description": "Inference spend for the org over a window (default the last 30 days):\ntotals with the previous equal-length window for comparison, a time series\nby provider, and breakdowns by provider, by model and by agent — each agent\nwith its `shroud_config` daily budget, today's spend against it and the\nrequests Shroud blocked for budget. `limits` carries router-key spend caps,\nthe credit balance and 1Claw's inspection fees for the window (a separate\nnumber from provider cost). Every request is priced at ingest from the\nprice card (`GET /v1/spend/ai/prices`); a request whose provider has no\ncard is counted as unpriced, not free. Human and platform callers only.\nBacks the dashboard's Spend tab; the same numbers reach an org's own\ncollector as OTEL metrics `ai.cost_usd`, `ai.tokens.input`, `ai.tokens.output`.\n",
6625
+ "parameters": [
6626
+ {
6627
+ "name": "from",
6628
+ "in": "query",
6629
+ "schema": {
6630
+ "type": "string",
6631
+ "format": "date-time"
6632
+ }
6633
+ },
6634
+ {
6635
+ "name": "to",
6636
+ "in": "query",
6637
+ "schema": {
6638
+ "type": "string",
6639
+ "format": "date-time"
6640
+ }
6641
+ },
6642
+ {
6643
+ "name": "interval",
6644
+ "in": "query",
6645
+ "schema": {
6646
+ "type": "string",
6647
+ "enum": [
6648
+ "day",
6649
+ "week",
6650
+ "month"
6651
+ ],
6652
+ "default": "day"
6653
+ }
6654
+ },
6655
+ {
6656
+ "name": "agent_id",
6657
+ "in": "query",
6658
+ "schema": {
6659
+ "type": "string",
6660
+ "format": "uuid"
6661
+ }
6662
+ },
6663
+ {
6664
+ "name": "provider",
6665
+ "in": "query",
6666
+ "schema": {
6667
+ "type": "string"
6668
+ }
6669
+ }
6670
+ ],
6671
+ "responses": {
6672
+ "200": {
6673
+ "description": "Spend",
6674
+ "content": {
6675
+ "application/json": {
6676
+ "schema": {
6677
+ "$ref": "#/components/schemas/AiSpend"
6678
+ }
6679
+ }
6680
+ }
6681
+ },
6682
+ "400": {
6683
+ "$ref": "#/components/responses/BadRequest"
6684
+ },
6685
+ "401": {
6686
+ "$ref": "#/components/responses/Unauthorized"
6687
+ },
6688
+ "403": {
6689
+ "$ref": "#/components/responses/Forbidden"
6690
+ }
6691
+ }
6692
+ }
6693
+ },
6694
+ "/v1/spend/ai/export.csv": {
6695
+ "get": {
6696
+ "tags": [
6697
+ "Spend"
6698
+ ],
6699
+ "summary": "AI spend as CSV",
6700
+ "operationId": "exportAiSpendCsv",
6701
+ "description": "One row per agent × provider × model in the window (same filters as `GET /v1/spend/ai`).",
6702
+ "parameters": [
6703
+ {
6704
+ "name": "from",
6705
+ "in": "query",
6706
+ "schema": {
6707
+ "type": "string",
6708
+ "format": "date-time"
6709
+ }
6710
+ },
6711
+ {
6712
+ "name": "to",
6713
+ "in": "query",
6714
+ "schema": {
6715
+ "type": "string",
6716
+ "format": "date-time"
6717
+ }
6718
+ },
6719
+ {
6720
+ "name": "agent_id",
6721
+ "in": "query",
6722
+ "schema": {
6723
+ "type": "string",
6724
+ "format": "uuid"
6725
+ }
6726
+ },
6727
+ {
6728
+ "name": "provider",
6729
+ "in": "query",
6730
+ "schema": {
6731
+ "type": "string"
6732
+ }
6733
+ }
6734
+ ],
6735
+ "responses": {
6736
+ "200": {
6737
+ "description": "CSV",
6738
+ "content": {
6739
+ "text/csv": {
6740
+ "schema": {
6741
+ "type": "string"
6742
+ }
6743
+ }
6744
+ }
6745
+ },
6746
+ "401": {
6747
+ "$ref": "#/components/responses/Unauthorized"
6748
+ },
6749
+ "403": {
6750
+ "$ref": "#/components/responses/Forbidden"
6751
+ }
6752
+ }
6753
+ }
6754
+ },
6755
+ "/v1/spend/ai/prices": {
6756
+ "get": {
6757
+ "tags": [
6758
+ "Spend"
6759
+ ],
6760
+ "summary": "LLM price card",
6761
+ "operationId": "listLlmPrices",
6762
+ "description": "The global price card (public list prices per million tokens) plus this\norg's overrides. Matching: an org row beats a global row; among those the\nlongest `model_pattern` wins; a pattern ending in `%` is a prefix match.\n",
6763
+ "responses": {
6764
+ "200": {
6765
+ "description": "Prices",
6766
+ "content": {
6767
+ "application/json": {
6768
+ "schema": {
6769
+ "type": "object",
6770
+ "required": [
6771
+ "prices"
6772
+ ],
6773
+ "properties": {
6774
+ "prices": {
6775
+ "type": "array",
6776
+ "items": {
6777
+ "$ref": "#/components/schemas/LlmModelPrice"
6778
+ }
6779
+ }
6780
+ }
6781
+ }
6782
+ }
6783
+ }
6784
+ },
6785
+ "401": {
6786
+ "$ref": "#/components/responses/Unauthorized"
6787
+ }
6788
+ }
6789
+ },
6790
+ "put": {
6791
+ "tags": [
6792
+ "Spend"
6793
+ ],
6794
+ "summary": "Set an org price override",
6795
+ "operationId": "upsertLlmPrice",
6796
+ "description": "Owner/admin. Upserts one override for this org; future requests are priced with it (history is not rewritten).",
6797
+ "requestBody": {
6798
+ "required": true,
6799
+ "content": {
6800
+ "application/json": {
6801
+ "schema": {
6802
+ "type": "object",
6803
+ "required": [
6804
+ "provider",
6805
+ "model_pattern",
6806
+ "input_usd_per_mtok",
6807
+ "output_usd_per_mtok"
6808
+ ],
6809
+ "properties": {
6810
+ "provider": {
6811
+ "type": "string",
6812
+ "example": "anthropic"
6813
+ },
6814
+ "model_pattern": {
6815
+ "type": "string",
6816
+ "example": "claude-sonnet-5%"
6817
+ },
6818
+ "input_usd_per_mtok": {
6819
+ "type": "number",
6820
+ "example": 3
6821
+ },
6822
+ "output_usd_per_mtok": {
6823
+ "type": "number",
6824
+ "example": 15
6825
+ }
6826
+ }
6827
+ }
6828
+ }
6829
+ }
6830
+ },
6831
+ "responses": {
6832
+ "200": {
6833
+ "description": "The override",
6834
+ "content": {
6835
+ "application/json": {
6836
+ "schema": {
6837
+ "$ref": "#/components/schemas/LlmModelPrice"
6838
+ }
6839
+ }
6840
+ }
6841
+ },
6842
+ "400": {
6843
+ "$ref": "#/components/responses/BadRequest"
6844
+ },
6845
+ "403": {
6846
+ "$ref": "#/components/responses/Forbidden"
6847
+ }
6848
+ }
6849
+ }
6850
+ },
6851
+ "/v1/spend/ai/prices/{id}": {
6852
+ "delete": {
6853
+ "tags": [
6854
+ "Spend"
6855
+ ],
6856
+ "summary": "Remove an org price override",
6857
+ "operationId": "deleteLlmPrice",
6858
+ "parameters": [
6859
+ {
6860
+ "name": "id",
6861
+ "in": "path",
6862
+ "required": true,
6863
+ "schema": {
6864
+ "type": "string",
6865
+ "format": "uuid"
6866
+ }
6867
+ }
6868
+ ],
6869
+ "responses": {
6870
+ "204": {
6871
+ "description": "Removed"
6872
+ },
6873
+ "403": {
6874
+ "$ref": "#/components/responses/Forbidden"
6875
+ },
6876
+ "404": {
6877
+ "$ref": "#/components/responses/NotFound"
6878
+ }
6879
+ }
6880
+ }
6881
+ },
6882
+ "/v1/spend/ai/reprice": {
6883
+ "post": {
6884
+ "tags": [
6885
+ "Spend"
6886
+ ],
6887
+ "summary": "Price the org's unpriced requests",
6888
+ "operationId": "repriceAiSpend",
6889
+ "description": "Owner/admin. Re-runs the price card over rows that had no price when they arrived (after adding a card for that provider). Already-priced rows are untouched.",
6890
+ "responses": {
6891
+ "200": {
6892
+ "description": "Count",
6893
+ "content": {
6894
+ "application/json": {
6895
+ "schema": {
6896
+ "type": "object",
6897
+ "properties": {
6898
+ "repriced": {
6899
+ "type": "integer"
6900
+ }
6901
+ }
6902
+ }
6903
+ }
6904
+ }
6905
+ },
6906
+ "403": {
6907
+ "$ref": "#/components/responses/Forbidden"
6908
+ }
6909
+ }
6910
+ }
6911
+ },
6613
6912
  "/v1/org/overview": {
6614
6913
  "get": {
6615
6914
  "tags": [
@@ -43641,6 +43940,398 @@
43641
43940
  }
43642
43941
  }
43643
43942
  },
43943
+ "LlmModelPrice": {
43944
+ "type": "object",
43945
+ "required": [
43946
+ "id",
43947
+ "provider",
43948
+ "model_pattern",
43949
+ "input_micro_usd_per_mtok",
43950
+ "output_micro_usd_per_mtok",
43951
+ "source",
43952
+ "updated_at"
43953
+ ],
43954
+ "properties": {
43955
+ "id": {
43956
+ "type": "string",
43957
+ "format": "uuid"
43958
+ },
43959
+ "org_id": {
43960
+ "type": "string",
43961
+ "format": "uuid",
43962
+ "nullable": true,
43963
+ "description": "Null for a global row."
43964
+ },
43965
+ "provider": {
43966
+ "type": "string"
43967
+ },
43968
+ "model_pattern": {
43969
+ "type": "string"
43970
+ },
43971
+ "input_micro_usd_per_mtok": {
43972
+ "type": "integer",
43973
+ "format": "int64"
43974
+ },
43975
+ "output_micro_usd_per_mtok": {
43976
+ "type": "integer",
43977
+ "format": "int64"
43978
+ },
43979
+ "source": {
43980
+ "type": "string"
43981
+ },
43982
+ "updated_at": {
43983
+ "type": "string",
43984
+ "format": "date-time"
43985
+ }
43986
+ }
43987
+ },
43988
+ "AiSpendTotals": {
43989
+ "type": "object",
43990
+ "properties": {
43991
+ "cost_usd": {
43992
+ "type": "number"
43993
+ },
43994
+ "tokens_input": {
43995
+ "type": "integer",
43996
+ "format": "int64"
43997
+ },
43998
+ "tokens_output": {
43999
+ "type": "integer",
44000
+ "format": "int64"
44001
+ },
44002
+ "tokens": {
44003
+ "type": "integer",
44004
+ "format": "int64"
44005
+ },
44006
+ "requests": {
44007
+ "type": "integer",
44008
+ "format": "int64"
44009
+ },
44010
+ "blocked": {
44011
+ "type": "integer",
44012
+ "format": "int64"
44013
+ },
44014
+ "unpriced_requests": {
44015
+ "type": "integer",
44016
+ "format": "int64"
44017
+ },
44018
+ "agents": {
44019
+ "type": "integer",
44020
+ "format": "int64"
44021
+ },
44022
+ "models": {
44023
+ "type": "integer",
44024
+ "format": "int64"
44025
+ },
44026
+ "avg_cost_per_day": {
44027
+ "type": "number"
44028
+ },
44029
+ "cost_per_request": {
44030
+ "type": "number"
44031
+ },
44032
+ "cost_per_mtok": {
44033
+ "type": "number"
44034
+ }
44035
+ }
44036
+ },
44037
+ "AiSpend": {
44038
+ "type": "object",
44039
+ "required": [
44040
+ "window",
44041
+ "totals",
44042
+ "previous",
44043
+ "series",
44044
+ "by_provider",
44045
+ "by_model",
44046
+ "by_agent",
44047
+ "limits",
44048
+ "generated_at"
44049
+ ],
44050
+ "properties": {
44051
+ "generated_at": {
44052
+ "type": "string",
44053
+ "format": "date-time"
44054
+ },
44055
+ "window": {
44056
+ "type": "object",
44057
+ "properties": {
44058
+ "from": {
44059
+ "type": "string",
44060
+ "format": "date-time"
44061
+ },
44062
+ "to": {
44063
+ "type": "string",
44064
+ "format": "date-time"
44065
+ },
44066
+ "interval": {
44067
+ "type": "string"
44068
+ },
44069
+ "previous_from": {
44070
+ "type": "string",
44071
+ "format": "date-time"
44072
+ },
44073
+ "previous_to": {
44074
+ "type": "string",
44075
+ "format": "date-time"
44076
+ },
44077
+ "days": {
44078
+ "type": "number"
44079
+ }
44080
+ }
44081
+ },
44082
+ "totals": {
44083
+ "$ref": "#/components/schemas/AiSpendTotals"
44084
+ },
44085
+ "previous": {
44086
+ "$ref": "#/components/schemas/AiSpendTotals"
44087
+ },
44088
+ "series": {
44089
+ "type": "array",
44090
+ "items": {
44091
+ "type": "object",
44092
+ "properties": {
44093
+ "bucket": {
44094
+ "type": "string",
44095
+ "format": "date-time"
44096
+ },
44097
+ "provider": {
44098
+ "type": "string"
44099
+ },
44100
+ "cost_usd": {
44101
+ "type": "number"
44102
+ },
44103
+ "tokens": {
44104
+ "type": "integer",
44105
+ "format": "int64"
44106
+ },
44107
+ "requests": {
44108
+ "type": "integer",
44109
+ "format": "int64"
44110
+ }
44111
+ }
44112
+ }
44113
+ },
44114
+ "by_provider": {
44115
+ "type": "array",
44116
+ "items": {
44117
+ "type": "object",
44118
+ "properties": {
44119
+ "provider": {
44120
+ "type": "string"
44121
+ },
44122
+ "cost_usd": {
44123
+ "type": "number"
44124
+ },
44125
+ "tokens": {
44126
+ "type": "integer",
44127
+ "format": "int64"
44128
+ },
44129
+ "requests": {
44130
+ "type": "integer",
44131
+ "format": "int64"
44132
+ },
44133
+ "previous_cost_usd": {
44134
+ "type": "number"
44135
+ },
44136
+ "share_pct": {
44137
+ "type": "number"
44138
+ },
44139
+ "trend_pct": {
44140
+ "type": "number",
44141
+ "nullable": true
44142
+ }
44143
+ }
44144
+ }
44145
+ },
44146
+ "by_model": {
44147
+ "type": "array",
44148
+ "items": {
44149
+ "type": "object",
44150
+ "properties": {
44151
+ "provider": {
44152
+ "type": "string"
44153
+ },
44154
+ "model": {
44155
+ "type": "string"
44156
+ },
44157
+ "cost_usd": {
44158
+ "type": "number"
44159
+ },
44160
+ "tokens_input": {
44161
+ "type": "integer",
44162
+ "format": "int64"
44163
+ },
44164
+ "tokens_output": {
44165
+ "type": "integer",
44166
+ "format": "int64"
44167
+ },
44168
+ "requests": {
44169
+ "type": "integer",
44170
+ "format": "int64"
44171
+ },
44172
+ "previous_cost_usd": {
44173
+ "type": "number"
44174
+ },
44175
+ "priced": {
44176
+ "type": "boolean"
44177
+ },
44178
+ "share_pct": {
44179
+ "type": "number"
44180
+ },
44181
+ "trend_pct": {
44182
+ "type": "number",
44183
+ "nullable": true
44184
+ }
44185
+ }
44186
+ }
44187
+ },
44188
+ "by_agent": {
44189
+ "type": "array",
44190
+ "items": {
44191
+ "type": "object",
44192
+ "properties": {
44193
+ "agent_id": {
44194
+ "type": "string",
44195
+ "format": "uuid"
44196
+ },
44197
+ "agent_name": {
44198
+ "type": "string"
44199
+ },
44200
+ "is_active": {
44201
+ "type": "boolean"
44202
+ },
44203
+ "cost_usd": {
44204
+ "type": "number"
44205
+ },
44206
+ "tokens": {
44207
+ "type": "integer",
44208
+ "format": "int64"
44209
+ },
44210
+ "requests": {
44211
+ "type": "integer",
44212
+ "format": "int64"
44213
+ },
44214
+ "blocked": {
44215
+ "type": "integer",
44216
+ "format": "int64"
44217
+ },
44218
+ "top_model": {
44219
+ "type": "string",
44220
+ "nullable": true
44221
+ },
44222
+ "top_provider": {
44223
+ "type": "string",
44224
+ "nullable": true
44225
+ },
44226
+ "previous_cost_usd": {
44227
+ "type": "number"
44228
+ },
44229
+ "last_request_at": {
44230
+ "type": "string",
44231
+ "format": "date-time",
44232
+ "nullable": true
44233
+ },
44234
+ "daily_budget_usd": {
44235
+ "type": "number",
44236
+ "nullable": true
44237
+ },
44238
+ "today_cost_usd": {
44239
+ "type": "number"
44240
+ },
44241
+ "blocked_by_budget": {
44242
+ "type": "integer",
44243
+ "format": "int64"
44244
+ },
44245
+ "max_tokens_per_request": {
44246
+ "type": "integer",
44247
+ "format": "int64",
44248
+ "nullable": true
44249
+ },
44250
+ "max_requests_per_day": {
44251
+ "type": "integer",
44252
+ "format": "int64",
44253
+ "nullable": true
44254
+ },
44255
+ "share_pct": {
44256
+ "type": "number"
44257
+ },
44258
+ "trend_pct": {
44259
+ "type": "number",
44260
+ "nullable": true
44261
+ },
44262
+ "budget_used_pct": {
44263
+ "type": "number",
44264
+ "nullable": true
44265
+ }
44266
+ }
44267
+ }
44268
+ },
44269
+ "limits": {
44270
+ "type": "object",
44271
+ "properties": {
44272
+ "agents_with_daily_budget": {
44273
+ "type": "integer",
44274
+ "format": "int64"
44275
+ },
44276
+ "agents_over_80pct": {
44277
+ "type": "integer",
44278
+ "format": "int64"
44279
+ },
44280
+ "agents_at_cap": {
44281
+ "type": "integer",
44282
+ "format": "int64"
44283
+ },
44284
+ "blocked_by_budget": {
44285
+ "type": "integer",
44286
+ "format": "int64"
44287
+ },
44288
+ "router_keys": {
44289
+ "type": "array",
44290
+ "items": {
44291
+ "type": "object",
44292
+ "properties": {
44293
+ "key_id": {
44294
+ "type": "string",
44295
+ "format": "uuid"
44296
+ },
44297
+ "agent_id": {
44298
+ "type": "string",
44299
+ "format": "uuid"
44300
+ },
44301
+ "agent_name": {
44302
+ "type": "string"
44303
+ },
44304
+ "name": {
44305
+ "type": "string"
44306
+ },
44307
+ "spent_usd": {
44308
+ "type": "number"
44309
+ },
44310
+ "cap_usd": {
44311
+ "type": "number",
44312
+ "nullable": true
44313
+ },
44314
+ "last_used_at": {
44315
+ "type": "string",
44316
+ "format": "date-time",
44317
+ "nullable": true
44318
+ }
44319
+ }
44320
+ }
44321
+ },
44322
+ "credit_balance_usd": {
44323
+ "type": "number"
44324
+ },
44325
+ "inspection_fees_usd": {
44326
+ "type": "number"
44327
+ },
44328
+ "billing_tier": {
44329
+ "type": "string"
44330
+ }
44331
+ }
44332
+ }
44333
+ }
44334
+ },
43644
44335
  "OrgOverview": {
43645
44336
  "type": "object",
43646
44337
  "required": [
package/openapi.yaml CHANGED
@@ -2,7 +2,7 @@ openapi: 3.1.0
2
2
 
3
3
  info:
4
4
  title: 1Claw API
5
- version: "0.61.39"
5
+ version: "0.61.40"
6
6
  description: |
7
7
  Secure secret management for AI agents. Provides vaults, secrets,
8
8
  policy-based access control, agent identity, Intents API,
@@ -70,6 +70,8 @@ tags:
70
70
  description: Secret sharing links
71
71
  - name: Organization
72
72
  description: Org membership and roles
73
+ - name: Spend
74
+ description: AI spend — inference cost per agent, provider and model, against budgets and caps
73
75
  - name: Billing
74
76
  description: Subscriptions, credits, and usage
75
77
  - name: Audit
@@ -4282,6 +4284,172 @@ paths:
4282
4284
  # Organization
4283
4285
  # ---------------------------------------------------------------------------
4284
4286
 
4287
+ /v1/spend/ai:
4288
+ get:
4289
+ tags: [Spend]
4290
+ summary: AI spend
4291
+ operationId: getAiSpend
4292
+ description: |
4293
+ Inference spend for the org over a window (default the last 30 days):
4294
+ totals with the previous equal-length window for comparison, a time series
4295
+ by provider, and breakdowns by provider, by model and by agent — each agent
4296
+ with its `shroud_config` daily budget, today's spend against it and the
4297
+ requests Shroud blocked for budget. `limits` carries router-key spend caps,
4298
+ the credit balance and 1Claw's inspection fees for the window (a separate
4299
+ number from provider cost). Every request is priced at ingest from the
4300
+ price card (`GET /v1/spend/ai/prices`); a request whose provider has no
4301
+ card is counted as unpriced, not free. Human and platform callers only.
4302
+ Backs the dashboard's Spend tab; the same numbers reach an org's own
4303
+ collector as OTEL metrics `ai.cost_usd`, `ai.tokens.input`, `ai.tokens.output`.
4304
+ parameters:
4305
+ - name: from
4306
+ in: query
4307
+ schema: { type: string, format: date-time }
4308
+ - name: to
4309
+ in: query
4310
+ schema: { type: string, format: date-time }
4311
+ - name: interval
4312
+ in: query
4313
+ schema: { type: string, enum: [day, week, month], default: day }
4314
+ - name: agent_id
4315
+ in: query
4316
+ schema: { type: string, format: uuid }
4317
+ - name: provider
4318
+ in: query
4319
+ schema: { type: string }
4320
+ responses:
4321
+ "200":
4322
+ description: Spend
4323
+ content:
4324
+ application/json:
4325
+ schema:
4326
+ $ref: "#/components/schemas/AiSpend"
4327
+ "400":
4328
+ $ref: "#/components/responses/BadRequest"
4329
+ "401":
4330
+ $ref: "#/components/responses/Unauthorized"
4331
+ "403":
4332
+ $ref: "#/components/responses/Forbidden"
4333
+
4334
+ /v1/spend/ai/export.csv:
4335
+ get:
4336
+ tags: [Spend]
4337
+ summary: AI spend as CSV
4338
+ operationId: exportAiSpendCsv
4339
+ description: One row per agent × provider × model in the window (same filters as `GET /v1/spend/ai`).
4340
+ parameters:
4341
+ - name: from
4342
+ in: query
4343
+ schema: { type: string, format: date-time }
4344
+ - name: to
4345
+ in: query
4346
+ schema: { type: string, format: date-time }
4347
+ - name: agent_id
4348
+ in: query
4349
+ schema: { type: string, format: uuid }
4350
+ - name: provider
4351
+ in: query
4352
+ schema: { type: string }
4353
+ responses:
4354
+ "200":
4355
+ description: CSV
4356
+ content:
4357
+ text/csv:
4358
+ schema: { type: string }
4359
+ "401":
4360
+ $ref: "#/components/responses/Unauthorized"
4361
+ "403":
4362
+ $ref: "#/components/responses/Forbidden"
4363
+
4364
+ /v1/spend/ai/prices:
4365
+ get:
4366
+ tags: [Spend]
4367
+ summary: LLM price card
4368
+ operationId: listLlmPrices
4369
+ description: |
4370
+ The global price card (public list prices per million tokens) plus this
4371
+ org's overrides. Matching: an org row beats a global row; among those the
4372
+ longest `model_pattern` wins; a pattern ending in `%` is a prefix match.
4373
+ responses:
4374
+ "200":
4375
+ description: Prices
4376
+ content:
4377
+ application/json:
4378
+ schema:
4379
+ type: object
4380
+ required: [prices]
4381
+ properties:
4382
+ prices:
4383
+ type: array
4384
+ items:
4385
+ $ref: "#/components/schemas/LlmModelPrice"
4386
+ "401":
4387
+ $ref: "#/components/responses/Unauthorized"
4388
+ put:
4389
+ tags: [Spend]
4390
+ summary: Set an org price override
4391
+ operationId: upsertLlmPrice
4392
+ description: Owner/admin. Upserts one override for this org; future requests are priced with it (history is not rewritten).
4393
+ requestBody:
4394
+ required: true
4395
+ content:
4396
+ application/json:
4397
+ schema:
4398
+ type: object
4399
+ required: [provider, model_pattern, input_usd_per_mtok, output_usd_per_mtok]
4400
+ properties:
4401
+ provider: { type: string, example: anthropic }
4402
+ model_pattern: { type: string, example: "claude-sonnet-5%" }
4403
+ input_usd_per_mtok: { type: number, example: 3 }
4404
+ output_usd_per_mtok: { type: number, example: 15 }
4405
+ responses:
4406
+ "200":
4407
+ description: The override
4408
+ content:
4409
+ application/json:
4410
+ schema:
4411
+ $ref: "#/components/schemas/LlmModelPrice"
4412
+ "400":
4413
+ $ref: "#/components/responses/BadRequest"
4414
+ "403":
4415
+ $ref: "#/components/responses/Forbidden"
4416
+
4417
+ /v1/spend/ai/prices/{id}:
4418
+ delete:
4419
+ tags: [Spend]
4420
+ summary: Remove an org price override
4421
+ operationId: deleteLlmPrice
4422
+ parameters:
4423
+ - name: id
4424
+ in: path
4425
+ required: true
4426
+ schema: { type: string, format: uuid }
4427
+ responses:
4428
+ "204":
4429
+ description: Removed
4430
+ "403":
4431
+ $ref: "#/components/responses/Forbidden"
4432
+ "404":
4433
+ $ref: "#/components/responses/NotFound"
4434
+
4435
+ /v1/spend/ai/reprice:
4436
+ post:
4437
+ tags: [Spend]
4438
+ summary: Price the org's unpriced requests
4439
+ operationId: repriceAiSpend
4440
+ description: Owner/admin. Re-runs the price card over rows that had no price when they arrived (after adding a card for that provider). Already-priced rows are untouched.
4441
+ responses:
4442
+ "200":
4443
+ description: Count
4444
+ content:
4445
+ application/json:
4446
+ schema:
4447
+ type: object
4448
+ properties:
4449
+ repriced: { type: integer }
4450
+ "403":
4451
+ $ref: "#/components/responses/Forbidden"
4452
+
4285
4453
  /v1/org/overview:
4286
4454
  get:
4287
4455
  tags: [Organization]
@@ -28262,6 +28430,138 @@ components:
28262
28430
  format: uuid
28263
28431
  description: Control-plane approval when rolling back to a wider spec.
28264
28432
 
28433
+ LlmModelPrice:
28434
+ type: object
28435
+ required: [id, provider, model_pattern, input_micro_usd_per_mtok, output_micro_usd_per_mtok, source, updated_at]
28436
+ properties:
28437
+ id: { type: string, format: uuid }
28438
+ org_id:
28439
+ type: string
28440
+ format: uuid
28441
+ nullable: true
28442
+ description: Null for a global row.
28443
+ provider: { type: string }
28444
+ model_pattern: { type: string }
28445
+ input_micro_usd_per_mtok: { type: integer, format: int64 }
28446
+ output_micro_usd_per_mtok: { type: integer, format: int64 }
28447
+ source: { type: string }
28448
+ updated_at: { type: string, format: date-time }
28449
+ AiSpendTotals:
28450
+ type: object
28451
+ properties:
28452
+ cost_usd: { type: number }
28453
+ tokens_input: { type: integer, format: int64 }
28454
+ tokens_output: { type: integer, format: int64 }
28455
+ tokens: { type: integer, format: int64 }
28456
+ requests: { type: integer, format: int64 }
28457
+ blocked: { type: integer, format: int64 }
28458
+ unpriced_requests: { type: integer, format: int64 }
28459
+ agents: { type: integer, format: int64 }
28460
+ models: { type: integer, format: int64 }
28461
+ avg_cost_per_day: { type: number }
28462
+ cost_per_request: { type: number }
28463
+ cost_per_mtok: { type: number }
28464
+ AiSpend:
28465
+ type: object
28466
+ required: [window, totals, previous, series, by_provider, by_model, by_agent, limits, generated_at]
28467
+ properties:
28468
+ generated_at: { type: string, format: date-time }
28469
+ window:
28470
+ type: object
28471
+ properties:
28472
+ from: { type: string, format: date-time }
28473
+ to: { type: string, format: date-time }
28474
+ interval: { type: string }
28475
+ previous_from: { type: string, format: date-time }
28476
+ previous_to: { type: string, format: date-time }
28477
+ days: { type: number }
28478
+ totals:
28479
+ $ref: "#/components/schemas/AiSpendTotals"
28480
+ previous:
28481
+ $ref: "#/components/schemas/AiSpendTotals"
28482
+ series:
28483
+ type: array
28484
+ items:
28485
+ type: object
28486
+ properties:
28487
+ bucket: { type: string, format: date-time }
28488
+ provider: { type: string }
28489
+ cost_usd: { type: number }
28490
+ tokens: { type: integer, format: int64 }
28491
+ requests: { type: integer, format: int64 }
28492
+ by_provider:
28493
+ type: array
28494
+ items:
28495
+ type: object
28496
+ properties:
28497
+ provider: { type: string }
28498
+ cost_usd: { type: number }
28499
+ tokens: { type: integer, format: int64 }
28500
+ requests: { type: integer, format: int64 }
28501
+ previous_cost_usd: { type: number }
28502
+ share_pct: { type: number }
28503
+ trend_pct: { type: number, nullable: true }
28504
+ by_model:
28505
+ type: array
28506
+ items:
28507
+ type: object
28508
+ properties:
28509
+ provider: { type: string }
28510
+ model: { type: string }
28511
+ cost_usd: { type: number }
28512
+ tokens_input: { type: integer, format: int64 }
28513
+ tokens_output: { type: integer, format: int64 }
28514
+ requests: { type: integer, format: int64 }
28515
+ previous_cost_usd: { type: number }
28516
+ priced: { type: boolean }
28517
+ share_pct: { type: number }
28518
+ trend_pct: { type: number, nullable: true }
28519
+ by_agent:
28520
+ type: array
28521
+ items:
28522
+ type: object
28523
+ properties:
28524
+ agent_id: { type: string, format: uuid }
28525
+ agent_name: { type: string }
28526
+ is_active: { type: boolean }
28527
+ cost_usd: { type: number }
28528
+ tokens: { type: integer, format: int64 }
28529
+ requests: { type: integer, format: int64 }
28530
+ blocked: { type: integer, format: int64 }
28531
+ top_model: { type: string, nullable: true }
28532
+ top_provider: { type: string, nullable: true }
28533
+ previous_cost_usd: { type: number }
28534
+ last_request_at: { type: string, format: date-time, nullable: true }
28535
+ daily_budget_usd: { type: number, nullable: true }
28536
+ today_cost_usd: { type: number }
28537
+ blocked_by_budget: { type: integer, format: int64 }
28538
+ max_tokens_per_request: { type: integer, format: int64, nullable: true }
28539
+ max_requests_per_day: { type: integer, format: int64, nullable: true }
28540
+ share_pct: { type: number }
28541
+ trend_pct: { type: number, nullable: true }
28542
+ budget_used_pct: { type: number, nullable: true }
28543
+ limits:
28544
+ type: object
28545
+ properties:
28546
+ agents_with_daily_budget: { type: integer, format: int64 }
28547
+ agents_over_80pct: { type: integer, format: int64 }
28548
+ agents_at_cap: { type: integer, format: int64 }
28549
+ blocked_by_budget: { type: integer, format: int64 }
28550
+ router_keys:
28551
+ type: array
28552
+ items:
28553
+ type: object
28554
+ properties:
28555
+ key_id: { type: string, format: uuid }
28556
+ agent_id: { type: string, format: uuid }
28557
+ agent_name: { type: string }
28558
+ name: { type: string }
28559
+ spent_usd: { type: number }
28560
+ cap_usd: { type: number, nullable: true }
28561
+ last_used_at: { type: string, format: date-time, nullable: true }
28562
+ credit_balance_usd: { type: number }
28563
+ inspection_fees_usd: { type: number }
28564
+ billing_tier: { type: string }
28265
28565
  OrgOverview:
28266
28566
  type: object
28267
28567
  required: [generated_at, window_hours, inventory, activity, spend, health, trend]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1claw/openapi-spec",
3
- "version": "0.61.39",
3
+ "version": "0.61.40",
4
4
  "description": "OpenAPI 3.1.0 specification for the 1Claw Vault API \u2014 generate clients in any language",
5
5
  "license": "MIT",
6
6
  "repository": {