使用情况 API
列出你所在团队已完成的 API 任务以及每个任务消耗的积分,用于账单导出和成本报告。
从 v1 迁移?参数和记录与 GET /openapi/v1/usage/tasks 相同。响应是 {"data": [...], "has_more": ...},而不是裸数组。请参阅迁移参考中的 Endpoint 路径。
要调用此 endpoint,需使用 Studio 或 Enterprise 团队中某位活跃成员的 API key。任何成员都可以调用它,不仅限于所有者和管理员。使用其他任何 API key 发出请求将返回 403。
获取用量记录
返回你团队用量记录的一页数据,默认按最新优先排序。如果不传 start_time 和 end_time,记录将覆盖最近 30 天。调用此 endpoint 是免费的。
这些记录包括以下任务:
- 以
SUCCEEDED或FAILED结束的 API 任务 - 团队所有当前成员的任务,无论使用的是哪个 API key
- 你已删除的任务,以及文件已过期的任务
这些记录不包括以下任务:
- 仍处于
PENDING或IN_PROGRESS状态的任务,以及CANCELED任务 - 已离开团队的成员的任务
此外,即使以下任务消耗了同样的积分,记录中也不包括:
- Creative Lab 任务
- 由 Meshy 的 AI 代理运行的任务
- 在 Meshy Web App 中完成的工作
任务会在其完成后出现,归入其 created_at 所在的时间窗口。在对账前,请重新拉取近期的时间窗口。
如果你的团队设有数据保留期限,时间窗口的起点不会早于该期限所允许的范围。
Request
# List September's usage, 50 records per page
curl "https://api.meshy.ai/openapi/v2/usage/tasks?page_size=50&start_time=2026-09-01T00:00:00Z&end_time=2026-10-01T00:00:00Z" \
-H "Authorization: Bearer ${MESHY_API_KEY}"
Response
{
"data": [
{
"task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
"endpoint": "image-to-3d",
"status": "SUCCEEDED",
"created_at": 1790640079880,
"finished_at": 1790640138211,
"consumed_credits": 30,
"api_key_name": "production",
"api_key_suffix": "a1b2",
"metadata": {
"user": "alex@example.com",
"team": "fab"
}
},
{
"task_id": "018a210d-1c22-7e0f-9d3a-4a5b6c7d8e9f",
"endpoint": "text-to-3d",
"status": "FAILED",
"created_at": 1790639000000,
"finished_at": 1790639030000,
"consumed_credits": 0,
"api_key_name": "production",
"api_key_suffix": "a1b2",
"metadata": {}
}
],
"has_more": true
}
参数
- Name
- start_time
- Type
- string
- Description
时间窗口的起点,使用 RFC 3339 的 timestamp 格式,例如
2026-09-01T00:00:00Z。记录将包括在该时间点或之后创建的任务。若省略此参数,时间窗口将从end_time之前 30 天开始。时间窗口最长可跨越 366 天。更长的窗口会返回
400,因此请将较长的导出拆分为多个窗口。在 URL 中,请将偏移量(例如
+08:00)中的+写作%2B,或使用Z。否则+会被解读为空格,请求将返回400。
- Name
- end_time
- Type
- string
- Description
时间窗口的终点,使用 RFC 3339 的 timestamp 格式。记录将包括在此时间之前创建的任务。若省略此参数,时间窗口将以你发起请求的时间作为终点。
- Name
- endpoints
- Type
- string
- Description
要包含的 endpoint 列表,以逗号分隔,名称与
endpoint字段所使用的名称相同。若省略此参数,则包含所有 endpoint。未知名称将返回400。可用的值:
text-to-3d:一键式、preview 及 refine 的 Text to 3D 任务text-to-3d-preview:仅 preview 任务text-to-3d-refine:仅 refine 任务image-to-3dmulti-image-to-3dremeshconvertresizeuv-unwrapretexturerigrig-checkanimatetext-to-motiontext-to-imageimage-to-imageprint-multi-colorprint-analyzeprint-repairprint-splitrelief
- Name
- status
- Type
- string
- Description
要包含的状态,
SUCCEEDED或FAILED。若省略此参数,则同时包含两者。其他任何值都会返回400。
- Name
- page_num
- Type
- integer
- 默认值 1
- Description
要返回的页码,范围从
1到255。大于255的值将返回400。一个时间窗口最多容纳 255 页,因此请将较大的导出拆分为更短的时间窗口。
- Name
- page_size
- Type
- integer
- 默认值 10
- Description
每页的记录数量,范围从
1到100。101到255之间的值将返回 100 条记录,大于255的值将返回400。
- Name
- sort_by
- Type
- string
- 默认值 -created_at
- Description
排序方式。
可用的值:
-created_at:最新优先+created_at:最旧优先
在 URL 中,请将
+写作%2B。否则+会被解读为空格,请求将返回400。
返回值
- Name
- data
- Type
- array
- Description
本页的用量记录。如果没有记录,则为空数组。
- Name
- has_more
- Type
- boolean
- Description
是否还有下一页。如果为
true,请使用page_num加一来请求下一页。到最后一页时为false。
响应中不包含总数。
失败情形
- Name
400 - Bad Request- Description
某个参数无效。错误消息会说明是哪一个。例如:
start_time must be an RFC 3339 timestamp, e.g. 2026-01-01T00:00:00Zend_time must be after start_timetime range cannot exceed 1 yearinvalid endpoint: "rigging"invalid sort_by: " created_at"
修正该参数后重新发送请求。参见Errors。
- Name
401 - Unauthorized- Description
API key 缺失或无效。请检查
Authorization请求头。
- Name
403 - Forbidden- Description
该 API key 所属账户不是 Studio 或 Enterprise 团队的活跃成员。错误消息为
This endpoint is available on Studio and Enterprise plans。请使用 Studio 或 Enterprise 团队成员的 API key。
- Name
429 - Too Many Requests- Description
你发送的请求过多。请等待
Retry-After中指定的秒数后再重试。
使用记录对象
Usage record
{
"task_id": "018a210d-8ba4-705c-b111-1f1776f7f578",
"endpoint": "image-to-3d",
"status": "SUCCEEDED",
"created_at": 1790640079880,
"finished_at": 1790640138211,
"consumed_credits": 30,
"api_key_name": "production",
"api_key_suffix": "a1b2",
"metadata": {
"user": "alex@example.com",
"team": "fab"
}
}
- Name
- task_id
- Type
- string
- Description
任务 ID。要读取你创建的任务,可使用
GET /openapi/v2/tasks/{id},直到该任务被删除或过期为止。团队成员创建的任务在此处会返回404,因为每个 API key 只能读取其所属账户自己的任务。
- Name
- endpoint
- Type
- string
- Description
任务的类型,例如
image-to-3d、rig或print-repair。一次性调用的 Text to 3D 任务会显示为text-to-3d,而 preview 或 refine 任务会显示为text-to-3d-preview或text-to-3d-refine。较旧的记录可能带有已停用 endpoint 的名称,这些名称不被
endpoints筛选器接受。
- Name
- status
- Type
- string
- Description
任务的最终状态,
SUCCEEDED或FAILED。
- Name
- created_at
- Type
- integer
- Description
任务创建的时间,以 Unix 毫秒表示。
- Name
- finished_at
- Type
- integer | null
- Description
任务完成的时间,以 Unix 毫秒表示。如果任务没有完成时间,则为
null。
- Name
- consumed_credits
- Type
- integer
- Description
该任务消耗的积分数量(退款后)。失败的任务,以及诸如可打印性分析这类免费任务为
0。
- Name
- api_key_name
- Type
- string
- Description
运行该任务的 API key 的名称。对于通过 Meshy CLI 登录运行的任务,该值为
Meshy CLI。以下情况下为空字符串:
- 该任务从未被计费,例如可打印性分析任务,它是免费的。
- 该 API key 已被删除。
- 该任务是通过其他应用的登录方式运行的。
- 该 API key 是在最近几分钟内创建的。
- Name
- api_key_suffix
- Type
- string
- Description
该 API key 的最后四个字符,用于区分名称相同的 key。当
api_key_name为空时,以及对于 Meshy CLI 登录,该值为空字符串。
- Name
- metadata
- Type
- object
- Description
任务创建时在
X-Meshy-Metadata标头中发送的标签。如果没有则为{}。请参阅元数据。