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

# Search API Usage Logs

## Response Example

```json theme={null}
{
  "items": [
    {
      "id": 52,
      "serviceName": "chat",
      "apiPath": "/v1/chat/completions",
      "apiMethod": "POST",
      "apiKey": "3a43****a987",
      "amount": 15,
      "statusCode": 200,
      "traceId": "1d110e91-9d69-4325-bd42-b55583ae6dc5",
      "metadata": {
        "model": "gpt-5.1"
      },
      "createdAt": "2025-08-06T09:36:54.083Z"
    }
  ],
  "meta": {
    "totalItems": 256,
    "itemCount": 10,
    "itemsPerPage": 10,
    "totalPages": 26,
    "currentPage": 1
  }
}
```

### Response Fields

#### `items[]` — Usage Log Records

| Field         | Type           | Description                                        |
| ------------- | -------------- | -------------------------------------------------- |
| `id`          | number         | Record ID                                          |
| `serviceName` | string         | Service name (e.g. `chat`, `gemini`)               |
| `apiPath`     | string         | API request path                                   |
| `apiMethod`   | string         | HTTP method (`GET`, `POST`, etc.)                  |
| `apiKey`      | string         | API Key used (masked)                              |
| `amount`      | number         | Credits consumed                                   |
| `statusCode`  | number         | HTTP response status code                          |
| `traceId`     | string         | Request trace ID for troubleshooting               |
| `metadata`    | object \| null | Additional metadata (e.g. model name, token usage) |
| `createdAt`   | string         | Created time (ISO 8601)                            |

#### `meta` — Pagination Info

| Field          | Type   | Description                       |
| -------------- | ------ | --------------------------------- |
| `totalItems`   | number | Total number of records           |
| `itemCount`    | number | Number of records on current page |
| `itemsPerPage` | number | Page size                         |
| `totalPages`   | number | Total number of pages             |
| `currentPage`  | number | Current page number               |

<Info>
  The `dateRange` parameter is required. The maximum date range span is **90 days**. Timestamps are in **milliseconds**.
</Info>


## OpenAPI

````yaml POST /api-user/usage/search
openapi: 3.0.0
info:
  title: OneAI User Open API
  description: |-
    通过 API Key 调用的开放接口。

    认证方式：在请求头中添加 `X-API-Key: <your-key>`，或通过查询参数 `?key=<your-key>` 传递。
  version: '1.0'
  contact: {}
servers:
  - url: https://dk.mountsea.ai
    description: API Gateway
security: []
tags: []
paths:
  /api-user/usage/search:
    post:
      tags:
        - User Open API
      summary: 查询 API 使用记录
      operationId: ApiUserController_searchUsage
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenSearchUsageDto'
      responses:
        '201':
          description: ''
      security:
        - api-key: []
components:
  schemas:
    OpenSearchUsageDto:
      type: object
      properties:
        page:
          type: number
          description: 页码
          default: 1
        limit:
          type: number
          description: 每页条数
          default: 10
        dateRange:
          description: 日期范围（毫秒时间戳，最大跨度90天）
          allOf:
            - $ref: '#/components/schemas/OpenDateRangeDto'
        serviceId:
          type: string
          description: 服务ID（可选，不传则查全部）
      required:
        - dateRange
    OpenDateRangeDto:
      type: object
      properties:
        start:
          type: number
          minimum: 0
          description: 开始时间（毫秒时间戳）
          example: 1767801600000
        end:
          type: number
          minimum: 0
          description: 结束时间（毫秒时间戳）
          example: 1773071999999
      required:
        - start
        - end
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: X-API-Key

````