Usage & Billing API
Query usage stats, billing information, and manage payments.
Usage statistics
$GET https://api.alltoken.ai/api-account/user/usageReturns token usage, cost summary, daily chart data, and model breakdown. Query parameters: start_date and end_date in YYYY-MM-DD format.
Recent requests
$GET https://api.alltoken.ai/api-account/user/usage/recent?limit=20&cursor=<opaque>Returns request-level call history ordered by created_at DESC. Cursor pagination (non-offset, stable under concurrent writes). Each item includes id, created_at, model_id, model_name, api_key_name, total_tokens, cost_str, and status (success / failed / refunded). Response: { items, next_cursor, has_more }. Empty usage returns { items: [], has_more: false, next_cursor: "" } — never 404.
Billing summary
$GET https://api.alltoken.ai/api-account/user/billingReturns plan, credit balance, platform fee rate, payment methods, and invoices.
Credit balance
$GET https://api.alltoken.ai/api-account/user/balanceReturns current credit balance available for API usage.
Add credits
$POST https://api.alltoken.ai/api-account/user/billing/create-checkout| 1 | { |
| 2 | "credit_usd": 100, |
| 3 | "currency": "USD" |
| 4 | } |
Creates a checkout session. credit_usd and currency are required; optional success_url and cancel_url override the redirect targets. The response includes order_id, checkout_url, and session_id.
Old field amount is kept as fallback for backward compatibility.
Payment status
$GET https://api.alltoken.ai/api-account/user/billing/payment-status/{order_id}Returns the status of one payment order.
Payment orders
$GET https://api.alltoken.ai/api-account/user/billing/orders?limit=20&offset=0Lists payment orders. Query parameters: limit (default 20, max 100) and offset (default 0).
Billing document
$POST https://api.alltoken.ai/api-account/user/billing/document| 1 | { |
| 2 | "order_id": "ord_123", |
| 3 | "type": "invoice" |
| 4 | } |
Generates an invoice or receipt document URL for a payment order. order_id is required; type can be invoice or receipt.