> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ariacompute.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# GET /api/billing/usage — 计量用量记录

> 返回一段时间与粒度内的计量用量：按模型的用量、单位与费用。金额以钱包币种计。

返回一段时间与粒度内的计量用量记录。每行包含模型、用量、单位与以钱包币种计价的费用。

**方法：** `GET` **路径：** `/api/billing/usage` **认证：** 会话 Bearer

## 查询参数

<ParamField query="from" type="string">
  起始时间戳（ISO 8601 UTC）。默认本月开始。
</ParamField>

<ParamField query="to" type="string">
  结束时间戳（ISO 8601 UTC）。默认当前。
</ParamField>

<ParamField query="granularity" type="string">
  `day` 或 `hour`。默认 `day`。
</ParamField>

## 响应

<ResponseField name="usage" type="object[]">
  <Expandable title="row">
    <ResponseField name="timestamp" type="string">
      分桶起始（ISO 8601）。
    </ResponseField>

    <ResponseField name="model" type="string">
      模型 slug。
    </ResponseField>

    <ResponseField name="quantity" type="number">
      消耗量。
    </ResponseField>

    <ResponseField name="unit" type="string">
      计费单位（例如 `per_million_tokens`）。
    </ResponseField>

    <ResponseField name="cost" type="number">
      以 `currency` 计价的费用。
    </ResponseField>

    <ResponseField name="currency" type="string">
      `USD` 或 `CNY`。
    </ResponseField>
  </Expandable>
</ResponseField>

## 示例

```bash theme={null}
curl -H "Authorization: Bearer eyJhbGciOi..." \
  "https://ariacompute.cn/api/billing/usage?from=2026-09-01T00:00:00Z&granularity=day"
```

```json theme={null}
{
  "usage": [
    {
      "timestamp": "2026-09-22T00:00:00Z",
      "model": "gemma-4-e2b-it_q4",
      "quantity": 1250000,
      "unit": "per_million_tokens",
      "cost": 1.50,
      "currency": "CNY"
    }
  ]
}
```
