Usage and billing
Return the authenticated user's accounting balances and insolvency state.
Authorization
bearerAuth In: header
Response Body
application/json
curl -X GET "https://example.com/v1/accounting/user"{ "balance": { "aiCreditMicrousd": 1, "ciCreditMicrousd": 1, "hardMicrousd": 1, "hasUnpricedUsage": false, "insolvent": false, "pendingAiMicrousd": 1, "pendingCiMicrousd": 1, "pendingMicrousd": 1, "softMicrousd": 1, "totalMicrousd": 1 }, "ownerId": "abc123", "ownerType": "organization"}List personal daily charge allocations, optionally by category.
Authorization
bearerAuth In: header
Query Parameters
Optional spending category.
Value in
- "ai"
- "ci"
Maximum daily allocation rows.
int641 <= value <= 500100Response Body
application/json
curl -X GET "https://example.com/v1/accounting/user/charges?category=ci&limit=2"{ "items": [ { "amountMicrousd": 1, "category": "ci", "date": "1970-01-01", "fundingSource": "soft" } ]}Return personal resource spending chart data.
Authorization
bearerAuth In: header
Query Parameters
Chart timeframe.
"last_24_hours"Value in
- "last_24_hours"
- "last_7_days"
- "month_to_date"
Response Body
application/json
curl -X GET "https://example.com/v1/accounting/user/chart?timeframe=last_7_days"{ "from": "1970-01-01T00:00:01Z", "points": [ { "aiCacheReadTokens": 1, "aiCacheWriteTokens": 1, "aiInputTokens": 1, "aiMicrousd": 1, "aiOutputTokens": 1, "ciMicrousd": 1, "ciMinutes": 1, "hasUnpricedUsage": false, "timestamp": "1970-01-01T00:00:01Z", "totalMicrousd": 1 } ], "timeframe": "last_7_days", "to": "1970-01-01T00:00:01Z"}Redeem a category-specific coupon for the authenticated user.
Authorization
bearerAuth In: header
Request Body
application/json
Coupon redemption request body.
TypeScript Definitions
Use the request body type in TypeScript.
Category-credit coupon redemption request.
Response Body
application/json
curl -X POST "https://example.com/v1/accounting/user/coupons/redeem" \ -H "Content-Type: application/json" \ -d '{ "code": "aa" }'{ "amountMicrousd": 1, "balance": { "aiCreditMicrousd": 1, "ciCreditMicrousd": 1, "hardMicrousd": 1, "hasUnpricedUsage": false, "insolvent": false, "pendingAiMicrousd": 1, "pendingCiMicrousd": 1, "pendingMicrousd": 1, "softMicrousd": 1, "totalMicrousd": 1 }, "category": "ci", "code": "abc123"}curl -X GET "https://example.com/v1/ai/credits""abc123"Authorization
bearerAuth In: header
Query Parameters
Maximum recent runs to return. Defaults to 25.
int6425Response Body
application/json
curl -X GET "https://example.com/v1/ai/runs?limit=1""abc123"Billing summary for the authenticated user's personal workspace.
Authorization
bearerAuth In: header
Response Body
application/json
curl -X GET "https://example.com/v1/billing/user""abc123"Start Stripe Checkout for a personal subscription plan.
Authorization
bearerAuth In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/v1/billing/user/checkout" \ -H "Content-Type: application/json" \ -d '{ "cancelUrl": "aa", "planKey": "aa", "successUrl": "aa" }'"abc123"Open the Stripe customer portal for the authenticated user.
Authorization
bearerAuth In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/v1/billing/user/portal" \ -H "Content-Type: application/json" \ -d '{ "returnUrl": "aa" }'"abc123"