跳转到正文

创建聊天补全 deepseek v3.1思考程度 (流式)

OpenAPI Specification

yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/chat/completions:
    post:
      summary: 创建聊天补全  deepseek v3.1思考程度 (流式)
      deprecated: false
      description: ''
      tags:
        - 聊天(Chat)/ChatGPT聊天(Chat)
      parameters:
        - name: Content-Type
          in: header
          description: ''
          required: true
          example: application/json
          schema:
            type: string
        - name: Accept
          in: header
          description: ''
          required: true
          example: application/json
          schema:
            type: string
        - name: Authorization
          in: header
          description: ''
          required: false
          example: Bearer {{YOUR_API_KEY}}
          schema:
            type: string
        - name: X-Forwarded-Host
          in: header
          description: ''
          required: false
          example: localhost:5173
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  description: 使用的模型的 ID。
                max_tokens:
                  type: integer
                  description: >-
                    限制一次请求中模型生成 completion 的最大 token 数。输入 token 和输出 token
                    的总长度受模型的上下文长度的限制。
                messages:
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                      content:
                        type: string
                    required:
                      - role
                      - content
                    x-apifox-orders:
                      - role
                      - content
                  description: 对话的消息列表。
                temperature:
                  type: integer
                  description: >-
                    使用什么采样温度,介于 0 和 2 之间。较高的值(如 0.8)将使输出更加随机,而较低的值(如
                    0.2)将使输出更加集中和确定。
                stream:
                  type: boolean
                  description: >-
                    如果设置为 True,将会以 SSE(server-sent events)的形式以流式发送消息增量。消息流以
                    data: [DONE] 结尾。
                stream_options:
                  type: object
                  properties:
                    include_usage:
                      type: boolean
                      description: >-
                        如果设置为 true,在流式消息最后的 data: [DONE] 之前将会传输一个额外的块。此块上的 usage
                        字段显示整个请求的 token 使用统计信息,而 choices 字段将始终是一个空数组。所有其他块也将包含一个
                        usage 字段,但其值为 null。
                  x-apifox-orders:
                    - include_usage
                  description: 流式输出相关选项。只有在 stream 参数为 true 时,才可设置此参数。
                thinking:
                  type: object
                  properties:
                    type:
                      type: string
                      description: |-
                        enabled:默认强制开启,强制开启深度思考能力。
                        disabled:强制关闭深度思考能力。
                        auto:模型自行判断是否进行深度思考。
                  x-apifox-orders:
                    - type
                  description: 部分深度思考能力的模型支持通过 thinking 字段控制是否关闭深度思考能力。
              required:
                - model
                - messages
              x-apifox-orders:
                - model
                - max_tokens
                - messages
                - temperature
                - stream
                - stream_options
                - thinking
            example:
              model: deepseek-v3-1-250821
              max_tokens: 1000
              messages:
                - role: system
                  content: You are a helpful assistant.
                - role: user
                  content: 你好
              temperature: 1
              stream: true
              stream_options:
                include_usage: true
              thinking:
                type: enabled
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  object:
                    type: string
                  created:
                    type: integer
                  choices:
                    type: array
                    items:
                      type: object
                      properties:
                        index:
                          type: integer
                        message:
                          type: object
                          properties:
                            role:
                              type: string
                            content:
                              type: string
                          required:
                            - role
                            - content
                          x-apifox-orders:
                            - role
                            - content
                        finish_reason:
                          type: string
                      x-apifox-orders:
                        - index
                        - message
                        - finish_reason
                  usage:
                    type: object
                    properties:
                      prompt_tokens:
                        type: integer
                      completion_tokens:
                        type: integer
                      total_tokens:
                        type: integer
                    required:
                      - prompt_tokens
                      - completion_tokens
                      - total_tokens
                    x-apifox-orders:
                      - prompt_tokens
                      - completion_tokens
                      - total_tokens
                required:
                  - id
                  - object
                  - created
                  - choices
                  - usage
                x-apifox-orders:
                  - id
                  - object
                  - created
                  - choices
                  - usage
              example:
                id: chatcmpl-123
                object: chat.completion
                created: 1677652288
                choices:
                  - index: 0
                    message:
                      role: assistant
                      content: |-


                        Hello there, how may I assist you today?
                    finish_reason: stop
                usage:
                  prompt_tokens: 9
                  completion_tokens: 12
                  total_tokens: 21
          headers: {}
          x-apifox-name: OK
      security:
        - bearer: []
      x-apifox-folder: 聊天(Chat)/ChatGPT聊天(Chat)
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/7937429/apis/api-427877229-run
components:
  schemas: {}
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
servers:
  - url: https://new.22codex.xyz
    description: 正式环境
security:
  - bearer: []

文档内容持续更新,请以控制台可用模型与接口为准。