目录 · API 文档

GET /v1/account/usage

查询近 30 天该 key 的请求明细 + 累计花费,用 keyset 分页向前翻。

查询参数

参数类型必填说明
beforeISO 8601 时间戳取此时间之前的记录(分页使用)

响应(200)

{
  "window_days": 30,
  "total_requests": 142,
  "total_tcoin_spent": 284,
  "items": [
    {
      "id": "cmoxxx",
      "endpoint": "/v1/images/generations",
      "method": "POST",
      "status_code": 200,
      "tcoin_spent": 2,
      "generation_id": "cmofjncu7007910z3...",
      "duration_ms": 12340,
      "error_code": null,
      "created": 1714123456,
      "created_iso": "2026-04-26T01:24:16.000Z"
    }
  ],
  "next_before": "2026-04-25T18:32:11.123Z"
}

分页

响应里 next_before 不为 null 表示还有更老的记录,把它原样作为下次请求的 ?before= 即可。

示例

curl "https://aiimg.top/v1/account/usage" \
  -H "Authorization: Bearer $AIIMG_API_KEY"

# 翻下一页
curl "https://aiimg.top/v1/account/usage?before=2026-04-25T18:32:11.123Z" \
  -H "Authorization: Bearer $AIIMG_API_KEY"