用量
账号的用量记录和合计。
列出用量记录
Section titled “列出用量记录”GET /v3/usage/records
分页返回账号的用量记录,每一轮一条,新的在前。
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
api_key_id |
查询参数 | 字符串 | 否 | 只包含用这个 API 密钥创建的轮次 |
created_from |
查询参数 | 时间 | 否 | 只包含在这个时间或之后创建的轮次 |
created_to |
查询参数 | 时间 | 否 | 只包含在这个时间之前创建的轮次 |
round_kind |
查询参数 | 字符串 | 否 | 只包含这个种类的轮次 |
billed |
查询参数 | 布尔值 | 否 | true 时只包含计入了时长的轮次,false 时只包含计入为零的轮次。还没有结束的轮次不属于这两者中的任何一个 |
limit |
查询参数 | 整数 | 否 | 一页的条数。默认是 30 |
cursor |
查询参数 | 字符串 | 否 | 上一页响应里的 next_cursor。省略时读取第一页 |
成功时返回 200,响应体是一页用量记录。
| 字段 | 类型 | 说明 |
|---|---|---|
data |
用量记录的数组 | 这一页的用量记录 |
next_cursor |
字符串 或 null | 读取下一页时作为参数 cursor 传回的值。已经是最后一页时为 null |
出错时的响应体见错误。
| 状态码 | 含义 |
|---|---|
401 |
没有凭据,或者凭据无效 |
403 |
凭据有效,但这个操作不被允许 |
422 |
请求的内容不合规则 |
429 |
请求太频繁 |
curl "https://video-generation.api.truezir.com/v3/usage/records" \ -H "Authorization: Bearer $API_KEY"{ "data": [ { "id": "usage-c3a91f5e7d2b4a8c9e6f0b1d4a7c2e58", "video_id": "video-3f9c1a7b2e4d4c6f8a0b9d1e5c7f3a21", "round_id": "round-5d2a8c41e7b94f0d9a3b6c1e8f2d7a90", "round_kind": "initial", "api_key_id": "key-8e1f6b3a9c2d4e7f8a5b0c4d1e6f9a37", "billed_seconds": 198.4, "started_at": "2026-11-20T06:30:04Z", "finished_at": "2026-11-20T06:52:41Z", "run_seconds": 1357, "created_at": "2026-11-20T06:30:00Z" } ], "next_cursor": null}读取用量合计
Section titled “读取用量合计”GET /v3/usage/summary
返回账号在一段时间里的用量合计,以及按 API 密钥分开的合计。省略两个时间参数时合计全部轮次。
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
created_from |
查询参数 | 时间 | 否 | 只包含在这个时间或之后创建的轮次 |
created_to |
查询参数 | 时间 | 否 | 只包含在这个时间之前创建的轮次 |
成功时返回 200,响应体是用量合计,结构见用量合计。
出错时的响应体见错误。
| 状态码 | 含义 |
|---|---|
401 |
没有凭据,或者凭据无效 |
403 |
凭据有效,但这个操作不被允许 |
422 |
请求的内容不合规则 |
429 |
请求太频繁 |
curl "https://video-generation.api.truezir.com/v3/usage/summary" \ -H "Authorization: Bearer $API_KEY"{ "round_count": 12, "billed_seconds": 1830.6, "run_seconds": 15240, "by_api_key": [ { "round_count": 12, "billed_seconds": 1830.6, "run_seconds": 15240, "api_key_id": "key-8e1f6b3a9c2d4e7f8a5b0c4d1e6f9a37", "api_key_name": "课程制作" } ]}