API 文件 · 入門
Base URL 與驗證
Bearer Key、請求格式、ID 與金額慣例、分頁。
所有 /v1 API 都使用 Bearer 驗證,請求標頭格式為 Authorization: Bearer sk-…。伺服器只保存 Key 的雜湊值,建立時會完整顯示一次,之後無法再查看;遺失時請撤銷後重新建立。
- Base URL:
https://cn-api.aitoken.tools/v1 - 請求與回應皆為 JSON,欄位採
snake_case,時間為 RFC 3339 UTC 格式,例如2026-10-30T03:30:00Z。 - 金額為 6 位小數的字串,例如
"3.200000",且一律附帶currency。請勿先解析成浮點數再計算。 - 對外 ID 帶有類型前綴:
task_、asset_、grp_、key_、evt_、req_。 - 每個回應都帶有
X-Request-Id,聯絡營運團隊排查問題時請提供此值。
列表與分頁
列表 API 採游標分頁:?limit=20&after=<cursor>,回應格式為 { data, has_more, next_cursor }。has_more 為 false 時表示已是最後一頁。
請勿在瀏覽器或用戶端中使用 Key
Key 可以直接消耗你的額度。請只從自己的伺服器端呼叫 API,並透過環境變數注入 Key。
cURL
curl "https://cn-api.aitoken.tools/v1/videos/generations?limit=20" \
-H "Authorization: Bearer $AITOKEN_API_KEY"
# 回應
# { "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"