# 获取套餐用量详情

> 全部文档的索引见 [llms.txt](https://ark.volcengine.com/llms.txt)；在任一文档页面地址后追加 `.md` 可获取该页的 Markdown 版本。

`POST https://ark.cn-beijing.volcengineapi.com/?Action=GetUsageDetails&Version=2024-01-01`

查询个人版 `AgentPlan` 套餐的模型调用用量明细。用量按 *QueryInterval* 指定的时间粒度（天或小时）聚合。企业版席位用量请改用 *GetSeatUsageDetails* 接口。

## 鉴权

本接口支持鉴权方式如下，详情请参见 [Base URL 及鉴权](/docs/base-url-and-authentication)。

* Access Key 鉴权，请在 [Access Key 管理](https://console.volcengine.com/iam/keymanage) 页面，获取 Access Key。本接口仅支持 Access Key 鉴权。

---

<span id="request-parameters"></span>
## 请求参数

### Body 参数

**QueryInterval** `string` `必选` | 聚合粒度

用量数据的聚合粒度。可选值：`Day`（按天）、`Hour`（按小时）。

**Filter** `object` | 过滤条件

用量明细的过滤条件，可按模型名称、套餐档位和时间范围筛选。

**EndTime** `string` `必选` | 结束日期

`Filter.EndTime`

结束时间，格式为 `YYYY-MM-DD`；单次最大 31 天，历史最大 6 个月。

**StartTime** `string` `必选` | 起始日期

`Filter.StartTime`

查询时间窗口的起始日期，格式为 `YYYY-MM-DD`。

**ObjectName** `string[]` | 模型名称

`Filter.ObjectName`

对客展示的 Model、Harness 名称，可传入多个。

**PlanType** `integer[]` | 套餐档位

`Filter.PlanType`

限定要查询的套餐档位，可传入多个。整数枚举值 `1`、`2`、`3`、`4` 分别代表 `Small`、`Medium`、`Large`、`Max`。

## 响应参数

**Details** `object[]` | 明细列表

调用明细列表，每个元素表示一个时间点上某模型的用量记录。

**BillingType** `string` | 计费类型

`Details.BillingType`

计费类型。取值：

- `WithinPlan`：套餐内用量；
- `OutsideOfPlan`：套餐外用量。

**ObjectName** `string` | 模型名称

`Details.ObjectName`

对象名称: Model 或 Harness 的对客名称。

**Time** `integer` | 时间点

`Details.Time`

对应的消耗日期或时间点，Unix 时间戳，单位为毫秒。

**Unit** `string` | 用量单位

`Details.Unit`

用量单位。取值：

- `Tokens`：token 数；
- `Images`：图片数。

**Usage** `integer` | 用量数值

`Details.Usage`

该时间点上的计费用量，单位由 *Unit* 字段决定。


## 代码示例

## 默认

### cURL

#### Request

```bash
curl 'https://ark.cn-beijing.volcengineapi.com/?Action=GetUsageDetails&Version=2024-01-01' \
  -H 'Content-Type: application/json' \
  -H 'X-Date: <X-Date>' \
  -H 'X-Content-Sha256: <X-Content-Sha256>' \
  -H 'Authorization: HMAC-SHA256 Credential=<AK>/<X-Date>/cn-beijing/ark/request, SignedHeaders=content-type;host;x-content-sha256;x-date, Signature=<Signature>' \
  -d '{
  "QueryInterval": "Day",
  "Filter": {
    "ObjectName": [
        "doubao-seed-1.6",
        "GLM-4.7"
    ],    
    "PlanType": ["Large"],
    "StartTime": "2026-05-01",
    "EndTime": "2026-05-10"
  }
}
'
```

#### Response

```
{
  "ResponseMetadata": {
    "RequestId": "20260511035211B7A29C481EFC026D93",
    "Action": "GetUsageDetails",
    "Version": "2024-01-01",
    "Service": "ark",
    "Region": "cn-beijing"
  },
  "Result": {
    "Details": [
      {
        "Time": 1778284800000,
        "ObjectName": "doubao-seed-2-1-pro-260915",
        "Usage": 12500,
        "Unit": "Tokens",
        "BillingType": "WithinPlan"
      },
      {
        "Time": 1778284800000,
        "ObjectName": "doubao-seed-2-1-pro-260915",
        "Usage": 8400,
        "Unit": "Tokens",
        "BillingType": "WithinPlan"
      },
      {
        "Time": 1778371200000,
        "ObjectName": "doubao-seed-2-1-pro-260915",
        "Usage": 26800,
        "Unit": "Tokens",
        "BillingType": "WithinPlan"
      },
      {
        "Time": 1778371200000,
        "ObjectName": "doubao-seed-2-1-pro-260915",
        "Usage": 5100,
        "Unit": "Tokens",
        "BillingType": "WithinPlan"
      }
    ]
  }
}
```
