@1claw/openapi-spec 0.16.1 → 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 CHANGED
@@ -42,8 +42,9 @@ import spec from "@1claw/openapi-spec/openapi.json";
42
42
 
43
43
  ## What's in the spec (v0.16.x)
44
44
 
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.
45
46
  - **Auth — password reset** — `POST /v1/auth/forgot-password`, `POST /v1/auth/reset-password` (public; anti-enumeration on forgot)
46
- - **Billing — LLM token billing** — `GET /v1/billing/llm-token-billing`, `POST .../subscribe`, `POST .../disable` (Stripe AI Gateway add-on; optional org feature)
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)
47
48
  - **Treasury** — Safe multisig treasuries: `POST/GET /v1/treasury`, `GET/PATCH/DELETE /v1/treasury/{id}`, signers, agent access requests (`requests[]` on list)
48
49
  - **Vaults** — CRUD, CMEK enable/disable, key rotation with job tracking
49
50
  - **Secrets** — CRUD, versioning, CMEK-encrypted flag
package/openapi.json CHANGED
@@ -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": {
@@ -2893,7 +2894,7 @@
2893
2894
  ],
2894
2895
  "summary": "Get LLM token billing status",
2895
2896
  "operationId": "getLlmTokenBilling",
2896
- "description": "Returns whether LLM token billing is enabled for the caller's org.",
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",
2897
2898
  "responses": {
2898
2899
  "200": {
2899
2900
  "description": "LLM token billing status",
@@ -6777,8 +6778,83 @@
6777
6778
  }
6778
6779
  }
6779
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
+ },
6780
6853
  "LlmTokenBillingStatus": {
6781
6854
  "type": "object",
6855
+ "required": [
6856
+ "enabled"
6857
+ ],
6782
6858
  "properties": {
6783
6859
  "enabled": {
6784
6860
  "type": "boolean"
@@ -6789,6 +6865,12 @@
6789
6865
  "active",
6790
6866
  "inactive"
6791
6867
  ]
6868
+ },
6869
+ "credit_balance": {
6870
+ "$ref": "#/components/schemas/LlmCreditBalance"
6871
+ },
6872
+ "billing_cycle_usage": {
6873
+ "$ref": "#/components/schemas/LlmBillingCycleUsage"
6792
6874
  }
6793
6875
  }
6794
6876
  },
package/openapi.yaml CHANGED
@@ -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:
@@ -1854,7 +1867,10 @@ paths:
1854
1867
  tags: [Billing]
1855
1868
  summary: Get LLM token billing status
1856
1869
  operationId: getLlmTokenBilling
1857
- description: Returns whether LLM token billing is enabled for the caller's org.
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).
1858
1874
  responses:
1859
1875
  "200":
1860
1876
  description: LLM token billing status
@@ -4487,14 +4503,74 @@ components:
4487
4503
  limit:
4488
4504
  type: integer
4489
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
+
4490
4561
  LlmTokenBillingStatus:
4491
4562
  type: object
4563
+ required: [enabled]
4492
4564
  properties:
4493
4565
  enabled:
4494
4566
  type: boolean
4495
4567
  subscription_status:
4496
4568
  type: string
4497
4569
  enum: [active, inactive]
4570
+ credit_balance:
4571
+ $ref: "#/components/schemas/LlmCreditBalance"
4572
+ billing_cycle_usage:
4573
+ $ref: "#/components/schemas/LlmBillingCycleUsage"
4498
4574
 
4499
4575
  LlmCheckoutResponse:
4500
4576
  type: object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1claw/openapi-spec",
3
- "version": "0.16.1",
3
+ "version": "0.16.3",
4
4
  "description": "OpenAPI 3.1.0 specification for the 1Claw Vault API — generate clients in any language",
5
5
  "license": "MIT",
6
6
  "repository": {