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.

Recent requests

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

Returns plan, API usage quota, platform fee rate, payment methods, and invoices.

API usage quota

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

Returns current API usage quota available for API requests.

Buy API Usage

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

Creates a checkout session for an API usage package purchase. channel (stripe) and inner_id (package tier 1-4 = $10 / $50 / $100 / $250) are required; currency and locale are optional. 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.