> ## 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 快速开始

> - 使用 OpenAI SDK 格式调用 GPT 系列文本模型（通过 `model` 参数选择具体模型）
- 推理 + 工具调用模型，支持文本与图像混合输入
- 同步处理模式，参数极简，快速上手
- 💡 需要更多参数？查看[完整参数文档](./chat-completions-reference)
- 💡 需要服务端工具（联网搜索、代码执行）？请使用 [Responses 接口](../responses/responses-quickstart)

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


## OpenAPI

````yaml cn/api-manual/language-series/gpt/chat-completions/chat-completions-quickstart.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: >-
        - 使用 OpenAI SDK 格式调用 GPT 系列文本模型（通过 `model` 参数选择具体模型）

        - 推理 + 工具调用模型，支持文本与图像混合输入

        - 同步处理模式，参数极简，快速上手

        - 💡 需要更多参数？查看[完整参数文档](./chat-completions-reference)

        - 💡 需要服务端工具（联网搜索、代码执行）？请使用 [Responses
        接口](../responses/responses-quickstart)
      operationId: gptChatCompletionsQuickstart
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionQuickRequest'
      responses:
        '200':
          description: 对话生成成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
        '400':
          description: 请求参数无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 400
                  message: Invalid request parameters
                  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:
    ChatCompletionQuickRequest:
      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: |-
            对话消息列表。

            图像等多模态写法见[完整参数文档](./chat-completions-reference)。

            ```json
            "messages": [
              {
                "role": "user",
                "content": [
                  { "type": "text", "text": "这张图里有什么？" },
                  { "type": "image_url", "image_url": { "url": "https://example.com/photo.png" } }
                ]
              }
            ]
            ```
          items:
            $ref: '#/components/schemas/MessageSimple'
          example:
            - role: user
              content: 用一句话解释什么是量子纠缠。
    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: 生成结果列表
          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: 出错时的处理建议
    MessageSimple:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          description: 消息角色
          enum:
            - system
            - developer
            - user
            - assistant
          example: user
        content:
          description: 消息内容：字符串，或内容块数组（`text` / `image_url` 混合）。
          example: 用一句话解释什么是量子纠缠。
          oneOf:
            - type: string
            - type: array
              items:
                type: object
    Choice:
      type: object
      properties:
        index:
          type: integer
          description: 结果序号
          example: 0
        message:
          $ref: '#/components/schemas/AssistantMessage'
        finish_reason:
          type: string
          description: 结束原因：`stop` 正常结束，`length` 达到最大 token 限制，`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
    AssistantMessage:
      type: object
      properties:
        role:
          type: string
          enum:
            - assistant
          example: assistant
        content:
          type: string
          description: 模型生成的文本内容
          example: 量子纠缠是指两个粒子的状态相互关联，测量其中一个会瞬间确定另一个的状态。
  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
        ```

````