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

# deepseek-v4-pro 对话补全

> 调用 DeepSeek chat completions 能力。

支持模型包括 `deepseek-v4-pro`。

本文档公开字段：`model`、`messages`、`thinking`、`stream`、`stream_options.include_usage`、`max_tokens`、`stop`、`reasoning_effort`、`response_format`、`temperature`、`top_p`、`logprobs`、`top_logprobs`、`tools`、`tool_choice`、`user_id`。`messages[].content` 支持文本内容（string）；`assistant` 消息支持 `reasoning_content` 与 `tool_calls`。



## OpenAPI

````yaml api-reference/zh-Hans/zmodelChat/deepseek/deepseek-v4-pro.json POST /v1/chat/completions
openapi: 3.0.1
info:
  title: deepseek-v4-pro
  version: 1.0.0
  description: >-
    DeepSeek 对话补全文档。公开统一入口为 `/v1/chat/completions`，兼容 OpenAI Chat Completions
    请求格式。


    支持模型：`deepseek-v4-pro`。


    本文档覆盖的请求字段包括：`model`、`messages`、`messages[].content`、`messages[].tool_calls`、`messages[].reasoning_content`、`thinking`、`stream`、`stream_options.include_usage`、`max_tokens`、`stop`、`reasoning_effort`、`response_format`、`temperature`、`top_p`、`logprobs`、`top_logprobs`、`tools`、`tool_choice`、`user_id`。
  license:
    name: Project License
    url: https://github.com/QuantumNous/new-api/blob/main/LICENSE
servers:
  - url: https://api.powertokens.ai
    description: Baze API 服务地址
security: []
tags:
  - name: DeepSeek Chat
    description: DeepSeek 文本对话与工具调用能力
paths:
  /v1/chat/completions:
    post:
      tags:
        - DeepSeek Chat
      summary: deepseek-v4-pro
      description: >-
        调用 DeepSeek chat completions 能力。


        支持模型包括 `deepseek-v4-pro`。


        本文档公开字段：`model`、`messages`、`thinking`、`stream`、`stream_options.include_usage`、`max_tokens`、`stop`、`reasoning_effort`、`response_format`、`temperature`、`top_p`、`logprobs`、`top_logprobs`、`tools`、`tool_choice`、`user_id`。`messages[].content`
        支持文本内容（string）；`assistant` 消息支持 `reasoning_content` 与 `tool_calls`。
      operationId: deepseekChatCompletions_deepseek_v4_pro
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            examples:
              default:
                summary: 基础文本对话
                value:
                  model: deepseek-v4-pro
                  messages:
                    - content: You are a helpful assistant
                      role: system
                    - content: Hi
                      role: user
                  thinking:
                    type: enabled
                  reasoning_effort: high
                  max_tokens: 4096
                  response_format:
                    type: text
                  stop: null
                  stream: false
                  stream_options: null
                  temperature: 1
                  top_p: 1
                  tools: null
                  tool_choice: none
                  logprobs: false
                  top_logprobs: null
      responses:
        '200':
          description: 调用成功。非流式模式返回 JSON；流式模式返回 SSE 事件流。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
              examples:
                success:
                  summary: 非流式成功响应
                  value:
                    id: 26231-33ea-4464-af18-c8c49d256
                    object: chat.completion
                    created: 1782805310
                    model: deepseek-v4-pro
                    choices:
                      - index: 0
                        message:
                          role: assistant
                          content: Hello! How can I assist you today?
                          reasoning_content: >-
                            We are given a conversation: "You are a helpful
                            assistant" and "Hi". We need to respond
                            appropriately. Since I'm the assistant, I should
                            respond to the user's greeting. A simple friendly
                            response is fine.
                        logprobs: null
                        finish_reason: stop
                    usage:
                      prompt_tokens: 10
                      completion_tokens: 55
                      total_tokens: 65
                      prompt_tokens_details:
                        cached_tokens: 0
                      completion_tokens_details:
                        reasoning_tokens: 45
                      prompt_cache_hit_tokens: 0
                      prompt_cache_miss_tokens: 10
                    system_fingerprint: fp_9954bca7_prod0820_fp8_kvcache_20260402
            text/event-stream:
              schema:
                type: string
                description: >-
                  SSE 数据流。每个 `data:` 事件都可按 DeepSeek/OpenAI 兼容的 Chat Completions
                  Chunk 解析；结束时通常返回 `data: [DONE]`。当请求设置
                  `stream_options.include_usage=true` 时，结束前会额外返回带 `usage` 的
                  chunk。
              examples:
                stream:
                  summary: 流式响应片段
                  value: >
                    data:
                    {"id":"chatcmpl_bp_123","object":"chat.completion.chunk","created":1742342400,"model":"deepseek-v4-pro","choices":[{"index":0,"delta":{"role":"assistant","content":"正在调用天气工具"},"finish_reason":null}],"usage":{"prompt_tokens":48,"completion_tokens":6,"total_tokens":54}}


                    data:
                    {"id":"chatcmpl_bp_123","object":"chat.completion.chunk","created":1742342401,"model":"deepseek-v4-pro","choices":[{"index":0,"delta":{"tool_calls":[{"index":0,"id":"call_weather","type":"function","function":{"name":"get_weather","arguments":"{\"city\":\"Beijing\"}"}}]},"finish_reason":"tool_calls"}],"usage":{"prompt_tokens":48,"completion_tokens":22,"total_tokens":70}}


                    data: [DONE]
        '400':
          description: 请求参数不合法。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_request:
                  summary: 参数错误
                  value:
                    error:
                      message: messages is required
                      type: invalid_request_error
                      param: messages
                      code: bad_request_body
        '401':
          description: 鉴权失败，例如未提供令牌或令牌无效。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: 未授权
                  value:
                    error:
                      message: 无效的令牌
                      type: api_error
                      code: access_denied
                      param: ''
        '429':
          description: 触发速率限制或账户额度不足。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                quota_exceeded:
                  summary: 额度不足或速率受限
                  value:
                    error:
                      message: 当前账户额度不足，请稍后重试
                      type: api_error
                      code: insufficient_user_quota
                      param: ''
        '500':
          description: 服务端处理请求时发生内部错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: 内部处理失败
                  value:
                    error:
                      message: 服务内部处理失败，请稍后重试
                      type: api_error
                      code: gen_relay_info_failed
                      param: ''
      security:
        - BearerAuth: []
components:
  schemas:
    ChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      description: DeepSeek chat completions 请求体。
      properties:
        model:
          type: string
          description: 使用的模型的 ID。支持 `deepseek-v4-pro`。
          enum:
            - deepseek-v4-pro
          example: deepseek-v4-pro
        messages:
          type: array
          description: 对话的消息列表。
          minItems: 1
          items:
            $ref: '#/components/schemas/Message'
        thinking:
          $ref: '#/components/schemas/ThinkingConfig'
        stream:
          type: boolean
          default: false
          description: >-
            如果设置为 true，将会以 SSE（server-sent events）的形式以流式发送消息增量。消息流以 `data:
            [DONE]` 结尾。
        stream_options:
          $ref: '#/components/schemas/StreamOptions'
        max_tokens:
          type: integer
          description: >-
            限制一次请求中模型生成 completion 的最大 token 数。输入 token 和输出 token
            的总长度受模型的上下文长度的限制。
        stop:
          description: 一个 string 或最多包含 16 个 string 的 list，在遇到这些词时，API 将停止生成更多的 token。
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        reasoning_effort:
          type: string
          enum:
            - high
            - max
          description: >-
            控制模型的推理强度。对普通请求，默认为 high。对一些复杂 Agent 类请求（如 Claude
            Code、OpenCode），自动设置为 max。出于兼容考虑 low、medium 会映射为 high，xhigh 会映射为 max。
        response_format:
          $ref: '#/components/schemas/ResponseFormat'
        temperature:
          type: number
          minimum: 0
          maximum: 2
          default: 1
          description: >-
            采样温度，介于 0 和 2 之间。更高的值，如 0.8，会使输出更随机，而更低的值，如
            0.2，会使其更加集中和确定。我们通常建议可以更改这个值或者更改 top_p，但不建议同时对两者进行修改。
        top_p:
          type: number
          minimum: 0
          maximum: 1
          default: 1
          description: >-
            作为调节采样温度的替代方案，模型会考虑前 top_p 概率的 token 的结果。所以 0.1 就意味着只有包括在最高 10% 概率中的
            token 会被考虑。我们通常建议修改这个值或者更改 temperature，但不建议同时对两者进行修改。
        logprobs:
          type: boolean
          description: >-
            是否返回所输出 token 的对数概率。如果为 true，则在 message 的 content 中返回每个输出 token
            的对数概率。
        top_logprobs:
          type: integer
          minimum: 0
          maximum: 20
          description: >-
            一个介于 0 到 20 之间的整数 N，指定每个输出位置返回输出概率 top N 的 token，且返回这些 token
            的对数概率。指定此参数时，logprobs 必须为 true。
          x-valid-when:
            logprobs:
              - true
        tools:
          type: array
          description: >-
            模型可能会调用的 tool 的列表。目前，仅支持 function 作为工具。使用此参数来提供以 JSON 作为输入参数的
            function 列表。最多支持 128 个 function。
          items:
            $ref: '#/components/schemas/ToolDefinition'
        tool_choice:
          $ref: '#/components/schemas/ToolChoice'
        user_id:
          type: string
          description: >-
            您自定义的 user_id，可选字符集为 [a-zA-Z0-9\-_]，最大长度为 512。请不要在 user_id
            中包含用户隐私信息。user_id 可用于区分您业务侧的用户身份，以帮助我们进行内容安全处理。

            user_id 可用于 KVCache 缓存隔离，以进行隐私管理。

            user_id 可用于我们对您业务侧用户进行调度隔离。
    ChatCompletionResponse:
      type: object
      description: DeepSeek chat completions 成功响应。
      properties:
        id:
          type: string
          description: 该对话的唯一标识符。
        object:
          type: string
          description: 对象的类型，其值为 chat.completion。
        created:
          type: integer
          description: 创建聊天完成时的 Unix 时间戳（以秒为单位）。
        model:
          type: string
          description: 生成该 completion 的模型名。
        system_fingerprint:
          type: string
          description: 该指纹代表模型运行的后端配置。
        choices:
          type: array
          description: 模型生成的 completion 的选择列表。
          items:
            $ref: '#/components/schemas/ChatCompletionChoice'
        usage:
          $ref: '#/components/schemas/Usage'
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    Message:
      description: 对话的消息列表中的单条消息。根据 role 的不同，分为 system、user、assistant、tool 四种消息类型。
      oneOf:
        - $ref: '#/components/schemas/SystemMessage'
        - $ref: '#/components/schemas/UserMessage'
        - $ref: '#/components/schemas/AssistantRequestMessage'
        - $ref: '#/components/schemas/ToolMessage'
    ThinkingConfig:
      type: object
      description: 控制思考模式与非思考模式的转换。
      properties:
        type:
          type: string
          enum:
            - enabled
            - disabled
          default: enabled
          description: 如果设为 enabled，则使用思考模式。如果设为 disabled，则使用非思考模式。
    StreamOptions:
      type: object
      description: 流式输出相关选项。只有在 stream 参数为 true 时，才可设置此参数。
      properties:
        include_usage:
          type: boolean
          description: >-
            如果设置为 true，在流式消息最后的 `data: [DONE]` 之前将会传输一个额外的块。此块上的 usage 字段显示整个请求的
            token 使用统计信息，而 choices 字段将始终是一个空数组。所有其他块也将包含一个 usage 字段，但其值为 null。
    ResponseFormat:
      type: object
      description: >-
        一个 object，指定模型必须输出的格式。


        设置为 { "type": "json_object" } 以启用 JSON 模式，该模式保证模型生成的消息是有效的 JSON。


        注意: 使用 JSON 模式时，你还必须通过系统或用户消息指示模型生成
        JSON。否则，模型可能会生成不断的空白字符，直到生成达到令牌限制，从而导致请求长时间运行并显得“卡住”。此外，如果
        finish_reason="length"，这表示生成超过了 max_tokens 或对话超过了最大上下文长度，消息内容可能会被部分截断。
      properties:
        type:
          type: string
          enum:
            - text
            - json_object
          default: text
          description: Must be one of text or json_object.
    ToolDefinition:
      type: object
      required:
        - type
        - function
      description: 函数工具定义。
      properties:
        type:
          type: string
          enum:
            - function
          description: tool 的类型。目前仅支持 function。
        function:
          type: object
          required:
            - name
          properties:
            name:
              type: string
              description: 要调用的 function 名称。必须由 a-z、A-Z、0-9 字符组成，或包含下划线和连字符，最大长度为 64 个字符。
            description:
              type: string
              description: function 的功能描述，供模型理解何时以及如何调用该 function。
            parameters:
              type: object
              description: >-
                function 的输入参数，以 JSON Schema 对象描述。省略 parameters 会定义一个参数列表为空的
                function。
              additionalProperties: true
            strict:
              type: boolean
              default: false
              description: >-
                如果设置为 true，API 将在函数调用中使用 strict 模式，以确保输出始终符合函数的 JSON schema
                定义。该功能为 Beta 功能。
    ToolChoice:
      description: >-
        控制模型调用 tool 的行为。none 意味着模型不会调用任何 tool，而是生成一条消息。auto
        意味着模型可以选择生成一条消息或调用一个或多个 tool。required 意味着模型必须调用一个或多个 tool。通过 {"type":
        "function", "function": {"name": "my_function"}} 指定特定 tool，会强制模型调用该
        tool。
      oneOf:
        - type: string
          enum:
            - none
            - auto
            - required
        - type: object
          required:
            - type
            - function
          properties:
            type:
              type: string
              enum:
                - function
            function:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  description: 要调用的函数名称。
    ChatCompletionChoice:
      type: object
      properties:
        index:
          type: integer
          description: 该 completion 在模型生成的 completion 的选择列表中的索引。
        message:
          $ref: '#/components/schemas/AssistantMessage'
        finish_reason:
          type: string
          description: >-
            模型停止生成 token 的原因。`stop` 表示模型自然停止生成或遇到 stop 序列；`length`
            表示输出长度达到了模型上下文长度限制或 max_tokens 的限制；`content_filter`
            表示输出内容因触发过滤策略而被过滤；`tool_calls`
            表示模型调用了工具；`insufficient_system_resource` 表示系统推理资源不足，生成被打断。
        logprobs:
          $ref: '#/components/schemas/ChoiceLogprobs'
    Usage:
      type: object
      description: 该对话补全请求的用量信息。
      properties:
        prompt_tokens:
          type: integer
          description: >-
            用户 prompt 所包含的 token 数。该值等于 prompt_cache_hit_tokens +
            prompt_cache_miss_tokens。
        completion_tokens:
          type: integer
          description: 模型 completion 产生的 token 数。
        total_tokens:
          type: integer
          description: 该请求中，所有 token 的数量（prompt + completion）。
        prompt_cache_hit_tokens:
          type: integer
          description: 用户 prompt 中，命中上下文缓存的 token 数。
        prompt_cache_miss_tokens:
          type: integer
          description: 用户 prompt 中，未命中上下文缓存的 token 数。
        completion_tokens_details:
          type: object
          description: completion tokens 的详细信息。
          properties:
            reasoning_tokens:
              type: integer
              description: 推理模型所产生的思维链 token 数量。
    ErrorObject:
      type: object
      properties:
        message:
          type: string
          description: 错误描述。
        type:
          type: string
          description: 错误类型。
        param:
          type: string
          description: 关联字段名。
        code:
          type: string
          description: 错误码。
    SystemMessage:
      title: System message
      type: object
      required:
        - role
        - content
      description: System message。该消息的发起角色为 system。
      properties:
        content:
          type: string
          description: system 消息的内容。
        role:
          type: string
          enum:
            - system
          description: 该消息的发起角色，其值为 system。
        name:
          type: string
          description: 可以选填的参与者的名称，为模型提供信息以区分相同角色的参与者。
    UserMessage:
      title: User message
      type: object
      required:
        - role
        - content
      description: User message。该消息的发起角色为 user。
      properties:
        content:
          type: string
          description: user 消息的内容。
        role:
          type: string
          enum:
            - user
          description: 该消息的发起角色，其值为 user。
        name:
          type: string
          description: 可以选填的参与者的名称，为模型提供信息以区分相同角色的参与者。
    AssistantRequestMessage:
      title: Assistant message
      type: object
      required:
        - role
      description: Assistant message。该消息的发起角色为 assistant。
      properties:
        content:
          type: string
          nullable: true
          description: assistant 消息的内容。
        role:
          type: string
          enum:
            - assistant
          description: 该消息的发起角色，其值为 assistant。
        name:
          type: string
          description: 可以选填的参与者的名称，为模型提供信息以区分相同角色的参与者。
        prefix:
          type: boolean
          description: (Beta) 设置此参数为 true，来强制模型在其回答中以此 assistant 消息中提供的前缀内容开始。
        reasoning_content:
          type: string
          nullable: true
          description: >-
            (Beta) 用于思考模式下在对话前缀续写功能下，作为最后一条 assistant 思维链内容的输入。使用此功能时，prefix
            参数必须设置为 true。
    ToolMessage:
      title: Tool message
      type: object
      required:
        - role
        - content
        - tool_call_id
      description: Tool message。该消息的发起角色为 tool。
      properties:
        role:
          type: string
          enum:
            - tool
          description: 该消息的发起角色，其值为 tool。
        content:
          type: string
          description: tool 消息的内容。
        tool_call_id:
          type: string
          description: 此消息所响应的 tool call 的 ID。
    AssistantMessage:
      type: object
      properties:
        role:
          type: string
          enum:
            - assistant
          description: 生成这条消息的角色。
        content:
          type: string
          description: 该 completion 的内容。
        reasoning_content:
          type: string
          description: 仅适用于思考模式。内容为 assistant 消息中在最终答案之前的推理内容。
        tool_calls:
          type: array
          description: 模型生成的 tool 调用，例如 function 调用。
          items:
            $ref: '#/components/schemas/ToolCallMessage'
    ChoiceLogprobs:
      type: object
      description: 该 choice 的对数概率信息。
      properties:
        content:
          type: array
          nullable: true
          description: 一个包含输出 token 对数概率信息的列表。
          items:
            $ref: '#/components/schemas/LogprobToken'
        reasoning_content:
          type: array
          nullable: true
          description: 一个包含输出 token 对数概率信息的列表。
          items:
            $ref: '#/components/schemas/LogprobToken'
    ToolCallMessage:
      type: object
      required:
        - id
        - type
        - function
      description: 消息中的工具调用对象。
      properties:
        id:
          type: string
          description: tool 调用的 ID。
        type:
          type: string
          enum:
            - function
          description: tool 的类型。目前仅支持 function。
        function:
          type: object
          description: 模型调用的 function。
          required:
            - name
            - arguments
          properties:
            name:
              type: string
              description: 模型调用的 function 名。
            arguments:
              type: string
              description: >-
                要调用的 function 的参数，由模型生成，格式为 JSON。请注意，模型并不总是生成有效的
                JSON，并且可能会臆造出你函数模式中未定义的参数。在调用函数之前，请在代码中验证这些参数。
    LogprobToken:
      type: object
      description: 输出 token 的对数概率信息。
      properties:
        token:
          type: string
          description: 输出的 token。
        logprob:
          type: number
          description: 该 token 的对数概率。-9999.0 代表该 token 的输出概率极小，不在 top 20 最可能输出的 token 中。
        bytes:
          type: array
          nullable: true
          items:
            type: integer
          description: >-
            一个包含该 token UTF-8 字节表示的整数列表。一般在一个 UTF-8 字符被拆分成多个 token 来表示时有用。如果
            token 没有对应的字节表示，则该值为 null。
        top_logprobs:
          type: array
          description: >-
            一个包含在该输出位置上，输出概率 top N 的 token 的列表，以及它们的对数概率。在罕见情况下，返回的 token
            数量可能少于请求参数中指定的 top_logprobs 值。
          items:
            $ref: '#/components/schemas/TopLogprobItem'
    TopLogprobItem:
      type: object
      description: 推理内容的 top 对数概率 token，包含该 token、其对数概率以及 UTF-8 字节表示。
      required:
        - token
        - logprob
        - bytes
      properties:
        token:
          type: string
          description: 输出的 token。
        logprob:
          type: number
          description: 该 token 的对数概率。-9999.0 代表该 token 的输出概率极小，不在 top 20 最可能输出的 token 中。
        bytes:
          type: array
          nullable: true
          items:
            type: integer
          description: >-
            一个包含该 token UTF-8 字节表示的整数列表。一般在一个 UTF-8 字符被拆分成多个 token 来表示时有用。如果
            token 没有对应的字节表示，则该值为 null。
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Token
      description: '在请求头中传入 `Authorization: Bearer <token>`。'

````