跳转到内容
EN

导出费用明细

GET/organization/v1/charges● 支持

官方参考 ↗

请求参数

  • starting_atstring必填

    query: 窗口开始(含),UTC ISO 8601,如 2026-09-26T00:00:00Z

  • ending_atstring必填

    query: 窗口结束(不含),UTC ISO 8601;距 starting_at 最多 93 天(费用明细导出无此限制)

返回

200

错误按 problem+json 格式返回,参见 错误码

请求示例

curl
curl "https://api.deepraxis.com/organization/v1/charges?starting_at=2026-09-26T00:00:00Z&ending_at=2026-09-27T00:00:00Z" \
  -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 认证);响应是 JSONL,一行一条 FOCUS 记录
resp = requests.get(
    f"{opts['base_url']}/charges?starting_at=2026-09-26T00:00:00Z&ending_at=2026-09-27T00:00:00Z",
    headers={"Authorization": f"Bearer {opts['api_key']}"},
)
print(resp.status_code, resp.headers["Content-Type"])
for line in resp.text.splitlines():
    print(line)
TypeScript
const opts = {
  baseURL: "https://api.deepraxis.com/organization/v1",
  apiKey: "$PRAXIS_API_KEY",
};

// /organization 是我们自己的组织用量形状,直接发 HTTP 请求(Bearer 认证);响应是 JSONL,一行一条 FOCUS 记录
const resp = await fetch(`${opts.baseURL}/charges?starting_at=2026-09-26T00:00:00Z&ending_at=2026-09-27T00:00:00Z`, {
  headers: { Authorization: `Bearer ${opts.apiKey}` },
});
console.log(resp.status, resp.headers.get("Content-Type"));
const text = await resp.text();
for (const line of text.split("\n").filter(Boolean)) console.log(line);

响应示例 200

{
  "ChargePeriodStart": "2026-10-15T03:13:02.720Z",
  "ChargePeriodEnd": "2026-10-15T03:13:02.720Z",
  "BilledCost": "0.000044",
  "BillingCurrency": "USD",
  "ServiceName": "router",
  "ServiceCategory": "AI and Machine Learning",
  "ResourceId": "deepseek-v4-flash",
  "ResourceName": "deepseek-v4-flash",
  "ConsumedQuantity": "1",
  "ConsumedUnit": "request",
  "ChargeCategory": "Usage",
  "ChargeClass": null,
  "ChargeDescription": "router.llm usage",
  "x_RequestId": "402f591a737acd50ba1e3178848a1d57",
  "x_EventId": "use_1f67393b05b74558b7f8"
}

响应

HTTP 200

FOCUS 1.3 JSONL stream

application/x-ndjson

名称 类型 说明
ChargePeriodStart string Start of the charge period (the event time), UTC.
ChargePeriodEnd string End of the charge period (the event time), UTC.
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.
BillingCurrency string Currency of BilledCost; always USD.
ServiceName string Name of the platform service that produced the usage (the source service of the usage event).
ServiceCategory string Category of the service; a service without a registered category reports its own name.
ResourceId string Id of the resource that the usage belongs to.
ResourceName string Display name of the resource; falls back to ResourceId when no name is known.
ConsumedQuantity string Quantity consumed, an exact decimal string in ConsumedUnit.
ConsumedUnit string Unit of ConsumedQuantity as reported by the metering line; quantities of different units are never added together.
ChargeCategory string Kind of charge.
ChargeClass string | null Correction for an event that corrects an earlier charge (its BilledCost is negative); null for ordinary usage.
ChargeDescription string Text such as <service>/<offering> usage that says what was charged.
x_RequestId string | null Always null in the export; look up the request id of an event with getOrganizationEvent.
x_EventId string Id of the usage event this record comes from; pass it to getOrganizationEvent.

响应字段

字段说明
ChargePeriodStart / ChargePeriodEnd计费周期起止(UTC)
BilledCost / BillingCurrency该事件费用(十进制字符串)与扣费币种(CNY 或 USD)
ServiceName / ServiceCategory / ResourceId / ResourceNameFOCUS 服务与资源列
ConsumedQuantity / ConsumedUnit消耗数量与计量单位
ChargeCategoryUsage(用量)或 Adjustment(调整)
ChargeClass更正记录为 “Correction”,普通记录为 null
ChargeDescription计量项的人类可读描述
x_RequestId / x_EventId产生这条记录的 API 调用的 X-Request-Id;对应的用量事件 id

支付一个事件的交易明细见查看单个用量事件。