@1claw/openapi-spec 0.16.0 → 0.16.3
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.
- package/README.md +4 -2
- package/openapi.json +316 -2
- package/openapi.yaml +236 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,9 +40,11 @@ openapi-generator generate \
|
|
|
40
40
|
import spec from "@1claw/openapi-spec/openapi.json";
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
## What's in the spec (v0.
|
|
43
|
+
## What's in the spec (v0.16.x)
|
|
44
44
|
|
|
45
|
-
- **
|
|
45
|
+
- **Auth — agent JWT** — `POST /v1/auth/agent-token` documents optional JWT claim **`shroud_config`** when the agent has Shroud enabled (mirrors DB; consumed by Shroud PolicyEngine on LLM requests). Re-exchange after changing agent Shroud settings.
|
|
46
|
+
- **Auth — password reset** — `POST /v1/auth/forgot-password`, `POST /v1/auth/reset-password` (public; anti-enumeration on forgot)
|
|
47
|
+
- **Billing — LLM token billing** — `GET /v1/billing/llm-token-billing` (`LlmTokenBillingStatus`: `enabled`, `subscription_status`, optional `credit_balance`, optional `billing_cycle_usage` with `metered_lines[]`), `POST .../subscribe`, `POST .../disable` (Stripe AI Gateway add-on; optional org feature)
|
|
46
48
|
- **Treasury** — Safe multisig treasuries: `POST/GET /v1/treasury`, `GET/PATCH/DELETE /v1/treasury/{id}`, signers, agent access requests (`requests[]` on list)
|
|
47
49
|
- **Vaults** — CRUD, CMEK enable/disable, key rotation with job tracking
|
|
48
50
|
- **Secrets** — CRUD, versioning, CMEK-encrypted flag
|
package/openapi.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"openapi": "3.1.0",
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "1Claw API",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.6.0",
|
|
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.\n\nAll endpoints require JWT Bearer authentication unless marked with\n`security: []`.\n",
|
|
7
7
|
"contact": {
|
|
8
8
|
"email": "ops@1claw.xyz"
|
|
@@ -153,6 +153,7 @@
|
|
|
153
153
|
"Authentication"
|
|
154
154
|
],
|
|
155
155
|
"summary": "Exchange agent credentials for JWT",
|
|
156
|
+
"description": "Returns a short-lived EdDSA-signed JWT (`access_token`). Standard claims include `sub`\n(`agent:<uuid>`), `org`, `scopes`, `vault_ids`, optional `intents_api_enabled`, optional\n`shroud_enabled`, optional `llm_token_billing` / `stripe_customer_id` when org LLM billing is on.\n\nWhen **`shroud_enabled`** is true, the JWT payload may include **`shroud_config`**: a JSON object\nmirroring the agent row in Vault (same shape as `ShroudConfig` on `GET /v1/agents/{id}`).\n**Shroud** (TEE proxy) decodes this on each LLM request and runs **PolicyEngine** after the\nglobal inspection pipeline so per-agent limits and threat **block** actions apply without a\nseparate policy fetch. Re-exchange the agent token after changing `shroud_config` so the JWT\nis fresh.\n\nUser JWTs from password, API key, or device flow do **not** include `shroud_config`.\n",
|
|
156
157
|
"operationId": "agentToken",
|
|
157
158
|
"security": [],
|
|
158
159
|
"requestBody": {
|
|
@@ -375,6 +376,74 @@
|
|
|
375
376
|
}
|
|
376
377
|
}
|
|
377
378
|
},
|
|
379
|
+
"/v1/auth/forgot-password": {
|
|
380
|
+
"post": {
|
|
381
|
+
"tags": [
|
|
382
|
+
"Authentication"
|
|
383
|
+
],
|
|
384
|
+
"summary": "Request password reset email",
|
|
385
|
+
"description": "Always returns the same message whether or not the email exists (no account enumeration).\nOnly password-based accounts receive mail.\n",
|
|
386
|
+
"operationId": "forgotPassword",
|
|
387
|
+
"security": [],
|
|
388
|
+
"requestBody": {
|
|
389
|
+
"required": true,
|
|
390
|
+
"content": {
|
|
391
|
+
"application/json": {
|
|
392
|
+
"schema": {
|
|
393
|
+
"$ref": "#/components/schemas/ForgotPasswordRequest"
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
"responses": {
|
|
399
|
+
"200": {
|
|
400
|
+
"description": "Acknowledgement (check email if account exists)",
|
|
401
|
+
"content": {
|
|
402
|
+
"application/json": {
|
|
403
|
+
"schema": {
|
|
404
|
+
"$ref": "#/components/schemas/ForgotPasswordResponse"
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
"/v1/auth/reset-password": {
|
|
413
|
+
"post": {
|
|
414
|
+
"tags": [
|
|
415
|
+
"Authentication"
|
|
416
|
+
],
|
|
417
|
+
"summary": "Set a new password using reset token from email",
|
|
418
|
+
"operationId": "resetPassword",
|
|
419
|
+
"security": [],
|
|
420
|
+
"requestBody": {
|
|
421
|
+
"required": true,
|
|
422
|
+
"content": {
|
|
423
|
+
"application/json": {
|
|
424
|
+
"schema": {
|
|
425
|
+
"$ref": "#/components/schemas/ResetPasswordRequest"
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
"responses": {
|
|
431
|
+
"200": {
|
|
432
|
+
"description": "Password updated",
|
|
433
|
+
"content": {
|
|
434
|
+
"application/json": {
|
|
435
|
+
"schema": {
|
|
436
|
+
"$ref": "#/components/schemas/ResetPasswordResponse"
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
"400": {
|
|
442
|
+
"$ref": "#/components/responses/BadRequest"
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
},
|
|
378
447
|
"/v1/auth/google": {
|
|
379
448
|
"post": {
|
|
380
449
|
"tags": [
|
|
@@ -2825,7 +2894,7 @@
|
|
|
2825
2894
|
],
|
|
2826
2895
|
"summary": "Get LLM token billing status",
|
|
2827
2896
|
"operationId": "getLlmTokenBilling",
|
|
2828
|
-
"description": "Returns whether LLM token billing is enabled
|
|
2897
|
+
"description": "Returns whether LLM token billing is enabled, optional Stripe billing credit balance (metered scope), and estimated cycle usage from the upcoming invoice—including per-line metered rows when Stripe returns them (amounts; quantities such as tokens when present).\n",
|
|
2829
2898
|
"responses": {
|
|
2830
2899
|
"200": {
|
|
2831
2900
|
"description": "LLM token billing status",
|
|
@@ -3839,6 +3908,72 @@
|
|
|
3839
3908
|
}
|
|
3840
3909
|
}
|
|
3841
3910
|
},
|
|
3911
|
+
"/v1/admin/usage/reset": {
|
|
3912
|
+
"post": {
|
|
3913
|
+
"tags": [
|
|
3914
|
+
"Admin"
|
|
3915
|
+
],
|
|
3916
|
+
"summary": "Reset all API usage events (testing)",
|
|
3917
|
+
"operationId": "adminResetUsageEvents",
|
|
3918
|
+
"description": "Deletes every row in `usage_events` for all organizations. Resets monthly\nrequest counts used for free-tier / x402 quota. Does not change prepaid credit\nbalances or Stripe. **Platform admin only** (same guard as other `/v1/admin/*` routes).\n",
|
|
3919
|
+
"responses": {
|
|
3920
|
+
"200": {
|
|
3921
|
+
"description": "Usage table cleared; returns number of deleted rows",
|
|
3922
|
+
"content": {
|
|
3923
|
+
"application/json": {
|
|
3924
|
+
"schema": {
|
|
3925
|
+
"$ref": "#/components/schemas/ResetUsageEventsResponse"
|
|
3926
|
+
}
|
|
3927
|
+
}
|
|
3928
|
+
}
|
|
3929
|
+
},
|
|
3930
|
+
"403": {
|
|
3931
|
+
"$ref": "#/components/responses/Forbidden"
|
|
3932
|
+
}
|
|
3933
|
+
}
|
|
3934
|
+
}
|
|
3935
|
+
},
|
|
3936
|
+
"/v1/admin/usage/reset-for-user": {
|
|
3937
|
+
"post": {
|
|
3938
|
+
"tags": [
|
|
3939
|
+
"Admin"
|
|
3940
|
+
],
|
|
3941
|
+
"summary": "Reset API usage for a user's organization",
|
|
3942
|
+
"operationId": "adminResetUsageForUserByEmail",
|
|
3943
|
+
"description": "Looks up a registered user by email and deletes all `usage_events` rows for that\nuser's `org_id`. Resets free-tier / monthly quota for the whole org (not other orgs).\n**Platform admin only.**\n",
|
|
3944
|
+
"requestBody": {
|
|
3945
|
+
"required": true,
|
|
3946
|
+
"content": {
|
|
3947
|
+
"application/json": {
|
|
3948
|
+
"schema": {
|
|
3949
|
+
"$ref": "#/components/schemas/ResetUsageForUserEmailRequest"
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
}
|
|
3953
|
+
},
|
|
3954
|
+
"responses": {
|
|
3955
|
+
"200": {
|
|
3956
|
+
"description": "Usage cleared for the user's org",
|
|
3957
|
+
"content": {
|
|
3958
|
+
"application/json": {
|
|
3959
|
+
"schema": {
|
|
3960
|
+
"$ref": "#/components/schemas/ResetUsageForUserEmailResponse"
|
|
3961
|
+
}
|
|
3962
|
+
}
|
|
3963
|
+
}
|
|
3964
|
+
},
|
|
3965
|
+
"400": {
|
|
3966
|
+
"$ref": "#/components/responses/BadRequest"
|
|
3967
|
+
},
|
|
3968
|
+
"403": {
|
|
3969
|
+
"$ref": "#/components/responses/Forbidden"
|
|
3970
|
+
},
|
|
3971
|
+
"404": {
|
|
3972
|
+
"$ref": "#/components/responses/NotFound"
|
|
3973
|
+
}
|
|
3974
|
+
}
|
|
3975
|
+
}
|
|
3976
|
+
},
|
|
3842
3977
|
"/v1/health": {
|
|
3843
3978
|
"get": {
|
|
3844
3979
|
"tags": [
|
|
@@ -4027,6 +4162,61 @@
|
|
|
4027
4162
|
}
|
|
4028
4163
|
}
|
|
4029
4164
|
},
|
|
4165
|
+
"ResetUsageEventsResponse": {
|
|
4166
|
+
"type": "object",
|
|
4167
|
+
"required": [
|
|
4168
|
+
"deleted_events"
|
|
4169
|
+
],
|
|
4170
|
+
"properties": {
|
|
4171
|
+
"deleted_events": {
|
|
4172
|
+
"type": "integer",
|
|
4173
|
+
"format": "int64",
|
|
4174
|
+
"description": "Number of usage_events rows removed"
|
|
4175
|
+
}
|
|
4176
|
+
}
|
|
4177
|
+
},
|
|
4178
|
+
"ResetUsageForUserEmailRequest": {
|
|
4179
|
+
"type": "object",
|
|
4180
|
+
"required": [
|
|
4181
|
+
"email"
|
|
4182
|
+
],
|
|
4183
|
+
"properties": {
|
|
4184
|
+
"email": {
|
|
4185
|
+
"type": "string",
|
|
4186
|
+
"format": "email"
|
|
4187
|
+
}
|
|
4188
|
+
}
|
|
4189
|
+
},
|
|
4190
|
+
"ResetUsageForUserEmailResponse": {
|
|
4191
|
+
"type": "object",
|
|
4192
|
+
"required": [
|
|
4193
|
+
"deleted_events",
|
|
4194
|
+
"org_id",
|
|
4195
|
+
"user_id",
|
|
4196
|
+
"email",
|
|
4197
|
+
"display_name"
|
|
4198
|
+
],
|
|
4199
|
+
"properties": {
|
|
4200
|
+
"deleted_events": {
|
|
4201
|
+
"type": "integer",
|
|
4202
|
+
"format": "int64"
|
|
4203
|
+
},
|
|
4204
|
+
"org_id": {
|
|
4205
|
+
"type": "string",
|
|
4206
|
+
"format": "uuid"
|
|
4207
|
+
},
|
|
4208
|
+
"user_id": {
|
|
4209
|
+
"type": "string",
|
|
4210
|
+
"format": "uuid"
|
|
4211
|
+
},
|
|
4212
|
+
"email": {
|
|
4213
|
+
"type": "string"
|
|
4214
|
+
},
|
|
4215
|
+
"display_name": {
|
|
4216
|
+
"type": "string"
|
|
4217
|
+
}
|
|
4218
|
+
}
|
|
4219
|
+
},
|
|
4030
4220
|
"LoginRequest": {
|
|
4031
4221
|
"type": "object",
|
|
4032
4222
|
"required": [
|
|
@@ -4178,6 +4368,49 @@
|
|
|
4178
4368
|
}
|
|
4179
4369
|
}
|
|
4180
4370
|
},
|
|
4371
|
+
"ForgotPasswordRequest": {
|
|
4372
|
+
"type": "object",
|
|
4373
|
+
"required": [
|
|
4374
|
+
"email"
|
|
4375
|
+
],
|
|
4376
|
+
"properties": {
|
|
4377
|
+
"email": {
|
|
4378
|
+
"type": "string",
|
|
4379
|
+
"format": "email"
|
|
4380
|
+
}
|
|
4381
|
+
}
|
|
4382
|
+
},
|
|
4383
|
+
"ForgotPasswordResponse": {
|
|
4384
|
+
"type": "object",
|
|
4385
|
+
"properties": {
|
|
4386
|
+
"message": {
|
|
4387
|
+
"type": "string"
|
|
4388
|
+
}
|
|
4389
|
+
}
|
|
4390
|
+
},
|
|
4391
|
+
"ResetPasswordRequest": {
|
|
4392
|
+
"type": "object",
|
|
4393
|
+
"required": [
|
|
4394
|
+
"token",
|
|
4395
|
+
"new_password"
|
|
4396
|
+
],
|
|
4397
|
+
"properties": {
|
|
4398
|
+
"token": {
|
|
4399
|
+
"type": "string"
|
|
4400
|
+
},
|
|
4401
|
+
"new_password": {
|
|
4402
|
+
"type": "string"
|
|
4403
|
+
}
|
|
4404
|
+
}
|
|
4405
|
+
},
|
|
4406
|
+
"ResetPasswordResponse": {
|
|
4407
|
+
"type": "object",
|
|
4408
|
+
"properties": {
|
|
4409
|
+
"message": {
|
|
4410
|
+
"type": "string"
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
},
|
|
4181
4414
|
"MfaStatusResponse": {
|
|
4182
4415
|
"type": "object",
|
|
4183
4416
|
"properties": {
|
|
@@ -6545,8 +6778,83 @@
|
|
|
6545
6778
|
}
|
|
6546
6779
|
}
|
|
6547
6780
|
},
|
|
6781
|
+
"LlmMeteredInvoiceLine": {
|
|
6782
|
+
"type": "object",
|
|
6783
|
+
"description": "Metered line from Stripe upcoming invoice (usage detail when available).",
|
|
6784
|
+
"properties": {
|
|
6785
|
+
"description": {
|
|
6786
|
+
"type": "string",
|
|
6787
|
+
"nullable": true
|
|
6788
|
+
},
|
|
6789
|
+
"amount_cents": {
|
|
6790
|
+
"type": "integer",
|
|
6791
|
+
"format": "int64"
|
|
6792
|
+
},
|
|
6793
|
+
"quantity": {
|
|
6794
|
+
"type": "number",
|
|
6795
|
+
"nullable": true,
|
|
6796
|
+
"description": "Billed usage units when Stripe returns quantity (e.g. tokens)."
|
|
6797
|
+
},
|
|
6798
|
+
"price_nickname": {
|
|
6799
|
+
"type": "string",
|
|
6800
|
+
"nullable": true
|
|
6801
|
+
}
|
|
6802
|
+
}
|
|
6803
|
+
},
|
|
6804
|
+
"LlmBillingCycleUsage": {
|
|
6805
|
+
"type": "object",
|
|
6806
|
+
"description": "Accrued LLM charges for the current Stripe subscription period (upcoming invoice).",
|
|
6807
|
+
"properties": {
|
|
6808
|
+
"period_start": {
|
|
6809
|
+
"type": "string",
|
|
6810
|
+
"format": "date-time",
|
|
6811
|
+
"nullable": true
|
|
6812
|
+
},
|
|
6813
|
+
"period_end": {
|
|
6814
|
+
"type": "string",
|
|
6815
|
+
"format": "date-time",
|
|
6816
|
+
"nullable": true
|
|
6817
|
+
},
|
|
6818
|
+
"accrued_usage_cents": {
|
|
6819
|
+
"type": "integer",
|
|
6820
|
+
"format": "int64"
|
|
6821
|
+
},
|
|
6822
|
+
"currency": {
|
|
6823
|
+
"type": "string"
|
|
6824
|
+
},
|
|
6825
|
+
"metered_lines": {
|
|
6826
|
+
"type": "array",
|
|
6827
|
+
"items": {
|
|
6828
|
+
"$ref": "#/components/schemas/LlmMeteredInvoiceLine"
|
|
6829
|
+
}
|
|
6830
|
+
}
|
|
6831
|
+
}
|
|
6832
|
+
},
|
|
6833
|
+
"LlmCreditBalance": {
|
|
6834
|
+
"type": "object",
|
|
6835
|
+
"properties": {
|
|
6836
|
+
"available_cents": {
|
|
6837
|
+
"type": "integer",
|
|
6838
|
+
"format": "int64"
|
|
6839
|
+
},
|
|
6840
|
+
"ledger_cents": {
|
|
6841
|
+
"type": "integer",
|
|
6842
|
+
"format": "int64"
|
|
6843
|
+
},
|
|
6844
|
+
"used_cents": {
|
|
6845
|
+
"type": "integer",
|
|
6846
|
+
"format": "int64"
|
|
6847
|
+
},
|
|
6848
|
+
"currency": {
|
|
6849
|
+
"type": "string"
|
|
6850
|
+
}
|
|
6851
|
+
}
|
|
6852
|
+
},
|
|
6548
6853
|
"LlmTokenBillingStatus": {
|
|
6549
6854
|
"type": "object",
|
|
6855
|
+
"required": [
|
|
6856
|
+
"enabled"
|
|
6857
|
+
],
|
|
6550
6858
|
"properties": {
|
|
6551
6859
|
"enabled": {
|
|
6552
6860
|
"type": "boolean"
|
|
@@ -6557,6 +6865,12 @@
|
|
|
6557
6865
|
"active",
|
|
6558
6866
|
"inactive"
|
|
6559
6867
|
]
|
|
6868
|
+
},
|
|
6869
|
+
"credit_balance": {
|
|
6870
|
+
"$ref": "#/components/schemas/LlmCreditBalance"
|
|
6871
|
+
},
|
|
6872
|
+
"billing_cycle_usage": {
|
|
6873
|
+
"$ref": "#/components/schemas/LlmBillingCycleUsage"
|
|
6560
6874
|
}
|
|
6561
6875
|
}
|
|
6562
6876
|
},
|
package/openapi.yaml
CHANGED
|
@@ -2,7 +2,7 @@ openapi: 3.1.0
|
|
|
2
2
|
|
|
3
3
|
info:
|
|
4
4
|
title: 1Claw API
|
|
5
|
-
version: 2.
|
|
5
|
+
version: 2.6.0
|
|
6
6
|
description: |
|
|
7
7
|
Secure secret management for AI agents. Provides vaults, secrets,
|
|
8
8
|
policy-based access control, agent identity, Intents API,
|
|
@@ -105,6 +105,19 @@ paths:
|
|
|
105
105
|
post:
|
|
106
106
|
tags: [Authentication]
|
|
107
107
|
summary: Exchange agent credentials for JWT
|
|
108
|
+
description: |
|
|
109
|
+
Returns a short-lived EdDSA-signed JWT (`access_token`). Standard claims include `sub`
|
|
110
|
+
(`agent:<uuid>`), `org`, `scopes`, `vault_ids`, optional `intents_api_enabled`, optional
|
|
111
|
+
`shroud_enabled`, optional `llm_token_billing` / `stripe_customer_id` when org LLM billing is on.
|
|
112
|
+
|
|
113
|
+
When **`shroud_enabled`** is true, the JWT payload may include **`shroud_config`**: a JSON object
|
|
114
|
+
mirroring the agent row in Vault (same shape as `ShroudConfig` on `GET /v1/agents/{id}`).
|
|
115
|
+
**Shroud** (TEE proxy) decodes this on each LLM request and runs **PolicyEngine** after the
|
|
116
|
+
global inspection pipeline so per-agent limits and threat **block** actions apply without a
|
|
117
|
+
separate policy fetch. Re-exchange the agent token after changing `shroud_config` so the JWT
|
|
118
|
+
is fresh.
|
|
119
|
+
|
|
120
|
+
User JWTs from password, API key, or device flow do **not** include `shroud_config`.
|
|
108
121
|
operationId: agentToken
|
|
109
122
|
security: []
|
|
110
123
|
requestBody:
|
|
@@ -245,6 +258,51 @@ paths:
|
|
|
245
258
|
"400":
|
|
246
259
|
$ref: "#/components/responses/BadRequest"
|
|
247
260
|
|
|
261
|
+
/v1/auth/forgot-password:
|
|
262
|
+
post:
|
|
263
|
+
tags: [Authentication]
|
|
264
|
+
summary: Request password reset email
|
|
265
|
+
description: |
|
|
266
|
+
Always returns the same message whether or not the email exists (no account enumeration).
|
|
267
|
+
Only password-based accounts receive mail.
|
|
268
|
+
operationId: forgotPassword
|
|
269
|
+
security: []
|
|
270
|
+
requestBody:
|
|
271
|
+
required: true
|
|
272
|
+
content:
|
|
273
|
+
application/json:
|
|
274
|
+
schema:
|
|
275
|
+
$ref: "#/components/schemas/ForgotPasswordRequest"
|
|
276
|
+
responses:
|
|
277
|
+
"200":
|
|
278
|
+
description: Acknowledgement (check email if account exists)
|
|
279
|
+
content:
|
|
280
|
+
application/json:
|
|
281
|
+
schema:
|
|
282
|
+
$ref: "#/components/schemas/ForgotPasswordResponse"
|
|
283
|
+
|
|
284
|
+
/v1/auth/reset-password:
|
|
285
|
+
post:
|
|
286
|
+
tags: [Authentication]
|
|
287
|
+
summary: Set a new password using reset token from email
|
|
288
|
+
operationId: resetPassword
|
|
289
|
+
security: []
|
|
290
|
+
requestBody:
|
|
291
|
+
required: true
|
|
292
|
+
content:
|
|
293
|
+
application/json:
|
|
294
|
+
schema:
|
|
295
|
+
$ref: "#/components/schemas/ResetPasswordRequest"
|
|
296
|
+
responses:
|
|
297
|
+
"200":
|
|
298
|
+
description: Password updated
|
|
299
|
+
content:
|
|
300
|
+
application/json:
|
|
301
|
+
schema:
|
|
302
|
+
$ref: "#/components/schemas/ResetPasswordResponse"
|
|
303
|
+
"400":
|
|
304
|
+
$ref: "#/components/responses/BadRequest"
|
|
305
|
+
|
|
248
306
|
/v1/auth/google:
|
|
249
307
|
post:
|
|
250
308
|
tags: [Authentication]
|
|
@@ -1809,7 +1867,10 @@ paths:
|
|
|
1809
1867
|
tags: [Billing]
|
|
1810
1868
|
summary: Get LLM token billing status
|
|
1811
1869
|
operationId: getLlmTokenBilling
|
|
1812
|
-
description:
|
|
1870
|
+
description: >
|
|
1871
|
+
Returns whether LLM token billing is enabled, optional Stripe billing credit balance
|
|
1872
|
+
(metered scope), and estimated cycle usage from the upcoming invoice—including per-line
|
|
1873
|
+
metered rows when Stripe returns them (amounts; quantities such as tokens when present).
|
|
1813
1874
|
responses:
|
|
1814
1875
|
"200":
|
|
1815
1876
|
description: LLM token billing status
|
|
@@ -2452,6 +2513,54 @@ paths:
|
|
|
2452
2513
|
"403":
|
|
2453
2514
|
$ref: "#/components/responses/Forbidden"
|
|
2454
2515
|
|
|
2516
|
+
/v1/admin/usage/reset:
|
|
2517
|
+
post:
|
|
2518
|
+
tags: [Admin]
|
|
2519
|
+
summary: Reset all API usage events (testing)
|
|
2520
|
+
operationId: adminResetUsageEvents
|
|
2521
|
+
description: |
|
|
2522
|
+
Deletes every row in `usage_events` for all organizations. Resets monthly
|
|
2523
|
+
request counts used for free-tier / x402 quota. Does not change prepaid credit
|
|
2524
|
+
balances or Stripe. **Platform admin only** (same guard as other `/v1/admin/*` routes).
|
|
2525
|
+
responses:
|
|
2526
|
+
"200":
|
|
2527
|
+
description: Usage table cleared; returns number of deleted rows
|
|
2528
|
+
content:
|
|
2529
|
+
application/json:
|
|
2530
|
+
schema:
|
|
2531
|
+
$ref: "#/components/schemas/ResetUsageEventsResponse"
|
|
2532
|
+
"403":
|
|
2533
|
+
$ref: "#/components/responses/Forbidden"
|
|
2534
|
+
|
|
2535
|
+
/v1/admin/usage/reset-for-user:
|
|
2536
|
+
post:
|
|
2537
|
+
tags: [Admin]
|
|
2538
|
+
summary: Reset API usage for a user's organization
|
|
2539
|
+
operationId: adminResetUsageForUserByEmail
|
|
2540
|
+
description: |
|
|
2541
|
+
Looks up a registered user by email and deletes all `usage_events` rows for that
|
|
2542
|
+
user's `org_id`. Resets free-tier / monthly quota for the whole org (not other orgs).
|
|
2543
|
+
**Platform admin only.**
|
|
2544
|
+
requestBody:
|
|
2545
|
+
required: true
|
|
2546
|
+
content:
|
|
2547
|
+
application/json:
|
|
2548
|
+
schema:
|
|
2549
|
+
$ref: "#/components/schemas/ResetUsageForUserEmailRequest"
|
|
2550
|
+
responses:
|
|
2551
|
+
"200":
|
|
2552
|
+
description: Usage cleared for the user's org
|
|
2553
|
+
content:
|
|
2554
|
+
application/json:
|
|
2555
|
+
schema:
|
|
2556
|
+
$ref: "#/components/schemas/ResetUsageForUserEmailResponse"
|
|
2557
|
+
"400":
|
|
2558
|
+
$ref: "#/components/responses/BadRequest"
|
|
2559
|
+
"403":
|
|
2560
|
+
$ref: "#/components/responses/Forbidden"
|
|
2561
|
+
"404":
|
|
2562
|
+
$ref: "#/components/responses/NotFound"
|
|
2563
|
+
|
|
2455
2564
|
# ---------------------------------------------------------------------------
|
|
2456
2565
|
# Health
|
|
2457
2566
|
# ---------------------------------------------------------------------------
|
|
@@ -2591,6 +2700,42 @@ components:
|
|
|
2591
2700
|
detail:
|
|
2592
2701
|
type: string
|
|
2593
2702
|
|
|
2703
|
+
ResetUsageEventsResponse:
|
|
2704
|
+
type: object
|
|
2705
|
+
required: [deleted_events]
|
|
2706
|
+
properties:
|
|
2707
|
+
deleted_events:
|
|
2708
|
+
type: integer
|
|
2709
|
+
format: int64
|
|
2710
|
+
description: Number of usage_events rows removed
|
|
2711
|
+
|
|
2712
|
+
ResetUsageForUserEmailRequest:
|
|
2713
|
+
type: object
|
|
2714
|
+
required: [email]
|
|
2715
|
+
properties:
|
|
2716
|
+
email:
|
|
2717
|
+
type: string
|
|
2718
|
+
format: email
|
|
2719
|
+
|
|
2720
|
+
ResetUsageForUserEmailResponse:
|
|
2721
|
+
type: object
|
|
2722
|
+
required:
|
|
2723
|
+
[deleted_events, org_id, user_id, email, display_name]
|
|
2724
|
+
properties:
|
|
2725
|
+
deleted_events:
|
|
2726
|
+
type: integer
|
|
2727
|
+
format: int64
|
|
2728
|
+
org_id:
|
|
2729
|
+
type: string
|
|
2730
|
+
format: uuid
|
|
2731
|
+
user_id:
|
|
2732
|
+
type: string
|
|
2733
|
+
format: uuid
|
|
2734
|
+
email:
|
|
2735
|
+
type: string
|
|
2736
|
+
display_name:
|
|
2737
|
+
type: string
|
|
2738
|
+
|
|
2594
2739
|
# --- Auth ---
|
|
2595
2740
|
|
|
2596
2741
|
LoginRequest:
|
|
@@ -2692,6 +2837,35 @@ components:
|
|
|
2692
2837
|
new_password:
|
|
2693
2838
|
type: string
|
|
2694
2839
|
|
|
2840
|
+
ForgotPasswordRequest:
|
|
2841
|
+
type: object
|
|
2842
|
+
required: [email]
|
|
2843
|
+
properties:
|
|
2844
|
+
email:
|
|
2845
|
+
type: string
|
|
2846
|
+
format: email
|
|
2847
|
+
|
|
2848
|
+
ForgotPasswordResponse:
|
|
2849
|
+
type: object
|
|
2850
|
+
properties:
|
|
2851
|
+
message:
|
|
2852
|
+
type: string
|
|
2853
|
+
|
|
2854
|
+
ResetPasswordRequest:
|
|
2855
|
+
type: object
|
|
2856
|
+
required: [token, new_password]
|
|
2857
|
+
properties:
|
|
2858
|
+
token:
|
|
2859
|
+
type: string
|
|
2860
|
+
new_password:
|
|
2861
|
+
type: string
|
|
2862
|
+
|
|
2863
|
+
ResetPasswordResponse:
|
|
2864
|
+
type: object
|
|
2865
|
+
properties:
|
|
2866
|
+
message:
|
|
2867
|
+
type: string
|
|
2868
|
+
|
|
2695
2869
|
# --- MFA ---
|
|
2696
2870
|
|
|
2697
2871
|
MfaStatusResponse:
|
|
@@ -4329,14 +4503,74 @@ components:
|
|
|
4329
4503
|
limit:
|
|
4330
4504
|
type: integer
|
|
4331
4505
|
|
|
4506
|
+
LlmMeteredInvoiceLine:
|
|
4507
|
+
type: object
|
|
4508
|
+
description: Metered line from Stripe upcoming invoice (usage detail when available).
|
|
4509
|
+
properties:
|
|
4510
|
+
description:
|
|
4511
|
+
type: string
|
|
4512
|
+
nullable: true
|
|
4513
|
+
amount_cents:
|
|
4514
|
+
type: integer
|
|
4515
|
+
format: int64
|
|
4516
|
+
quantity:
|
|
4517
|
+
type: number
|
|
4518
|
+
nullable: true
|
|
4519
|
+
description: Billed usage units when Stripe returns quantity (e.g. tokens).
|
|
4520
|
+
price_nickname:
|
|
4521
|
+
type: string
|
|
4522
|
+
nullable: true
|
|
4523
|
+
|
|
4524
|
+
LlmBillingCycleUsage:
|
|
4525
|
+
type: object
|
|
4526
|
+
description: Accrued LLM charges for the current Stripe subscription period (upcoming invoice).
|
|
4527
|
+
properties:
|
|
4528
|
+
period_start:
|
|
4529
|
+
type: string
|
|
4530
|
+
format: date-time
|
|
4531
|
+
nullable: true
|
|
4532
|
+
period_end:
|
|
4533
|
+
type: string
|
|
4534
|
+
format: date-time
|
|
4535
|
+
nullable: true
|
|
4536
|
+
accrued_usage_cents:
|
|
4537
|
+
type: integer
|
|
4538
|
+
format: int64
|
|
4539
|
+
currency:
|
|
4540
|
+
type: string
|
|
4541
|
+
metered_lines:
|
|
4542
|
+
type: array
|
|
4543
|
+
items:
|
|
4544
|
+
$ref: "#/components/schemas/LlmMeteredInvoiceLine"
|
|
4545
|
+
|
|
4546
|
+
LlmCreditBalance:
|
|
4547
|
+
type: object
|
|
4548
|
+
properties:
|
|
4549
|
+
available_cents:
|
|
4550
|
+
type: integer
|
|
4551
|
+
format: int64
|
|
4552
|
+
ledger_cents:
|
|
4553
|
+
type: integer
|
|
4554
|
+
format: int64
|
|
4555
|
+
used_cents:
|
|
4556
|
+
type: integer
|
|
4557
|
+
format: int64
|
|
4558
|
+
currency:
|
|
4559
|
+
type: string
|
|
4560
|
+
|
|
4332
4561
|
LlmTokenBillingStatus:
|
|
4333
4562
|
type: object
|
|
4563
|
+
required: [enabled]
|
|
4334
4564
|
properties:
|
|
4335
4565
|
enabled:
|
|
4336
4566
|
type: boolean
|
|
4337
4567
|
subscription_status:
|
|
4338
4568
|
type: string
|
|
4339
4569
|
enum: [active, inactive]
|
|
4570
|
+
credit_balance:
|
|
4571
|
+
$ref: "#/components/schemas/LlmCreditBalance"
|
|
4572
|
+
billing_cycle_usage:
|
|
4573
|
+
$ref: "#/components/schemas/LlmBillingCycleUsage"
|
|
4340
4574
|
|
|
4341
4575
|
LlmCheckoutResponse:
|
|
4342
4576
|
type: object
|