按时间或任务汇总当前 API Key 用量
GET/open/v1/usage/summary预览scope: viewUsage
这是预览能力:字段与行为可能在后续 minor 版本中调整,调整会写进更新日志。近 30 天内新增的能力,或在生产环境 90 天内没有调用记录的能力,标为「预览」;其余为「稳定」。预览能力的字段与行为可能在后续 minor 版本中调整,调整会写进更新日志。
可提供完整 from/to 时间范围,或使用 job_id/client_request_id 查询具体任务;时间区间为左闭右开。
请求
参数
| 名称 | 位置 | 类型 | 约束 | 说明 |
|---|---|---|---|---|
| from | 查询串 | string(date-time) | ||
| to | 查询串 | string(date-time) | ||
| capability | 查询串 | string | 长度≤128 | |
| job_id | 查询串 | string | 正则 ^[a-f0-9]{32}$ | |
| client_request_id | 查询串 | string | 长度≥1;长度≤128;正则 ^[A-Za-z0-9._:-]+$ | 调用方生成的幂等请求标识;相同调用方重试时保持不变。 |
响应
200请求已成功处理
展开 data 结构(52 个字段)
| 字段 | 类型 | 约束 | 说明 |
|---|---|---|---|
| data | object | 不接受额外字段 | |
| audio | array<object> | ||
| [ ] | object | 不接受额外字段 | |
| provider必填 | string | ||
| model_id必填 | string | ||
| call_count必填 | integer | ≥1 | |
| unknown_call_count必填 | integer | ≥0 | |
| audio_duration_seconds必填 | integer | null | ≥0 | |
| input_tokens必填 | integer | null | ≥0 | |
| output_tokens必填 | integer | null | ≥0 | |
| usage_status必填 | string | 枚举 "reported" / "partial" / "unavailable" | |
| image_generation | object | 不接受额外字段 | |
| attempt_count必填 | integer | ≥1 | |
| unknown_result_count必填 | integer | ≥0 | |
| image_count必填 | integer | null | ≥0 | |
| usage_status必填 | string | 枚举 "reported" / "partial" / "unavailable" | |
| from必填 | string(date-time) | null(date-time) | ||
| to必填 | string(date-time) | null(date-time) | ||
| capabilities必填 | array<object> | ||
| [ ] | object | 不接受额外字段 | |
| capability必填 | string | ||
| request_count必填 | integer | ≥0 | |
| gateway_call_count必填 | integer | ≥0 | |
| model_call_count必填 | integer | ≥0 | |
| input_tokens必填 | integer | null | ≥0 | |
| output_tokens必填 | integer | null | ≥0 | |
| ocr_page_count必填 | integer | null | ≥0 | |
| total_duration_ms必填 | integer | null | ≥0 | |
| reported_count必填 | integer | ≥0 | |
| partial_count必填 | integer | ≥0 | |
| unavailable_count必填 | integer | ≥0 | |
| pending_count必填 | integer | ≥0 | |
| not_applicable_count必填 | integer | ≥0 | |
| models必填 | array<object> | ||
| [ ] | object | 不接受额外字段 | |
| provider_code必填 | string | null | ||
| model_type必填 | string | 枚举 "chat" / "embedding" / "rerank" / "vision" | |
| model_id必填 | string | null | ||
| call_count必填 | integer | ≥0 | |
| input_tokens必填 | integer | null | ≥0 | |
| output_tokens必填 | integer | null | ≥0 | |
| duration_ms必填 | integer | null | ≥0 | |
| usage_status必填 | string | 枚举 "reported" / "partial" / "unavailable" | |
| ocr必填 | array<object> | ||
| [ ] | object | 不接受额外字段 | |
| provider_code必填 | string | ||
| service_code必填 | string | ||
| call_count必填 | integer | ≥0 | |
| cache_hit_count必填 | integer | ≥0 | |
| page_count必填 | integer | null | ≥0 | |
| duration_ms必填 | integer | null | ≥0 | |
| usage_status必填 | string | 枚举 "reported" / "partial" / "unavailable" |
错误状态
| HTTP | 含义 |
|---|---|
| 400 | 请求参数无效 |
| 401 | API Key 无效 |
| 403 | API Key 无权限 |
| 500 | 服务内部异常 |
| 502 | 上游服务异常 |
| 503 | 能力暂不可用 |
| 504 | 上游服务超时 |