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

# 模型列表

> 获取当前可用的模型列表，返回 OpenAI 兼容格式

此接口兼容 OpenAI 模型列表协议，用于获取当前可用的模型列表。

## 功能特性

* 返回 OpenAI 兼容格式的模型列表
* 复用 Caffeine 本地缓存，响应速度快

## 认证方式

在请求头中携带 `Authorization` 字段，格式为 `Bearer YOUR_API_KEY`。

## 快速示例

<CodeGroup>
  ```python Python theme={null}
  import requests

  url = "https://api.haitoken.ai/v1/models"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY"
  }

  response = requests.get(url, headers=headers)
  print(response.json())
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.haitoken.ai/v1/models', {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

  const data = await response.json();
  console.log(data);
  ```

  ```curl cURL theme={null}
  curl -X GET 'https://api.haitoken.ai/v1/models' \
    -H 'Authorization: Bearer YOUR_API_KEY'
  ```
</CodeGroup>

## 响应示例

```json theme={null}
{
  "object": "list",
  "data": [
    {
      "id": "gpt-4o",
      "object": "model",
      "owned_by": "openai",
      "created": 1715367049
    }
  ]
}
```

此接口兼容 OpenAI 模型列表协议，用于获取当前可用的模型列表。

## 功能特性

* 返回 OpenAI 兼容格式的模型列表

## 响应示例

```json theme={null}
{
  "object": "list",
  "data": [
    {
      "id": "gpt-4o",
      "object": "model",
      "owned_by": "haitoken",
      "created": 1715367049
    }
  ]
}
```


## OpenAPI

````yaml zh/api-reference/models/openapi.json GET /v1/models
openapi: 3.0.1
info:
  title: 默认模块
  description: ''
  version: 1.0.0
servers: []
security: []
tags: []
paths:
  /v1/models:
    get:
      tags: []
      summary: 获取可用模型列表
      description: 返回 OpenAI 兼容格式，复用 Caffeine 本地缓存
      parameters:
        - name: Authorization
          in: header
          description: ''
          required: true
          schema:
            type: string
            example: Bearer YOUR_API_KEY
        - name: Content-Type
          in: header
          description: ''
          schema:
            example: application/json
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelListResponse'
                description: |-
                  OpenAI 兼容的模型列表响应
                  参考：https://platform.openai.com/docs/api-reference/models/list
          headers: {}
      deprecated: false
      security: []
components:
  schemas:
    ModelListResponse:
      type: object
      properties:
        object:
          type: string
          description: 对象类型，固定为 "list"
        data:
          type: array
          items:
            $ref: '#/components/schemas/ModelInfo'
            description: 单个模型信息
          description: 模型列表
    ModelInfo:
      type: object
      properties:
        owned_by:
          type: string
          description: 模型拥有者
        id:
          type: string
          description: 模型标识符（对应 t_model.model_no）
        object:
          type: string
          description: 对象类型，固定为 "model"
        created:
          type: integer
          description: 创建时间（Unix 时间戳，秒级）
          format: int64

````