API 参考 · 6. 用量与计量 · summarizeUsage

按时间或任务汇总当前 API Key 用量

GET/open/v1/usage/summary预览scope: viewUsage

这是预览能力:字段与行为可能在后续 minor 版本中调整,调整会写进更新日志。近 30 天内新增的能力,或在生产环境 90 天内没有调用记录的能力,标为「预览」;其余为「稳定」。预览能力的字段与行为可能在后续 minor 版本中调整,调整会写进更新日志。

可提供完整 from/to 时间范围,或使用 job_id/client_request_id 查询具体任务;时间区间为左闭右开。

请求

鉴权:请求头 X-Aistrong-Key;可选 X-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._:-]+$调用方生成的幂等请求标识;相同调用方重试时保持不变。

响应

JSON 响应统一为信封结构:success / data / error / metering / request_id;下表描述 data。

200请求已成功处理application/json
展开 data 结构(52 个字段)
字段类型约束说明
dataobject不接受额外字段
audioarray<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_generationobject不接受额外字段
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请求参数无效
401API Key 无效
403API Key 无权限
500服务内部异常
502上游服务异常
503能力暂不可用
504上游服务超时

错误体的 error.code 取值见错误码。