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

# DeepSeek - 完整参数文档

> - 使用 OpenAI SDK 格式调用 DeepSeek 模型
- 同步处理模式，实时返回对话内容
- 支持 `deepseek-chat`（通用对话）和 `deepseek-reasoner`（深度推理）两个模型
- **纯文本对话**：单轮或多轮上下文对话
- **系统提示词**：自定义 AI 的角色和行为
- **流式输出**：支持 SSE 流式返回
- **工具调用**：支持 Function Calling

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


## OpenAPI

````yaml cn/api-manual/language-series/deepseek/deepseek-reference.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: DeepSeek 完整参数文档
  description: DeepSeek 对话接口的完整 API 参考，包含所有参数和高级功能
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: 生产环境（推荐）
  - url: https://api.evolink.ai
    description: 备用地址
security:
  - bearerAuth: []
tags:
  - name: 对话生成
    description: AI对话生成相关接口
paths:
  /v1/chat/completions:
    post:
      tags:
        - 对话生成
      summary: DeepSeek 对话接口
      description: |-
        - 使用 OpenAI SDK 格式调用 DeepSeek 模型
        - 同步处理模式，实时返回对话内容
        - 支持 `deepseek-chat`（通用对话）和 `deepseek-reasoner`（深度推理）两个模型
        - **纯文本对话**：单轮或多轮上下文对话
        - **系统提示词**：自定义 AI 的角色和行为
        - **流式输出**：支持 SSE 流式返回
        - **工具调用**：支持 Function Calling
      operationId: createChatCompletionDeepSeek
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            examples:
              simple_text:
                summary: 单轮文本对话
                value:
                  model: deepseek-chat
                  messages:
                    - role: user
                      content: 请介绍一下你自己
              multi_turn:
                summary: 多轮对话（上下文理解）
                value:
                  model: deepseek-chat
                  messages:
                    - role: user
                      content: 什么是Python？
                    - role: assistant
                      content: Python是一种高级编程语言...
                    - role: user
                      content: 它有什么优点？
              system_prompt:
                summary: 使用系统提示词
                value:
                  model: deepseek-chat
                  messages:
                    - role: system
                      content: 你是一个专业的Python编程助手，用简洁的语言回答问题。
                    - role: user
                      content: 如何读取文件？
              reasoner:
                summary: 使用深度推理模型
                value:
                  model: deepseek-reasoner
                  messages:
                    - role: user
                      content: 请证明根号2是无理数
      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
        '403':
          description: 无权限访问
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 403
                  message: Access denied for this model
                  type: permission_error
                  param: model
        '404':
          description: 资源不存在
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 404
                  message: Specified model not found
                  type: not_found_error
                  param: model
        '413':
          description: 请求体过大
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 413
                  message: Request body too large
                  type: request_too_large_error
                  param: messages
        '429':
          description: 请求频率超限
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 429
                  message: Rate limit exceeded
                  type: rate_limit_error
        '500':
          description: 服务器内部错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 500
                  message: Internal server error
                  type: internal_server_error
        '502':
          description: 上游服务错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 502
                  message: Upstream AI service unavailable
                  type: upstream_error
        '503':
          description: 服务暂时不可用
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 503
                  message: Service temporarily unavailable
                  type: service_unavailable_error
components:
  schemas:
    ChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: >-
            对话模型名称


            - `deepseek-chat`：通用对话模型

            - `deepseek-reasoner`：深度推理模型，擅长数学、编程和复杂逻辑推理


            **注意**：`deepseek-reasoner` 不支持
            `temperature`、`top_p`、`tools`、`tool_choice`、`response_format`
            参数，传入会被上游拒绝
          enum:
            - deepseek-chat
            - deepseek-reasoner
          default: deepseek-chat
          example: deepseek-chat
        messages:
          type: array
          description: |-
            对话消息列表，支持多轮对话

            不同角色的消息具有不同的字段结构，请选择对应角色查看
          items:
            oneOf:
              - $ref: '#/components/schemas/SystemMessage'
              - $ref: '#/components/schemas/UserMessage'
              - $ref: '#/components/schemas/AssistantRequestMessage'
              - $ref: '#/components/schemas/ToolMessage'
            discriminator:
              propertyName: role
              mapping:
                system:
                  $ref: '#/components/schemas/SystemMessage'
                user:
                  $ref: '#/components/schemas/UserMessage'
                assistant:
                  $ref: '#/components/schemas/AssistantRequestMessage'
                tool:
                  $ref: '#/components/schemas/ToolMessage'
          minItems: 1
        thinking:
          type: object
          description: |-
            思考模式控制（Beta）

            **说明**:
            - 用于控制 `deepseek-reasoner` 模型的深度思考功能
            - 启用后模型会在回复前进行深度推理
          properties:
            type:
              type: string
              description: |-
                思考模式开关

                - `enabled`：启用深度思考
                - `disabled`：禁用深度思考
              enum:
                - enabled
                - disabled
        frequency_penalty:
          type: number
          description: |-
            频率惩罚参数，用于减少重复内容

            **说明**:
            - 正值会根据 token 在已生成文本中出现的频率进行惩罚
            - 值越大，越不容易重复已出现的内容
            - 默认值: 0（不惩罚）
          minimum: -2
          maximum: 2
          default: 0
          example: 0
        max_tokens:
          type: integer
          description: |-
            限制生成内容的最大 token 数量

            **说明**:
            - 设置后模型会在达到该数量时停止生成
            - 不设置则由模型自行决定生成长度
          minimum: 1
          example: 4096
        presence_penalty:
          type: number
          description: |-
            存在惩罚参数，用于鼓励生成新话题

            **说明**:
            - 正值会根据 token 是否已在文本中出现过进行惩罚
            - 值越大，越倾向于讨论新话题
            - 默认值: 0（不惩罚）
          minimum: -2
          maximum: 2
          default: 0
          example: 0
        response_format:
          type: object
          description: |-
            指定响应格式

            **说明**:
            - 设置为 `{"type": "json_object"}` 可启用 JSON 模式
            - JSON 模式下模型会输出合法的 JSON 格式内容
          properties:
            type:
              type: string
              enum:
                - text
                - json_object
              description: 响应格式类型
              default: text
        stop:
          description: |-
            停止序列，模型遇到这些字符串时会停止生成

            **说明**:
            - 可以是单个字符串或字符串数组
            - 最多支持 16 个停止序列
          oneOf:
            - type: string
            - type: array
              items:
                type: string
              maxItems: 16
        stream:
          type: boolean
          description: |-
            是否以流式方式返回响应

            - `true`: 流式返回，通过 SSE（Server-Sent Events）逐块实时返回内容
            - `false`: 等待完整响应后一次性返回
          default: false
          example: false
        stream_options:
          type: object
          description: |-
            流式响应选项

            仅在 `stream=true` 时有效
          properties:
            include_usage:
              type: boolean
              description: 流式结束时返回 usage 统计信息
        temperature:
          type: number
          description: |-
            采样温度，控制输出的随机性

            **说明**:
            - 较低值(如 0.2): 更确定、更聚焦的输出
            - 较高值(如 1.5): 更随机、更有创意的输出
            - 默认值: 1
          minimum: 0
          maximum: 2
          default: 1
          example: 1
        top_p:
          type: number
          description: |-
            核采样(Nucleus Sampling)参数

            **说明**:
            - 控制从累积概率前多少的token中采样
            - 例如 0.9 表示从累积概率达到90%的token中选择
            - 默认值: 1.0（考虑所有token）

            **建议**: 不要同时调整 temperature 和 top_p
          minimum: 0
          maximum: 1
          default: 1
          example: 1
        tools:
          type: array
          description: |-
            工具定义列表，用于 Function Calling

            **说明**:
            - 最多支持 128 个工具定义
            - 每个工具需要定义名称、描述和参数 schema
          items:
            $ref: '#/components/schemas/Tool'
          maxItems: 128
        tool_choice:
          description: |-
            控制工具调用行为

            **可选值**:
            - `none`：不调用任何工具
            - `auto`：模型自动决定是否调用工具
            - `required`：强制模型调用一个或多个工具

            **默认值**：未提供 tools 时为 `none`，提供 tools 时为 `auto`
          oneOf:
            - type: string
              enum:
                - none
                - auto
                - required
            - type: object
              description: 指定调用特定工具
              properties:
                type:
                  type: string
                  enum:
                    - function
                function:
                  type: object
                  properties:
                    name:
                      type: string
                      description: 要调用的函数名称
                  required:
                    - name
        logprobs:
          type: boolean
          description: |-
            是否返回 token 的对数概率

            **说明**:
            - 设置为 `true` 时，响应中会包含每个 token 的对数概率信息
          default: false
        top_logprobs:
          type: integer
          description: |-
            返回概率最高的前 N 个 token 的对数概率

            **说明**:
            - 需要 `logprobs` 设置为 `true`
            - 取值范围: `[0, 20]`
          minimum: 0
          maximum: 20
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
          description: 对话完成的唯一标识符
          example: 930c60df-bf64-41c9-a88e-3ec75f81e00e
        model:
          type: string
          description: 实际使用的模型名称
          example: deepseek-chat
        object:
          type: string
          enum:
            - chat.completion
          description: 响应类型
          example: chat.completion
        created:
          type: integer
          description: 创建时间戳
          example: 1770617860
        choices:
          type: array
          description: 对话生成的选择列表
          items:
            $ref: '#/components/schemas/Choice'
        usage:
          $ref: '#/components/schemas/Usage'
        system_fingerprint:
          type: string
          description: 系统指纹标识
          example: fp_eaab8d114b_prod0820_fp8_kvcache
    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: 相关参数名称
    SystemMessage:
      title: System Message
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - system
          description: 角色标识，固定为 `system`
        content:
          type: string
          description: 系统提示词内容，用于设定 AI 的角色和行为
        name:
          type: string
          description: 参与者名称，用于区分不同的系统提示来源
    UserMessage:
      title: User Message
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
          description: 角色标识，固定为 `user`
        content:
          type: string
          description: 用户消息内容（纯文本字符串）
        name:
          type: string
          description: 参与者名称，用于区分不同的用户
    AssistantRequestMessage:
      title: Assistant Message
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - assistant
          description: 角色标识，固定为 `assistant`
        content:
          type:
            - string
            - 'null'
          description: |-
            助手消息内容

            **说明**:
            - 用于多轮对话中传递历史助手回复
            - 当存在 `tool_calls` 时可为 `null`
        name:
          type: string
          description: 参与者名称
        prefix:
          type: boolean
          description: |-
            是否启用前缀续写模式（Beta）

            **说明**:
            - 仅在最后一条消息中设置
            - 设置为 `true` 时，模型会以该消息的 `content` 作为前缀继续生成
          default: false
        reasoning_content:
          type:
            - string
            - 'null'
          description: |-
            思维链内容（Beta）

            **说明**:
            - 仅在使用 `deepseek-reasoner` 模型时有效
            - 用于在多轮对话中传递历史的推理过程内容
            - 使用时 `prefix` 必须设置为 `true`
        tool_calls:
          type: array
          description: |-
            工具调用列表

            用于在多轮对话中传递历史的工具调用信息
          items:
            type: object
            properties:
              id:
                type: string
                description: 工具调用的唯一标识符
              type:
                type: string
                enum:
                  - function
              function:
                type: object
                properties:
                  name:
                    type: string
                    description: 调用的函数名称
                  arguments:
                    type: string
                    description: 函数参数（JSON 字符串）
    ToolMessage:
      title: Tool Message
      type: object
      required:
        - role
        - content
        - tool_call_id
      properties:
        role:
          type: string
          enum:
            - tool
          description: 角色标识，固定为 `tool`
        content:
          type: string
          description: 工具调用的返回结果内容
        tool_call_id:
          type: string
          description: |-
            工具调用 ID

            对应 assistant 消息中 `tool_calls` 返回的 `id` 字段
    Tool:
      type: object
      required:
        - type
        - function
      properties:
        type:
          type: string
          enum:
            - function
          description: 工具类型，目前仅支持 `function`
        function:
          type: object
          required:
            - name
          properties:
            name:
              type: string
              description: |-
                要调用的函数名称

                **说明**:
                - 必须由 a-z、A-Z、0-9 字符组成，或包含下划线和连字符
                - 最大长度为 64 个字符
            description:
              type: string
              description: 函数功能描述，供模型理解何时以及如何调用该函数
            parameters:
              type: object
              description: |-
                函数的输入参数，以 JSON Schema 对象描述

                **说明**:
                - 省略 `parameters` 会定义一个参数列表为空的函数
            strict:
              type: boolean
              description: |-
                是否启用严格模式（Beta）

                **说明**:
                - 设置为 `true` 时，API 将使用 strict 模式进行函数调用
                - 确保输出始终符合函数的 JSON Schema 定义
              default: false
    Choice:
      type: object
      properties:
        index:
          type: integer
          description: 选择的索引
          example: 0
        message:
          $ref: '#/components/schemas/AssistantMessage'
        finish_reason:
          type: string
          description: |-
            完成原因

            - `stop`：自然结束或触发停止序列
            - `length`：达到最大 token 限制
            - `content_filter`：内容被安全策略过滤
            - `tool_calls`：模型调用了工具
            - `insufficient_system_resource`：后端资源不足
          enum:
            - stop
            - length
            - content_filter
            - tool_calls
            - insufficient_system_resource
          example: stop
    Usage:
      type: object
      description: Token 使用统计信息
      properties:
        prompt_tokens:
          type: integer
          description: 输入内容的 token 数量
          example: 16
        completion_tokens:
          type: integer
          description: 输出内容的 token 数量
          example: 10
        total_tokens:
          type: integer
          description: 总 token 数量
          example: 26
        prompt_cache_hit_tokens:
          type: integer
          description: 输入中命中缓存的 token 数量
          example: 0
        prompt_cache_miss_tokens:
          type: integer
          description: 输入中未命中缓存的 token 数量
          example: 16
    AssistantMessage:
      type: object
      properties:
        role:
          type: string
          description: 消息发送者的角色
          enum:
            - assistant
          example: assistant
        content:
          type: string
          description: AI 回复的消息内容
          example: 你好！我是 DeepSeek，一个强大的 AI 助手。我擅长通用对话、代码生成、数学推理等多种任务。
        reasoning_content:
          type: string
          description: |-
            推理过程内容（仅 `deepseek-reasoner` 模型返回）

            **说明**:
            - 包含模型的思考链（Chain of Thought）过程
            - 仅在使用 `deepseek-reasoner` 模型时返回
          example: 让我来分析这个问题...
        tool_calls:
          type: array
          description: 工具调用列表（当模型决定调用工具时返回）
          items:
            type: object
            properties:
              id:
                type: string
                description: 工具调用的唯一标识符
              type:
                type: string
                enum:
                  - function
              function:
                type: object
                properties:
                  name:
                    type: string
                    description: 调用的函数名称
                  arguments:
                    type: string
                    description: 函数参数（JSON 字符串）
  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
        ```

````