Skip to content
API Reference · 用量与计费 API

用量与计费 API

查询用量统计、计费信息和管理支付。


用量统计

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

返回 token 用量和费用明细,可按日期范围、模型和 API Key 筛选。

最近请求

GET
$GET https://api.alltoken.ai/api-account/user/usage/recent?limit=20&cursor=<opaque>

created_at 倒序返回 request-level 调用历史。游标分页(非 offset,并发写入下稳定)。每条 item 含 id / created_at / model_id / model_name / api_key_name / total_tokens / cost_str / statussuccess / failed / refunded)。响应:{ items, next_cursor, has_more }。空 usage 返回 { items: [], has_more: false, next_cursor: "" },不返 404。

API 用量额度

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

返回可用于 API 调用的当前 API 用量额度。

购买 API 用量

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}

创建 API 用量套餐购买的结账会话。channelstripe)和 inner_id(套餐档位 1-4 = $10 / $50 / $100 / $250)为必填;currencylocale 可选。响应会返回 order_idcheckout_urlsession_id