Skip to content
API Reference · Usage & Billing API

Usage & Billing API

Query usage stats, billing information, and manage payments.


Usage statistics

GET
$GET https://api.alltoken.ai/api-account/user/usage

Returns token usage, cost summary, daily chart data, and model breakdown. Query parameters: start_date and end_date in YYYY-MM-DD format.

Billing summary

GET
$GET https://api.alltoken.ai/api-account/user/billing

Returns plan, credit balance, platform fee rate, payment methods, and invoices.

Credit balance

GET
$GET https://api.alltoken.ai/api-account/user/balance

Returns current credit balance available for API usage.

Add credits

POST
$POST https://api.alltoken.ai/api-account/user/billing/create-checkout
Body
1{
2 "amount": 100,
3 "currency": "USD"
4}

Creates a Stripe checkout session. amount and currency are required; optional success_url and cancel_url override the redirect targets. The response includes order_id, checkout_url, and session_id.

Payment status

GET
$GET https://api.alltoken.ai/api-account/user/billing/payment-status/{order_id}

Returns the status of one payment order.

Payment orders

GET
$GET https://api.alltoken.ai/api-account/user/billing/orders?limit=20&offset=0

Lists payment orders. Query parameters: limit (default 20, max 100) and offset (default 0).

Billing document

POST
$POST https://api.alltoken.ai/api-account/user/billing/document
Body
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.