读取 Thread 用量
通过同一个 Thread 读取持久化模型用量。只要 Session 记录存在,用量仍可读取;缺失指标为 null。运行时费用是估算而非账单。重新读取较早页面以更新进行中的观测。
GET
/threads/{threadId}/usage通过同一个 Thread 读取持久化模型用量。只要 Session 记录存在,用量仍可读取;缺失指标为 null。运行时费用是估算而非账单。重新读取较早页面以更新进行中的观测。
Authorization
publicApiBearer AuthorizationBearer <token>
使用 Authorization: Bearer msp_...。Project API key 只能配置、执行和访问本 Project 的 Agent、Session 和文件。密钥和账号管理需要 console 或 CLI 登录。旧账号 token 已被拒绝。
In: header
Path Parameters
threadId*string
create thread 返回的 Thread ID。v1 ID 是不带前缀的 ULID。
Match
^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$Format
ulidQuery Parameters
limit?integer
每页最多返回的用量观测条数。
Range
1 <= value <= 1000Default
100after?string
上一页返回的 nextCursor。
Match
^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$Format
ulidResponse Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/threads/01J00000000000000000000009/usage"{ "nextCursor": "string", "usage": [ { "id": "string", "runId": "string", "provider": "string", "model": "string", "status": "started", "inputTokens": 0, "outputTokens": 0, "cacheReadTokens": 0, "cacheCreationTokens": 0, "reportedCostUsd": 0, "usageContract": "string" } ]}{ "error": { "code": "agent_not_published", "message": "string" }}{ "error": { "code": "agent_not_published", "message": "string" }}{ "error": { "code": "agent_not_published", "message": "string" }}{ "error": { "code": "agent_not_published", "message": "string" }}{ "error": { "code": "agent_not_published", "message": "string" }}{ "error": { "code": "agent_not_published", "message": "string" }}{ "error": { "code": "agent_not_published", "message": "string" }}