列出用量事件
GET
/organization/v1/events● 支持请求参数
starting_atstring必填query: 窗口开始(含),UTC ISO 8601,如 2026-09-26T00:00:00Z
ending_atstring必填query: 窗口结束(不含),UTC ISO 8601;距 starting_at 最多 93 天(费用明细导出无此限制)
limitinteger可选query: 每页条数,1–100,默认 25
pagestring可选query: 上一页响应里 next_page 给出的不透明游标,原样带回即可
返回
200 page
错误按 problem+json 格式返回,参见 错误码
请求示例
curl
curl "https://api.deepraxis.com/organization/v1/events?starting_at=2026-09-26T00:00:00Z&ending_at=2026-09-27T00:00:00Z&limit=2" \
-H "Authorization: Bearer $PRAXIS_API_KEY"Python
import requests
opts = dict(
base_url="https://api.deepraxis.com/organization/v1",
api_key="$PRAXIS_API_KEY",
)
# /organization 是我们自己的组织用量形状,直接发 HTTP 请求(Bearer 认证)
resp = requests.get(
f"{opts['base_url']}/events?starting_at=2026-09-26T00:00:00Z&ending_at=2026-09-27T00:00:00Z&limit=2",
headers={"Authorization": f"Bearer {opts['api_key']}"},
)
print(resp.status_code, resp.json())TypeScript
const opts = {
baseURL: "https://api.deepraxis.com/organization/v1",
apiKey: "$PRAXIS_API_KEY",
};
// /organization 是我们自己的组织用量形状,直接发 HTTP 请求(Bearer 认证)
const resp = await fetch(`${opts.baseURL}/events?starting_at=2026-09-26T00:00:00Z&ending_at=2026-09-27T00:00:00Z&limit=2`, {
headers: { Authorization: `Bearer ${opts.apiKey}` },
});
console.log(resp.status, await resp.json());响应示例 200
{
"object": "page",
"data": [
{
"object": "usage.event",
"id": "use_1f67393b05b74558b7f8",
"occurred_at": "2026-10-15T03:13:02.720Z",
"ServiceName": "router",
"ServiceCategory": "AI and Machine Learning",
"ResourceId": "deepseek-v4-flash",
"ResourceName": "deepseek-v4-flash",
"BilledCost": "0.000044",
"BillingCurrency": "USD",
"ChargeClass": null,
"request_id": "402f591a737acd50ba1e3178848a1d57",
"settlement": {
"status": "settled",
"shortfall": null,
"zero_reason": null
},
"lines": [
{
"meter": "router.llm",
"display_name": "router.llm",
"ConsumedQuantity": "1",
"ConsumedUnit": "request"
}
]
}
],
"has_more": false,
"next_page": null
}响应
HTTP 200
Event page
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| object | string | Object type; always page. |
| data | array<object> | Usage events, newest first. |
| data[].object | string | Object type; always usage.event. |
| data[].id | string | Id of the usage event; pass it to getOrganizationEvent. |
| data[].occurred_at | string | Time at which the usage happened, UTC. |
| data[].ServiceName | string | Name of the platform service that produced the usage (the source service of the usage event). |
| data[].ServiceCategory | string | Category of the service; a service without a registered category reports its own name. |
| data[].ResourceId | string | Id of the resource that the usage belongs to. |
| data[].ResourceName | string | Display name of the resource; falls back to ResourceId when no name is known. |
| data[].BilledCost | string | Amount billed: US dollars for USD (otherwise BillingCurrency), decimal string, 6 decimals (for example 0.001700); unsettled usage counts as 0.000000 until it settles. |
| data[].BillingCurrency | string | Currency of BilledCost; always USD. |
| data[].ChargeClass | string | null | Correction for an event that corrects an earlier charge (its BilledCost is negative); null for ordinary usage. |
| data[].request_id | string | null | X-Request-Id of the API call that produced the usage; null for usage that does not come from a request. |
| data[].session_id | string | null | The session the usage belongs to (sesn_…, public form); null for a call no session made. |
| data[].agent_id | string | null | The agent that made the call (agent_…); null when the caller is not a session's agent. |
| data[].api_key_id | string | null | The API key the call was made with (key_…); null for session, run and binding callers. |
| data[].run_id | string | null | The automation run the usage belongs to (run_…); null when no automation run made the call. |
| data[].settlement | object | How the usage was charged: settlement state, any shortfall, and why nothing was charged. |
| data[].lines | array<object> | Metering lines mapped from the billing measurements; the priced split (ListUnitPrice, PricingUnit, BilledCost) rides only GET /events/{id}. |
| has_more | boolean | Whether more results exist beyond this page; request again with page set to next_page to read them. |
| next_page | string | null | Opaque cursor for the next page; null on the last page. Pass it unchanged as page. |
响应字段
| 字段 | 说明 |
|---|---|
object | 固定 “page” |
data[].object | 固定 “usage.event” |
data[].id | 事件 id;查单条明细、对账都用它 |
data[].occurred_at | 事件发生时间(UTC) |
data[].ServiceName / ServiceCategory / ResourceId / ResourceName | FOCUS 服务与资源列 |
data[].BilledCost / BillingCurrency | 事件费用(十进制字符串)与扣费币种(CNY 或 USD) |
data[].ChargeClass | 更正事件为 “Correction”(费用为负数),普通事件为 null |
data[].request_id | 产生这次用量的那次 API 调用响应头 X-Request-Id 的值,可拿去调用日志里查同一次请求 |
data[].settlement.status | settled(已扣费)/ no_charge(已记录,不收费)/ rejected(计费拒绝了这次扣费) |
data[].settlement.shortfall / data[].settlement.zero_reason | 目前恒为 null,保留给之后的结算细节 |
has_more / next_page | 按发生时间倒序逐页;游标不透明,不重复、不遗漏 |
支付一个事件的交易明细见查看单个用量事件。