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

# deepseek-v4.1-flash

> 使用 DeepSeek V4.1 Flash 根据文本或图像输入生成响应。



## OpenAPI

````yaml zh/api-reference/model-api/deepseek/openapi/deepseek-v4-1-flash/openapi.yaml POST /v1/chat/completions
openapi: 3.1.0
info:
  title: DeepSeek V4.1 Flash
  description: 通过 AnyFast OpenAI 兼容的 Chat Completions API 调用 DeepSeek V4.1 Flash。
  version: 1.0.0
servers:
  - url: https://www.anyfast.ai
security:
  - bearerAuth: []
paths:
  /v1/chat/completions:
    post:
      summary: 创建对话补全
      description: 使用 DeepSeek V4.1 Flash 根据文本或图像输入生成响应。
      operationId: createChatCompletionDeepseekV41Flash
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - messages
              properties:
                model:
                  type: string
                  enum:
                    - deepseek-v4.1-flash
                  description: AnyFast 模型 ID。
                  example: deepseek-v4.1-flash
                messages:
                  type: array
                  minItems: 1
                  description: 对话消息列表。图像内容只能放在 user 消息中。
                  items:
                    type: object
                    required:
                      - role
                      - content
                    properties:
                      role:
                        type: string
                        enum:
                          - system
                          - user
                          - assistant
                          - tool
                      content:
                        oneOf:
                          - type: string
                          - type: array
                            items:
                              oneOf:
                                - type: object
                                  required:
                                    - type
                                    - text
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - text
                                    text:
                                      type: string
                                - type: object
                                  required:
                                    - type
                                    - image_url
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - image_url
                                    image_url:
                                      type: object
                                      required:
                                        - url
                                      properties:
                                        url:
                                          type: string
                                          description: >-
                                            JPEG、PNG、GIF 或 WebP 图像的公网 HTTP(S) URL 或
                                            Base64 data URL。
                                        detail:
                                          type: string
                                          enum:
                                            - low
                                            - high
                                            - original
                                            - auto
                                          default: auto
                      reasoning_content:
                        type: string
                        nullable: true
                        description: 上一轮助手推理内容。使用工具进行多轮对话时需要原样回传。
                      name:
                        type: string
                      tool_call_id:
                        type: string
                        description: tool 消息必填，对应的工具调用 ID。
                      tool_calls:
                        type: array
                        items:
                          $ref: '#/components/schemas/ToolCall'
                thinking:
                  type: object
                  nullable: true
                  description: 思考模式配置。默认开启思考模式。
                  properties:
                    type:
                      type: string
                      enum:
                        - enabled
                        - disabled
                      default: enabled
                reasoning_effort:
                  type: string
                  enum:
                    - none
                    - low
                    - high
                    - max
                  default: high
                  description: 思考开关与推理强度。`none` 关闭思考；该字段位于请求顶层，不属于 `thinking` 对象。
                max_tokens:
                  type: integer
                  minimum: 1
                  maximum: 393216
                  description: 最大生成 Token 数。
                response_format:
                  type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - text
                        - json_object
                      default: text
                  description: 使用 `json_object` 开启 JSON 模式，同时需要在提示词中明确要求输出 JSON。
                stop:
                  oneOf:
                    - type: string
                    - type: array
                      maxItems: 16
                      items:
                        type: string
                stream:
                  type: boolean
                  default: false
                  description: 是否通过 SSE 流式返回消息增量。
                stream_options:
                  type: object
                  properties:
                    include_usage:
                      type: boolean
                      default: false
                temperature:
                  type: number
                  minimum: 0
                  maximum: 2
                  default: 1
                  description: 开启思考模式时该参数会被忽略。
                top_p:
                  type: number
                  minimum: 0
                  maximum: 1
                  default: 1
                  description: 思考模式下小于 0.95 的值按 0.95 处理；非思考模式下有效值为 1.0。
                tools:
                  type: array
                  items:
                    type: object
                    required:
                      - type
                      - function
                    properties:
                      type:
                        type: string
                        enum:
                          - function
                      function:
                        type: object
                        required:
                          - name
                          - parameters
                        properties:
                          name:
                            type: string
                          description:
                            type: string
                          parameters:
                            type: object
                            description: 使用 JSON Schema 描述的函数参数。
                          strict:
                            type: boolean
                tool_choice:
                  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
                frequency_penalty:
                  type: number
                  minimum: -2
                  maximum: 2
                  default: 0
                  description: 为兼容性保留；开启思考模式时不生效。
                presence_penalty:
                  type: number
                  minimum: -2
                  maximum: 2
                  default: 0
                  description: 为兼容性保留；开启思考模式时不生效。
                user_id:
                  type: string
                  maxLength: 512
                  pattern: ^[a-zA-Z0-9\-_]+$
                  description: 用于内容安全和缓存隔离的稳定终端用户标识。
            examples:
              text:
                summary: 文本输入
                value:
                  model: deepseek-v4.1-flash
                  messages:
                    - role: user
                      content: 解释 B 树索引如何加速数据库查询。
                  max_tokens: 1024
              vision:
                summary: 图像输入
                value:
                  model: deepseek-v4.1-flash
                  messages:
                    - role: user
                      content:
                        - type: text
                          text: 描述这张图像并读取其中可见的文字。
                        - type: image_url
                          image_url:
                            url: https://example.com/chart.png
              thinking:
                summary: 思考模式
                value:
                  model: deepseek-v4.1-flash
                  messages:
                    - role: user
                      content: 找出并解释这个算法中的错误。
                  thinking:
                    type: enabled
                  reasoning_effort: high
      responses:
        '200':
          description: 对话补全创建成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletion'
        '400':
          description: 请求参数无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: 未认证
        '429':
          description: 请求频率超限
components:
  schemas:
    ToolCall:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - function
        function:
          type: object
          properties:
            name:
              type: string
            arguments:
              type: string
    ChatCompletion:
      type: object
      required:
        - id
        - object
        - created
        - model
        - choices
        - usage
      properties:
        id:
          type: string
          example: chatcmpl-example
        object:
          type: string
          enum:
            - chat.completion
        created:
          type: integer
          description: Unix 秒级时间戳。
        model:
          type: string
          example: deepseek-v4.1-flash
        choices:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              message:
                type: object
                properties:
                  role:
                    type: string
                    enum:
                      - assistant
                  content:
                    type: string
                    nullable: true
                  reasoning_content:
                    type: string
                    nullable: true
                    description: 开启思考模式时生成的推理内容。
                  tool_calls:
                    type: array
                    nullable: true
                    items:
                      $ref: '#/components/schemas/ToolCall'
              finish_reason:
                type: string
                nullable: true
                enum:
                  - stop
                  - length
                  - content_filter
                  - tool_calls
                  - insufficient_system_resource
                  - null
        usage:
          type: object
          properties:
            prompt_tokens:
              type: integer
            completion_tokens:
              type: integer
            total_tokens:
              type: integer
            prompt_tokens_details:
              type: object
              properties:
                cached_tokens:
                  type: integer
            prompt_cache_hit_tokens:
              type: integer
            prompt_cache_miss_tokens:
              type: integer
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.