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

# GPT 全模型接口 - Chat Completions 完整参数

> - GPT 系列文本模型的 OpenAI 兼容 Chat Completions 接口，通过 `model` 选择具体模型（全部可选值见 `model` 参数的对照表）
- 全系为推理模型，通过 `reasoning_effort` 控制推理深度；推理 token 计入输出 token 计费
- Prompt 缓存自动生效：命中缓存的输入 token 按更低的缓存价计费
- 支持同步与流式（SSE）两种模式
- 支持文本 + 图像混合输入，以及 `function` 工具调用
- 服务端工具（联网搜索、代码执行、文档检索、MCP）仅在 [Responses 接口](../responses/responses-reference)提供
- **注意** 采样类参数（`temperature`、`top_p`、`logprobs` 等）各模型支持范围不同，逐参数见下方说明

<Note>
  **BaseURL 说明**：默认 BaseURL 为 `https://direct.evolink.ai`，对文本模型支持更好，支持长连接；`https://api.evolink.ai` 是多模态主力地址，对文本模型作为备用地址使用。
</Note>

<Note>
  **服务端工具**（联网搜索、代码执行、文档检索、MCP）仅在 [Responses 接口](../responses/responses-reference)提供；Chat Completions 接口只支持普通 `function` 工具调用。
</Note>

<Note>
  **注意** 本系列全部为推理模型，`stop`（停止序列）与 `web_search_options` 在所有模型上均不支持，传入会返回 `400`；`logit_bias` 不适用于本系列模型。

  `temperature`、`top_p`、`frequency_penalty`、`presence_penalty`、`logprobs`、`verbosity` 各模型支持范围不同，请以上方各参数的说明为准。
</Note>


## OpenAPI

````yaml cn/api-manual/language-series/gpt/chat-completions/chat-completions-reference.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: GPT 全模型接口 - Chat Completions 完整参数
  description: 通过 OpenAI 兼容的 Chat Completions 接口调用 GPT 系列文本模型的完整参数手册。
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: 生产环境（推荐）
  - url: https://api.evolink.ai
    description: 备用地址
security:
  - bearerAuth: []
tags:
  - name: Chat Completions
    description: OpenAI 兼容的对话补全接口
paths:
  /v1/chat/completions:
    post:
      tags:
        - Chat Completions
      summary: GPT 对话补全（全模型，完整参数）
      description: >-
        - GPT 系列文本模型的 OpenAI 兼容 Chat Completions 接口，通过 `model` 选择具体模型（全部可选值见
        `model` 参数的对照表）

        - 全系为推理模型，通过 `reasoning_effort` 控制推理深度；推理 token 计入输出 token 计费

        - Prompt 缓存自动生效：命中缓存的输入 token 按更低的缓存价计费

        - 支持同步与流式（SSE）两种模式

        - 支持文本 + 图像混合输入，以及 `function` 工具调用

        - 服务端工具（联网搜索、代码执行、文档检索、MCP）仅在 [Responses
        接口](../responses/responses-reference)提供

        - **注意** 采样类参数（`temperature`、`top_p`、`logprobs` 等）各模型支持范围不同，逐参数见下方说明
      operationId: gptChatCompletionsReference
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
      responses:
        '200':
          description: '对话生成成功（JSON 对象；`stream=true` 时为 SSE 事件流，以 `data: [DONE]` 结束）'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
        '400':
          description: 请求参数无效（含该模型不支持的参数，错误信息会指出具体参数名）
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 400
                  message: >-
                    Unsupported parameter: 'stop' is not supported with this
                    model.
                  type: invalid_request_error
        '401':
          description: 未授权，Token 无效或已过期
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 401
                  message: Invalid or expired token
                  type: authentication_error
        '402':
          description: 额度不足
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 402
                  message: Insufficient quota
                  type: insufficient_quota_error
                  fallback_suggestion: https://evolink.ai/dashboard/billing
        '429':
          description: 请求频率超限
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 429
                  message: Rate limit exceeded
                  type: rate_limit_error
                  fallback_suggestion: retry after 60 seconds
        '500':
          description: 服务器内部错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 500
                  message: Internal server error
                  type: internal_server_error
                  fallback_suggestion: try again later
        '503':
          description: 服务暂时不可用
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 503
                  message: Service temporarily unavailable
                  type: service_unavailable_error
                  fallback_suggestion: retry after 30 seconds
components:
  schemas:
    ChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: |-
            要调用的模型：

            | 模型 ID | 上下文窗口 | 定位 |
            |---|---|---|
            | `gpt-5.6-sol` | 1,050,000 | GPT-5.6 家族，前沿推理 |
            | `gpt-5.6-terra` | 1,050,000 | GPT-5.6 家族，均衡生产 |
            | `gpt-5.6-luna` | 1,050,000 | GPT-5.6 家族，高吞吐与成本控制 |
            | `gpt-5.5` | 400,000 | 通用推理模型 |
            | `gpt-5.4` | 128,000 | 通用推理模型 |
            | `gpt-5.2` | 400,000 | 通用推理模型 |
            | `gpt-5.1` | 400,000 | 通用推理模型 |
          enum:
            - gpt-5.6-sol
            - gpt-5.6-terra
            - gpt-5.6-luna
            - gpt-5.5
            - gpt-5.4
            - gpt-5.2
            - gpt-5.1
          example: gpt-5.6-sol
        messages:
          type: array
          description: >-
            对话消息列表，支持多轮上下文与多模态输入。


            `role` 可选 `system` / `developer` / `user` / `assistant` / `tool`。


            `content` 可以是字符串，也可以是内容块数组。块类型支持 `text`（文本）、`image_url`（图像）两种：


            ```json

            "content": [
              { "type": "text", "text": "这张图里有什么？" },
              {
                "type": "image_url",
                "image_url": { "url": "https://example.com/photo.png", "detail": "auto" }
              }
            ]

            ```


            **图像**

            - `image_url.url` 传入图片的公网 URL

            - `image_url` 也可直接写成字符串，等价于 `{ "url": "..." }`

            - `detail` 控制图像解析精度，可选 `auto`（默认）/ `low` / `high` / `original`

            - 图片需能被正常下载，否则返回 `400`


            **注意** 本接口的块类型与 Responses 接口不同（Responses 用 `input_text` /
            `input_image`），两者不可混用，写错会返回 `400`。
          items:
            $ref: '#/components/schemas/Message'
          example:
            - role: system
              content: 你是一个简洁的助手。
            - role: user
              content: 用一句话解释什么是量子纠缠。
        stream:
          type: boolean
          description: '是否以流式方式返回（SSE 事件流，以 `data: [DONE]` 结束）。默认 `false`。'
          default: false
          example: false
        max_completion_tokens:
          type: integer
          description: >-
            生成的最大 token 数（含推理 token）。


            **注意** 本系列模型使用 `max_completion_tokens`。为兼容旧代码，只传 `max_tokens`
            时会被自动视作 `max_completion_tokens`；但**不要同时传这两个字段**，`gpt-5.1` /
            `gpt-5.2` / `gpt-5.4` 上同时传会返回 `400`。
          example: 2048
        reasoning_effort:
          type: string
          description: >-
            推理深度控制。可选值随模型不同：


            | 模型 | 可选值 |

            |---|---|

            | `gpt-5.6-sol` / `gpt-5.6-terra` / `gpt-5.6-luna` / `gpt-5.5` |
            `none`、`low`、`medium`、`high`、`xhigh` |

            | `gpt-5.4` / `gpt-5.2` / `gpt-5.1` | `low`、`medium`、`high`、`xhigh`
            |


            推理 token 按输出 token 计费，并计入
            `usage.completion_tokens_details.reasoning_tokens`。
          enum:
            - none
            - low
            - medium
            - high
            - xhigh
          example: medium
        verbosity:
          type: string
          description: >-
            回答详略程度，可选 `low` / `medium` / `high`。


            **注意** 仅 `gpt-5.6-sol` / `gpt-5.6-terra` / `gpt-5.6-luna` /
            `gpt-5.5` 支持；其余模型不支持该参数。
          enum:
            - low
            - medium
            - high
          example: low
        temperature:
          type: number
          description: >-
            采样温度，取值 0 ~ 2，值越低输出越确定。


            **注意** 仅 `gpt-5.5` / `gpt-5.4` / `gpt-5.2` / `gpt-5.1` 支持。`gpt-5.6`
            家族只接受默认值 `1`，传入其他值会返回 `400`。
          minimum: 0
          maximum: 2
          example: 0.7
        top_p:
          type: number
          description: >-
            核采样参数，取值 0 ~ 1。建议不要与 `temperature` 同时调整。


            **注意** 仅 `gpt-5.5` / `gpt-5.4` / `gpt-5.2` / `gpt-5.1` 支持；`gpt-5.6`
            家族不支持该参数。
          minimum: 0
          maximum: 1
          example: 0.9
        frequency_penalty:
          type: number
          description: >-
            频率惩罚，取值 -2 ~ 2。正值按 token 出现频率进行惩罚，降低重复内容的概率。


            **注意** 仅 `gpt-5.4` / `gpt-5.2` / `gpt-5.1` 支持；`gpt-5.6` 家族与
            `gpt-5.5` 不支持该参数。
          minimum: -2
          maximum: 2
          example: 0.5
        presence_penalty:
          type: number
          description: >-
            存在惩罚，取值 -2 ~ 2。正值鼓励模型讨论新话题。


            **注意** 仅 `gpt-5.4` / `gpt-5.2` / `gpt-5.1` 支持；`gpt-5.6` 家族与
            `gpt-5.5` 不支持该参数。
          minimum: -2
          maximum: 2
          example: 0.5
        logprobs:
          type: boolean
          description: >-
            是否返回每个输出 token 的对数概率。


            **注意** 仅 `gpt-5.4` / `gpt-5.2` / `gpt-5.1` 支持；`gpt-5.6` 家族与
            `gpt-5.5` 不支持该参数。
          default: false
          example: true
        top_logprobs:
          type: integer
          description: |-
            每个位置返回的候选 token 数量，取值 0 ~ 5，需与 `logprobs: true` 同时使用。

            **注意** 支持范围同 `logprobs`。
          minimum: 0
          maximum: 5
          example: 2
        'n':
          type: integer
          description: 生成的候选回复数量，返回 `choices` 数组中的多个结果。全部 token（含每个候选的输出）都会计费。
          default: 1
          example: 1
        seed:
          type: integer
          description: 随机种子。相同的种子与参数组合下，模型会尽量返回一致的结果（尽力而为，不保证完全可复现）。
          example: 42
        response_format:
          type: object
          description: >-
            输出格式控制：


            - `{"type": "text"}`：默认的自由文本

            - `{"type": "json_object"}`：返回合法 JSON，**要求 `messages` 中出现 `json`
            字样**，否则返回 `400`

            - `{"type": "json_schema", "json_schema": {...}}`：按给定 JSON Schema
            输出结构化结果，配合 `"strict": true` 强制贴合 schema
          properties:
            type:
              type: string
              enum:
                - text
                - json_object
                - json_schema
              example: json_schema
            json_schema:
              type: object
              description: '`type` 为 `json_schema` 时必填，含 `name`、`schema`、`strict` 字段'
        tools:
          type: array
          description: >-
            工具列表，用于 Function Calling（客户端函数调用，无按次费用）。


            服务端工具（联网搜索、代码执行等）不在本接口提供，请改用 [Responses
            接口](../responses/responses-reference)。
          items:
            $ref: '#/components/schemas/FunctionTool'
        tool_choice:
          description: >-
            工具选择控制：`"auto"`（默认）/ `"none"` / `"required"`，或用对象指定某个函数，如 `{"type":
            "function", "function": {"name": "get_weather"}}`。
          oneOf:
            - type: string
              enum:
                - none
                - auto
                - required
            - type: object
        parallel_tool_calls:
          type: boolean
          description: 是否允许模型在一轮中并行调用多个工具。默认 `true`，设为 `false` 可强制逐个调用。
          default: true
          example: true
        prompt_cache_key:
          type: string
          description: 缓存分组键。为同一类前缀相同的请求传入相同的值，可提升 Prompt 缓存命中率。
          example: app-chat-v1
        user:
          type: string
          description: 终端用户标识，用于区分调用来源。
          example: user-1024
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
          description: 本次对话的唯一标识
          example: chatcmpl-CvJ2p8mQxK7nR4wS
        object:
          type: string
          enum:
            - chat.completion
          description: 响应类型
          example: chat.completion
        created:
          type: integer
          description: 创建时间戳
          example: 1786705221
        model:
          type: string
          description: 实际使用的模型名称
          example: gpt-5.6-sol
        choices:
          type: array
          description: 生成结果列表（长度等于请求中的 `n`）
          items:
            $ref: '#/components/schemas/Choice'
        usage:
          $ref: '#/components/schemas/Usage'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP 状态错误码
            message:
              type: string
              description: 错误描述
            type:
              type: string
              description: 错误类型
            param:
              type: string
              description: 相关参数名
            fallback_suggestion:
              type: string
              description: 出错时的处理建议
    Message:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          description: 消息角色
          enum:
            - system
            - developer
            - user
            - assistant
            - tool
          example: user
        content:
          description: 消息内容：字符串，或内容块数组（`text` / `image_url` 混合）。
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/ContentBlock'
          example: 用一句话解释什么是量子纠缠。
    FunctionTool:
      type: object
      required:
        - type
        - function
      properties:
        type:
          type: string
          enum:
            - function
          example: function
        function:
          type: object
          description: 函数定义
          properties:
            name:
              type: string
              example: get_weather
            description:
              type: string
              example: 查询指定城市的天气
            parameters:
              type: object
              description: JSON Schema 形式的参数定义
    Choice:
      type: object
      properties:
        index:
          type: integer
          description: 结果序号
          example: 0
        message:
          $ref: '#/components/schemas/AssistantMessage'
        logprobs:
          type: object
          description: 对数概率信息，仅在请求中开启 `logprobs` 时返回
        finish_reason:
          type: string
          description: 结束原因：`stop` 正常结束，`length` 达到最大 token 限制，`tool_calls` 需要调用工具
          enum:
            - stop
            - length
            - tool_calls
          example: stop
    Usage:
      type: object
      description: Token 用量统计。Prompt 缓存自动生效，命中缓存的输入 token 按更低的缓存价计费。
      properties:
        prompt_tokens:
          type: integer
          description: 输入 token 数
          example: 18
        completion_tokens:
          type: integer
          description: 输出 token 数（含推理 token）
          example: 42
        total_tokens:
          type: integer
          description: 总 token 数
          example: 60
        prompt_tokens_details:
          type: object
          description: 输入 token 明细
          properties:
            cached_tokens:
              type: integer
              description: 命中缓存的 token 数
              example: 0
        completion_tokens_details:
          type: object
          description: 输出 token 明细
          properties:
            reasoning_tokens:
              type: integer
              description: 推理 token 数
              example: 16
    ContentBlock:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          description: |-
            内容类型

            - `text`：文本块
            - `image_url`：图片输入
          enum:
            - text
            - image_url
          example: image_url
        text:
          type: string
          description: 当 `type=text` 时的文本内容
          example: 这张图里有什么？
        image_url:
          type: object
          description: '图片输入（当 `type=image_url` 时）。也可直接写成图片 URL 字符串，等价于 `{ "url": "..." }`。'
          required:
            - url
          properties:
            url:
              type: string
              description: 图片的公网 URL，需能被正常下载，否则返回 `400`
              example: https://example.com/photo.png
            detail:
              type: string
              description: |-
                图片解析精度

                - `low`：低精度，消耗 token 更少
                - `high`：高精度，识别更细
                - `original`：按原图尺寸解析
                - `auto`（默认）：由模型自动决定
              enum:
                - auto
                - low
                - high
                - original
              default: auto
              example: auto
      description: 多模态内容块，通过 `type` 声明类型，仅填写与该类型匹配的字段。
    AssistantMessage:
      type: object
      properties:
        role:
          type: string
          enum:
            - assistant
          example: assistant
        content:
          type: string
          description: 模型生成的文本内容；触发工具调用时可能为 `null`
          example: 量子纠缠是指两个粒子的状态相互关联，测量其中一个会瞬间确定另一个的状态。
        tool_calls:
          type: array
          description: 模型请求调用的工具列表
          items:
            type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ##所有接口均需 Bearer Token 认证##

        **获取 API Key：**

        访问 [API Key 管理页面](https://evolink.ai/dashboard/keys) 获取你的 API Key

        **添加到请求头：**
        ```
        Authorization: Bearer YOUR_API_KEY
        ```

````