> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/ai/aig/ai-gateway-usage/describeaiusagedetaildata.md).

# DescribeAiUsageDetailData

## 1. API Description

This API (DescribeAiUsageDetailData) is used to describe AI usage detail data

{% hint style="info" %}
**Notes**

* For the authentication method of this API, refer to [Authentication](/api-reference/api-introduction/instruction/authorization.md)
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name  | Required | Type    | Description                                    |
| --------------- | -------- | ------- | ---------------------------------------------- |
| start           | Yes      | Integer | Start timestamp (10 digits), e.g., 1659427200. |
| end             | Yes      | Integer | End timestamp (10 digits), e.g., 1659434400.   |
| instanceIds     | No       | String  | Instance ID.                                   |
| resourceGroupId | No       | String  | Resource group ID.                             |

## 3. Output Parameters

| Parameter Name | Type                                                                             | Description                                                                                                           |
| -------------- | -------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| requestId      | String                                                                           | <p>The unique request ID, which is returned for each request.</p><p>RequestId is required for locating a problem.</p> |
| request        | Array of [UsageDataPoint](/api-reference/ai/aig/datastructure.md#usagedatapoint) | Request count detail data.                                                                                            |
| token          | Array of [UsageDataPoint](/api-reference/ai/aig/datastructure.md#usagedatapoint) | Total token detail data.                                                                                              |
| inputToken     | Array of [UsageDataPoint](/api-reference/ai/aig/datastructure.md#usagedatapoint) | Input token detail data.                                                                                              |
| outToken       | Array of [UsageDataPoint](/api-reference/ai/aig/datastructure.md#usagedatapoint) | Output token detail data.                                                                                             |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}

1. **Query the AI gateway usage details within the specified time range.**

```json
POST / HTTP/1.1
Host: console.zenlayer.com/api/v2/aigw
Content-Type: application/json
X-ZC-Action: DescribeAiUsageDetailData
<Common Request Params>

Request:
{
    "instanceIds": "1597494548165039443",
    "start": 1776927600,
    "end": 1776931200
}
Response:
{
  "requestId": "TBE4E6FA1-9DFF-47E7-958B-F8D87D41EEE7",
  "response": {
      "request": [
          {
              "data": [
                  {
                      "model": "claude-opus-4-5-20251101",
                      "value": 6
                  }
              ],
              "time": 1776929700000
          }
      ],
      "inputToken": [
          {
              "data": [
                  {
                      "model": "claude-opus-4-5-20251101",
                      "value": 48
                  }
              ],
              "time": 1776929700000
          }
      ],
      "requestId": "TBE4E6FA1-9DFF-47E7-958B-F8D87D41EEE7",
      "outToken": [
          {
              "data": [
                  {
                      "model": "claude-opus-4-5-20251101",
                      "value": 120
                  }
              ],
              "time": 1776929700000
          }
      ],
      "token": [
          {
              "data": [
                  {
                      "model": "claude-opus-4-5-20251101",
                      "value": 168
                  }
          ],
              "time": 1776929700000
          }
      ]
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](/api-reference/api-introduction/toolkit/api-sdk.md)，to make it easier for you to call APIs. More programming languages will be supported.

## 6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see [Common Error Codes](/api-reference/api-introduction/instruction/commonerrorcode.md).

| HTTP Status Code | Error Code | Description |
| ---------------- | ---------- | ----------- |
