API docs · Getting started
Base URL & authentication
Bearer keys, request format, ID and amount conventions, pagination.
All /v1 endpoints use bearer authentication with the header Authorization: Bearer sk-…. The server stores only a hash of each key. The full key is shown once, at creation, and cannot be retrieved later; if you lose it, revoke it and create a new one.
- Base URL:
https://cn-api.aitoken.tools/v1 - Requests and responses are JSON with
snake_casefields. Timestamps are RFC 3339 in UTC, e.g.2026-10-30T03:30:00Z. - Amounts are strings with six decimal places, e.g.
"3.200000", and always come with acurrency. Do not parse them as floating-point numbers before doing arithmetic. - Public IDs carry a type prefix:
task_,asset_,grp_,key_,evt_,req_. - Every response includes an
X-Request-Idheader. Include it when you contact us about an issue.
Lists and pagination
List endpoints use cursor-based pagination: ?limit=20&after=<cursor>. The response has the shape { data, has_more, next_cursor }; has_more is false on the last page.
Never use a key in a browser or client app
A key can spend your quota directly. Call the API only from your own backend and inject the key through an environment variable.
cURL
curl "https://cn-api.aitoken.tools/v1/videos/generations?limit=20" \
-H "Authorization: Bearer $AITOKEN_API_KEY"
# Response
# { "data": [ ... ], "has_more": true, "next_cursor": "c_xxx" }
curl "https://cn-api.aitoken.tools/v1/videos/generations?limit=20&after=c_xxx" \
-H "Authorization: Bearer $AITOKEN_API_KEY"