跳转到内容
EN

查看单个用量事件

GET/organization/v1/events/{id}● 支持

官方参考 ↗

请求参数

  • idstring必填

    path: 用量事件 id,来自用量事件列表的 data[].id

返回

200 usage.event

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

请求示例

curl
curl https://api.deepraxis.com/organization/v1/events/ue_123 \
  -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/ue_123",
    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/ue_123`, {
  headers: { Authorization: `Bearer ${opts.apiKey}` },
});
console.log(resp.status, await resp.json());

响应示例 200

{
  "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",
      "ListUnitPrice": null,
      "PricingUnit": null,
      "BilledCost": "0.000044"
    }
  ],
  "x_Charges": [
    {
      "transaction_id": "txn_31788b6f407542289940",
      "BilledCost": "0.000044",
      "BillingCurrency": "USD",
      "sub_account": "promotional"
    }
  ]
}

响应

HTTP 200

The usage event

application/json

名称 类型 说明
object string Object type; always usage.event.
id string Id of the usage event; pass it to getOrganizationEvent.
occurred_at string Time at which the usage happened, UTC.
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.
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.
ChargeClass string | null Correction for an event that corrects an earlier charge (its BilledCost is negative); null for ordinary usage.
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.
session_id string | null The session the usage belongs to (sesn_…, public form); null for a call no session made.
agent_id string | null The agent that made the call (agent_…); null when the caller is not a session's agent.
api_key_id string | null The API key the call was made with (key_…); null for session, run and binding callers.
run_id string | null The automation run the usage belongs to (run_…); null when no automation run made the call.
settlement object How the usage was charged: settlement state, any shortfall, and why nothing was charged.
settlement.status string Settlement state of the event.
settlement.shortfall string | null Amount that could not be charged: US dollars, decimal string, 6 decimals, when status is settled_with_shortfall; null otherwise.
settlement.zero_reason string | null Why nothing was charged for the event: byok when the caller used its own provider key; null when a charge applies.
lines array<object> Priced lines of the event; their BilledCost values add up to the event's BilledCost.
lines[].meter string Key of the meter that measured the line.
lines[].display_name string English label of the meter; falls back to the meter key in list pages.
lines[].ConsumedQuantity string Quantity consumed, an exact decimal string in ConsumedUnit.
lines[].ConsumedUnit string Unit of ConsumedQuantity as reported by the metering line; quantities of different units are never added together.
lines[].ListUnitPrice string | null List price in USD per PricingUnit as a decimal string; null when the line is not priced.
lines[].PricingUnit string | null Unit that ListUnitPrice applies to; null when the line is not priced.
lines[].BilledCost string Amount billed for this line: US dollars for USD (otherwise BillingCurrency), decimal string, 6 decimals (for example 0.001700).
x_Charges array<object> The transactions that paid this event; their BilledCost sums to the event's BilledCost.
x_Charges[].transaction_id string The id of the billing transaction that paid part of this event.
x_Charges[].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.
x_Charges[].BillingCurrency string Currency of BilledCost; always USD.
x_Charges[].sub_account string Which balance the transaction was taken from.

响应字段

字段说明
object / id / occurred_at固定 “usage.event”、事件 id、发生时间(UTC)
ServiceName / ServiceCategory / ResourceId / ResourceName / BilledCost / BillingCurrency / ChargeClass / request_id / settlement与用量事件列表中同一事件完全相同的字段
lines[].meter / lines[].display_name计量项标识与其英文显示名
lines[].ConsumedQuantity / ConsumedUnit该计量项的消耗数量与单位
lines[].ListUnitPrice / PricingUnit恒为 null:计费按整个事件定价,没有逐计量项的单价
lines[].BilledCost该计量项的费用,等于事件的 BilledCost
x_Charges[]支付这个事件的交易:transaction_id、BilledCost、BillingCurrency,以及 sub_account(promotional 赠送额度或 cash 现金;赠送额度先扣)。各笔相加等于事件的 BilledCost

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