> ## 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-flash Chat Completions

> Invoke DeepSeek chat completions capability.

Supported models include `deepseek-v4-flash`.

Documented fields: `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` supports text content (string); `assistant` messages support `reasoning_content` and `tool_calls`.



## OpenAPI

````yaml api-reference/en/zmodelChat/deepseek/deepseek-v4-flash.json POST /v1/chat/completions
openapi: 3.0.1
info:
  title: deepseek-v4-flash
  version: 1.0.0
  description: >-
    DeepSeek Chat Completions documentation. The unified API endpoint is
    `/v1/chat/completions`, compatible with the OpenAI Chat Completions request
    format.


    Supported model: `deepseek-v4-flash`.


    This document covers the following request fields: `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 server endpoint
security: []
tags:
  - name: DeepSeek Chat
    description: DeepSeek text chat and tool calling capabilities
paths:
  /v1/chat/completions:
    post:
      tags:
        - DeepSeek Chat
      summary: deepseek-v4-flash
      description: >-
        Invoke DeepSeek chat completions capability.


        Supported models include `deepseek-v4-flash`.


        Documented fields: `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` supports text content (string); `assistant`
        messages support `reasoning_content` and `tool_calls`.
      operationId: deepseekChatCompletions_deepseek_v4_flash
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            examples:
              default:
                summary: Basic text chat
                value:
                  model: deepseek-v4-flash
                  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: >-
            Success. Returns JSON in non-streaming mode; returns an SSE event
            stream in streaming mode.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
              examples:
                success:
                  summary: Non-streaming success response
                  value:
                    id: 26231-33ea-4464-af18-c8c49d256
                    object: chat.completion
                    created: 1782805310
                    model: deepseek-v4-flash
                    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 stream. Each `data:` event can be parsed as a
                  DeepSeek/OpenAI-compatible Chat Completions Chunk; the stream
                  typically ends with `data: [DONE]`. When
                  `stream_options.include_usage=true` is set, an additional
                  chunk with `usage` is returned before the end.
              examples:
                stream:
                  summary: Streaming response chunk
                  value: >
                    data:
                    {"id":"chatcmpl_bp_123","object":"chat.completion.chunk","created":1742342400,"model":"deepseek-v4-flash","choices":[{"index":0,"delta":{"role":"assistant","content":"Calling
                    weather
                    tool"},"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-flash","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: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_request:
                  summary: Parameter error
                  value:
                    error:
                      message: messages is required
                      type: invalid_request_error
                      param: messages
                      code: bad_request_body
        '401':
          description: Authentication failed, e.g. missing or invalid token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unauthorized:
                  summary: Unauthorized
                  value:
                    error:
                      message: Invalid token
                      type: api_error
                      code: access_denied
                      param: ''
        '429':
          description: Rate limit triggered or insufficient account quota.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                quota_exceeded:
                  summary: Insufficient quota or rate limited
                  value:
                    error:
                      message: Insufficient account quota, please retry later
                      type: api_error
                      code: insufficient_user_quota
                      param: ''
        '500':
          description: Internal server error while processing the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal processing failure
                  value:
                    error:
                      message: Internal processing failed, please retry later
                      type: api_error
                      code: gen_relay_info_failed
                      param: ''
      security:
        - BearerAuth: []
components:
  schemas:
    ChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      description: DeepSeek chat completions request body.
      properties:
        model:
          type: string
          description: The ID of the model to use. Supports `deepseek-v4-flash`.
          enum:
            - deepseek-v4-flash
          example: deepseek-v4-flash
        messages:
          type: array
          description: A list of messages comprising the conversation so far.
          minItems: 1
          items:
            $ref: '#/components/schemas/Message'
        thinking:
          $ref: '#/components/schemas/ThinkingConfig'
        stream:
          type: boolean
          default: false
          description: >-
            If set to true, the model will send message deltas as SSE
            (server-sent events). The message stream ends with `data: [DONE]`.
        stream_options:
          $ref: '#/components/schemas/StreamOptions'
        max_tokens:
          type: integer
          description: >-
            The maximum number of tokens the model can generate for the
            completion in a single request. The total length of input and output
            tokens is limited by the model's context length.
        stop:
          description: >-
            A string or a list of up to 16 strings. The API will stop generating
            further tokens when it encounters any of these strings.
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        reasoning_effort:
          type: string
          enum:
            - high
            - max
          description: >-
            Controls the reasoning effort of the model. For normal requests, the
            default is high. For some complex agent-style requests (e.g. Claude
            Code, OpenCode), it is automatically set to max. For compatibility,
            low and medium are mapped to high, and xhigh is mapped to max.
        response_format:
          $ref: '#/components/schemas/ResponseFormat'
        temperature:
          type: number
          minimum: 0
          maximum: 2
          default: 1
          description: >-
            Sampling temperature between 0 and 2. Higher values like 0.8 make
            the output more random, while lower values like 0.2 make it more
            focused and deterministic. We generally recommend altering this or
            top_p but not both.
        top_p:
          type: number
          minimum: 0
          maximum: 1
          default: 1
          description: >-
            An alternative to sampling with temperature, the model considers the
            results of the tokens with top_p probability. So 0.1 means only the
            tokens comprising the top 10% probability mass are considered. We
            generally recommend altering this or temperature but not both.
        logprobs:
          type: boolean
          description: >-
            Whether to return the log probabilities of the output tokens. If
            true, the log probabilities of each output token are returned in the
            content of the message.
        top_logprobs:
          type: integer
          minimum: 0
          maximum: 20
          description: >-
            An integer N between 0 and 20 that specifies the top N tokens by
            probability to return at each output position, along with their log
            probabilities. When this parameter is specified, logprobs must be
            true.
          x-valid-when:
            logprobs:
              - true
        tools:
          type: array
          description: >-
            A list of tools the model may call. Currently, only function is
            supported as a tool. Use this parameter to provide a list of
            functions that take JSON as input. Up to 128 functions are
            supported.
          items:
            $ref: '#/components/schemas/ToolDefinition'
        tool_choice:
          $ref: '#/components/schemas/ToolChoice'
        user_id:
          type: string
          description: >-
            Your custom user_id, with the character set [a-zA-Z0-9\-_] and a
            maximum length of 512. Do not include private user information in
            user_id. user_id can be used to distinguish user identities on your
            side to help us with content safety review.

            user_id can be used for KVCache isolation for privacy management.

            user_id can be used for scheduling isolation of users on your
            business side.
    ChatCompletionResponse:
      type: object
      description: DeepSeek chat completions success response.
      properties:
        id:
          type: string
          description: A unique identifier for the chat.
        object:
          type: string
          description: The type of the object, which is chat.completion.
        created:
          type: integer
          description: >-
            The Unix timestamp (in seconds) when the chat completion was
            created.
        model:
          type: string
          description: The name of the model that generated the completion.
        system_fingerprint:
          type: string
          description: >-
            This fingerprint represents the backend configuration that the model
            runs with.
        choices:
          type: array
          description: A list of completions generated by the model.
          items:
            $ref: '#/components/schemas/ChatCompletionChoice'
        usage:
          $ref: '#/components/schemas/Usage'
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    Message:
      description: >-
        A single message in the conversation. Depending on the role, it is
        divided into four message types: system, user, assistant, and tool.
      oneOf:
        - $ref: '#/components/schemas/SystemMessage'
        - $ref: '#/components/schemas/UserMessage'
        - $ref: '#/components/schemas/AssistantRequestMessage'
        - $ref: '#/components/schemas/ToolMessage'
    ThinkingConfig:
      type: object
      description: Controls the switch between thinking mode and non-thinking mode.
      properties:
        type:
          type: string
          enum:
            - enabled
            - disabled
          default: enabled
          description: >-
            If set to enabled, thinking mode is used. If set to disabled,
            non-thinking mode is used.
    StreamOptions:
      type: object
      description: >-
        Options for streaming output. This parameter can only be set when the
        stream parameter is true.
      properties:
        include_usage:
          type: boolean
          description: >-
            If set to true, an additional chunk will be transmitted just before
            the final `data: [DONE]` in the stream. The usage field on this
            chunk shows the token usage statistics for the entire request, while
            the choices field will always be an empty array. All other chunks
            will also include a usage field, but its value will be null.
    ResponseFormat:
      type: object
      description: >-
        An object specifying the format that the model must output. Setting to {
        "type": "json_object" } enables JSON Output, which guarantees the
        message the model generates is valid JSON.


        Important: When using JSON Output, you must also instruct the model to
        produce JSON yourself via a system or user message. Without this, the
        model may generate an unending stream of whitespace until the generation
        reaches the token limit, resulting in a long-running and seemingly
        "stuck" request. Also note that the message content may be partially cut
        off if finish_reason="length", which indicates the generation exceeded
        max_tokens or the conversation exceeded the max context length.
      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: Function tool definition.
      properties:
        type:
          type: string
          enum:
            - function
          description: The type of the tool. Currently only function is supported.
        function:
          type: object
          required:
            - name
          properties:
            name:
              type: string
              description: >-
                The name of the function to call. Must consist of a-z, A-Z, 0-9
                characters, or include underscores and hyphens, with a maximum
                length of 64 characters.
            description:
              type: string
              description: >-
                A description of what the function does, used by the model to
                understand when and how to call it.
            parameters:
              type: object
              description: >-
                The input parameters of the function, described as a JSON Schema
                object. Omitting parameters defines a function with an empty
                parameter list.
              additionalProperties: true
            strict:
              type: boolean
              default: false
              description: >-
                If set to true, the API will use strict mode in function calls
                to ensure the output always conforms to the function's JSON
                schema definition. This is a Beta feature.
    ToolChoice:
      description: >-
        Controls the model's tool calling behavior. none means the model will
        not call any tool and instead generates a message. auto means the model
        can choose to generate a message or call one or more tools. required
        means the model must call one or more tools. Specifying a particular
        tool via {"type": "function", "function": {"name": "my_function"}}
        forces the model to call that 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: The name of the function to call.
    ChatCompletionChoice:
      type: object
      properties:
        index:
          type: integer
          description: >-
            The index of this completion in the list of completions generated by
            the model.
        message:
          $ref: '#/components/schemas/AssistantMessage'
        finish_reason:
          type: string
          description: >-
            The reason the model stopped generating tokens. `stop` means the
            model finished generating naturally or hit a stop sequence; `length`
            means the output length reached the model's context length limit or
            the max_tokens limit; `content_filter` means the output was filtered
            due to a filtering policy; `tool_calls` means the model called a
            tool; `insufficient_system_resource` means generation was
            interrupted due to insufficient system inference resources.
        logprobs:
          $ref: '#/components/schemas/ChoiceLogprobs'
    Usage:
      type: object
      description: Usage information for this chat completion request.
      properties:
        prompt_tokens:
          type: integer
          description: >-
            The number of tokens contained in the user prompt. This value equals
            prompt_cache_hit_tokens + prompt_cache_miss_tokens.
        completion_tokens:
          type: integer
          description: The number of tokens generated by the model for the completion.
        total_tokens:
          type: integer
          description: The total number of tokens in this request (prompt + completion).
        prompt_cache_hit_tokens:
          type: integer
          description: The number of tokens in the user prompt that hit the context cache.
        prompt_cache_miss_tokens:
          type: integer
          description: >-
            The number of tokens in the user prompt that missed the context
            cache.
        completion_tokens_details:
          type: object
          description: Details about the completion tokens.
          properties:
            reasoning_tokens:
              type: integer
              description: >-
                The number of chain-of-thought tokens generated by the reasoning
                model.
    ErrorObject:
      type: object
      properties:
        message:
          type: string
          description: Error description.
        type:
          type: string
          description: Error type.
        param:
          type: string
          description: Associated field name.
        code:
          type: string
          description: Error code.
    SystemMessage:
      title: System message
      type: object
      required:
        - role
        - content
      description: System message. The role of this message is system.
      properties:
        content:
          type: string
          description: The content of the system message.
        role:
          type: string
          enum:
            - system
          description: The role of the message author, which is system.
        name:
          type: string
          description: >-
            An optional name for the participant, provided to the model to
            distinguish between participants of the same role.
    UserMessage:
      title: User message
      type: object
      required:
        - role
        - content
      description: User message. The role of this message is user.
      properties:
        content:
          type: string
          description: The content of the user message.
        role:
          type: string
          enum:
            - user
          description: The role of the message author, which is user.
        name:
          type: string
          description: >-
            An optional name for the participant, provided to the model to
            distinguish between participants of the same role.
    AssistantRequestMessage:
      title: Assistant message
      type: object
      required:
        - role
      description: Assistant message. The role of this message is assistant.
      properties:
        content:
          type: string
          nullable: true
          description: The content of the assistant message.
        role:
          type: string
          enum:
            - assistant
          description: The role of the message author, which is assistant.
        name:
          type: string
          description: >-
            An optional name for the participant, provided to the model to
            distinguish between participants of the same role.
        prefix:
          type: boolean
          description: >-
            (Beta) Set this to true to force the model to start its response
            with the prefix content provided in this assistant message. 
        reasoning_content:
          type: string
          nullable: true
          description: >-
            (Beta) Used in thinking mode under conversation prefix continuation,
            as input for the last assistant chain-of-thought content. When using
            this feature, the prefix parameter must be set to true.
    ToolMessage:
      title: Tool message
      type: object
      required:
        - role
        - content
        - tool_call_id
      description: Tool message. The role of this message is tool.
      properties:
        role:
          type: string
          enum:
            - tool
          description: The role of the message author, which is tool.
        content:
          type: string
          description: The content of the tool message.
        tool_call_id:
          type: string
          description: The ID of the tool call that this message is responding to.
    AssistantMessage:
      type: object
      properties:
        role:
          type: string
          enum:
            - assistant
          description: The role that generated this message.
        content:
          type: string
          description: The content of this completion.
        reasoning_content:
          type: string
          description: >-
            Only applicable in thinking mode. The reasoning content in the
            assistant message, preceding the final answer.
        tool_calls:
          type: array
          description: Tool calls generated by the model, e.g. function calls.
          items:
            $ref: '#/components/schemas/ToolCallMessage'
    ChoiceLogprobs:
      type: object
      description: The log probabilities information for this choice.
      properties:
        content:
          type: array
          nullable: true
          description: A list of objects containing the log probabilities of output tokens.
          items:
            $ref: '#/components/schemas/LogprobToken'
        reasoning_content:
          type: array
          nullable: true
          description: A list of objects containing the log probabilities of output tokens.
          items:
            $ref: '#/components/schemas/LogprobToken'
    ToolCallMessage:
      type: object
      required:
        - id
        - type
        - function
      description: Tool call object within a message.
      properties:
        id:
          type: string
          description: The ID of the tool call.
        type:
          type: string
          enum:
            - function
          description: The type of the tool. Currently only function is supported.
        function:
          type: object
          description: The function the model called.
          required:
            - name
            - arguments
          properties:
            name:
              type: string
              description: The name of the function the model called.
            arguments:
              type: string
              description: >-
                The arguments to call the function with, generated by the model
                as a JSON string. Note that the model does not always generate
                valid JSON, and may hallucinate parameters not defined in your
                function schema. Validate these arguments in your code before
                calling the function.
    LogprobToken:
      type: object
      description: Log probability information for an output token.
      properties:
        token:
          type: string
          description: The output token.
        logprob:
          type: number
          description: >-
            The log probability of this token. -9999.0 means the token has a
            very small output probability and is not among the top 20 most
            likely output tokens.
        bytes:
          type: array
          nullable: true
          items:
            type: integer
          description: >-
            A list of integers representing the UTF-8 bytes representation of
            the token. Useful when a UTF-8 character is split into multiple
            tokens. If the token has no byte representation, this value is null.
        top_logprobs:
          type: array
          description: >-
            A list of the top N tokens by output probability at this position,
            along with their log probabilities. In rare cases, the number of
            tokens returned may be fewer than the top_logprobs value specified
            in the request.
          items:
            $ref: '#/components/schemas/TopLogprobItem'
    TopLogprobItem:
      type: object
      description: >-
        A top log probability token for the reasoning content, containing the
        token, its log probability, and its UTF-8 byte representation.
      required:
        - token
        - logprob
        - bytes
      properties:
        token:
          type: string
          description: The output token.
        logprob:
          type: number
          description: >-
            The log probability of this token. -9999.0 means the token has a
            very small output probability and is not among the top 20 most
            likely output tokens.
        bytes:
          type: array
          nullable: true
          items:
            type: integer
          description: >-
            A list of integers representing the UTF-8 bytes representation of
            the token. Useful when a UTF-8 character is split into multiple
            tokens. If the token has no byte representation, this value is null.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Token
      description: 'Pass `Authorization: Bearer <token>` in the request header.'

````