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

# 获取模型列表

> 返回当前已鉴权 API Key / 用户分组可用的模型列表。

响应形态由请求头 / 查询参数决定（与网关路由一致）：

- 默认（Bearer / OpenAI 风格）：OpenAI 列表格式（`object` + `data`）
- `x-api-key` + `anthropic-version`：Anthropic 风格列表
- `x-goog-api-key` 或 `key` 查询参数：Gemini 风格列表

请将每个模型的 `id` 用作 chat、图像、视频等接口的 `model` 字段。
另见模型广场：https://omniall.ai/pricing




## OpenAPI

````yaml zh-CN/openapi/xgapi-public.yaml GET /v1/models
openapi: 3.0.3
info:
  title: Omniall AI 公开 API
  description: >-
    Omniall AI 公开 API。网站：https://omniall.ai — API 主机：https://api.omniall.ai —
    模型广场：https://omniall.ai/pricing
  version: 1.1.0
servers:
  - url: https://api.omniall.ai
    description: 生产环境
security:
  - bearerAuth: []
tags:
  - name: Models
    description: 列出当前 API Key 可用的模型。
  - name: ChatGPT Chat Completions
    x-group: ChatGPT
    description: OpenAI Chat Completions 对话接口（`POST /v1/chat/completions`）。
  - name: Responses
    description: OpenAI Responses 接口（`POST /v1/responses`）。
  - name: Claude
    description: Anthropic Messages 消息接口（`POST /v1/messages`）。
  - name: Gemini
    description: Google Gemini 原生 generateContent / streamGenerateContent。
  - name: Images
    description: 图像生成（OpenAI Images）、各厂商说明与 Midjourney 代理接口。
  - name: Video
    description: 异步视频任务。
  - name: Audio
    description: 语音合成及相关音频接口。
  - name: Rerank
    description: 文档重排序。
paths:
  /v1/models:
    get:
      tags:
        - Models
      summary: 获取模型列表
      description: |
        返回当前已鉴权 API Key / 用户分组可用的模型列表。

        响应形态由请求头 / 查询参数决定（与网关路由一致）：

        - 默认（Bearer / OpenAI 风格）：OpenAI 列表格式（`object` + `data`）
        - `x-api-key` + `anthropic-version`：Anthropic 风格列表
        - `x-goog-api-key` 或 `key` 查询参数：Gemini 风格列表

        请将每个模型的 `id` 用作 chat、图像、视频等接口的 `model` 字段。
        另见模型广场：https://omniall.ai/pricing
      operationId: listModels
      parameters:
        - name: x-api-key
          in: header
          required: false
          description: |
            Anthropic 兼容 API Key。与 `anthropic-version` 同时出现时，
            响应使用 Anthropic 列表格式。网关也接受该值作为令牌
            （等同于 `Authorization: Bearer ...`）。
          schema:
            type: string
            example: sk-xxxxxxxx
        - name: anthropic-version
          in: header
          required: false
          description: Anthropic API 版本请求头。与 `x-api-key` 一起使用可请求 Anthropic 响应格式。
          schema:
            type: string
            example: '2023-06-01'
        - name: x-goog-api-key
          in: header
          required: false
          description: Gemini 兼容 API Key。存在时响应使用 Gemini 列表格式。
          schema:
            type: string
            example: sk-xxxxxxxx
        - name: key
          in: query
          required: false
          description: 备用 Gemini 兼容 API Key（查询参数），效果同 `x-goog-api-key`。
          schema:
            type: string
            example: sk-xxxxxxxx
      responses:
        '200':
          description: |
            成功。默认响应体为 OpenAI 兼容格式（`success`、`object`、`data`）。
            使用对应请求头/查询参数时返回 Anthropic / Gemini 形态。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModelsListResponse'
              examples:
                OpenAI 格式（默认）:
                  summary: OpenAI 格式（默认）
                  value:
                    success: true
                    object: list
                    data:
                      - id: gpt-4o-mini
                        object: model
                        created: 1626777600
                        owned_by: openai
                        supported_endpoint_types:
                          - openai
                      - id: kling-2.5
                        object: model
                        created: 1626777600
                        owned_by: custom
                        supported_endpoint_types:
                          - openai-video
                Anthropic 格式（x-api-key + anthropic-version）:
                  summary: Anthropic 格式（x-api-key + anthropic-version）
                  value:
                    data:
                      - id: claude-sonnet-4
                        created_at: '2021-07-20T00:00:00Z'
                        display_name: claude-sonnet-4
                        type: model
                    first_id: claude-sonnet-4
                    has_more: false
                    last_id: claude-sonnet-4
                Gemini 格式（x-goog-api-key 或 key）:
                  summary: Gemini 格式（x-goog-api-key 或 key）
                  value:
                    models:
                      - name: gemini-2.0-flash
                        displayName: gemini-2.0-flash
                    nextPageToken: null
        '401':
          description: 缺少或无效的 API Key / 令牌。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIErrorResponse'
              examples:
                无效令牌:
                  summary: 无效令牌
                  value:
                    error:
                      message: '无效的令牌 (request id: 20260302120000-xxxxxxxx)'
                      type: new_api_error
                      code: ''
        '403':
          description: |
            已鉴权但无权限（例如用户被封禁、IP 不在令牌白名单，
            或无权访问该令牌所属分组）。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIErrorResponse'
              examples:
                用户已禁用:
                  summary: 用户已禁用
                  value:
                    error:
                      message: '该用户已被封禁 (request id: 20260302120000-xxxxxxxx)'
                      type: new_api_error
                      code: ''
                IP 不在令牌允许列表:
                  summary: IP 不在令牌允许列表
                  value:
                    error:
                      message: '您的 IP 不在令牌允许访问的列表中 (request id: 20260302120000-xxxxxxxx)'
                      type: new_api_error
                      code: access_denied
        '500':
          description: 校验令牌或加载用户数据时的服务器 / 数据库错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIErrorResponse'
              example:
                error:
                  message: '数据库错误 (request id: 20260302120000-xxxxxxxx)'
                  type: new_api_error
                  code: ''
components:
  schemas:
    ModelsListResponse:
      type: object
      description: 默认 OpenAI 兼容的模型列表响应。
      required:
        - object
        - data
      properties:
        success:
          type: boolean
          description: 网关成功标志；成功返回列表时为 `true`。
          example: true
        object:
          type: string
          description: 固定为 `list`。
          example: list
        data:
          type: array
          description: 当前 API Key / 分组可用的模型数组。
          items:
            $ref: '#/components/schemas/ModelObject'
    OpenAIErrorResponse:
      type: object
      description: 鉴权或请求失败时返回的 OpenAI 风格错误包络。
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - type
          properties:
            message:
              type: string
              description: 人类可读错误信息。网关可能附加 request id 便于排查。
            type:
              type: string
              description: 错误类型，常见为 `new_api_error`。
              example: new_api_error
            code:
              type: string
              description: 可选机器可读错误码（如 `access_denied`），可能为空字符串。
          description: 错误对象。
    ModelObject:
      type: object
      description: GET /v1/models 返回的单个模型条目。
      required:
        - id
        - object
        - created
        - owned_by
      properties:
        id:
          type: string
          description: 模型标识。请原样填入 chat/image/video/audio 请求的 `model` 字段。
          example: gpt-4o-mini
        object:
          type: string
          description: 固定为 `model`。
          example: model
        created:
          type: integer
          description: 与模型元数据关联的 Unix 时间戳。
          example: 1626777600
        owned_by:
          type: string
          description: 提供方/归属标签，如 `openai`、`anthropic`，或网关注册模型的 `custom`。
          example: openai
        supported_endpoint_types:
          type: array
          description: 该模型可用的 Omniall 端点族（如 `openai`、`anthropic`、`gemini`、`openai-video`）。
          items:
            type: string
            enum:
              - openai
              - openai-response
              - openai-response-compact
              - anthropic
              - gemini
              - jina-rerank
              - image-generation
              - embeddings
              - openai-video
          example:
            - openai
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: '使用来自 https://omniall.ai/dashboard 的 Authorization: Bearer sk-...'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.