# 获取套餐用量详情

> 全部文档的索引见 [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`。

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

`Filter.StartTime`

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

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

`Filter.ObjectName`

限定要查询的模型名称列表，可传入多个查询内容。

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

`Filter.PlanType`

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

## 响应参数

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

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

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

`Details.BillingType`

用量的计费类型。可选值：`WithinPlan`（套餐内用量）、`OutsideOfPlan`（套餐外用量）。

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

`Details.ObjectName`

发生消耗的模型或 Harness 名称。

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

`Details.Time`

该条用量记录所属的时间点，Unix 毫秒时间戳。

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

`Details.Unit`

*Usage* 的计量单位。常见取值：`Tokens`、`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"
      }
    ]
  }
}
```
