Skip to content
English

DeepSeek V4 Flash API

POST /v1/chat/completions

This model uses an OpenAI-compatible Chat Completions endpoint. The same HiAPI API key can call enabled models in your account group; image, video, and audio models use /v1/tasks and a different request shape.

Model overview

Model namedeepseek-v4-flash
TypeText generation · Chat Completions
Context window1,000,000 tokens
Maximum output384,000 tokens
ModesThinking (default) and non-thinking
FeaturesStreaming, JSON mode, tool calls
PricingSee HiAPI Pricing

DeepSeek V4 Flash is the efficiency-focused model in the DeepSeek V4 family. According to DeepSeek, it has 284B total parameters with 13B activated per token, a 1M-token context window, and both thinking and non-thinking modes. HiAPI exposes it through an OpenAI-compatible Chat Completions endpoint.

Production guidance

API key and protocol
  • Use the same HiAPI API key across enabled models.
  • Text models use /v1/chat/completions. Image, video, and audio models use the asynchronous /v1/tasks request shape.
  • Keep API keys on your server and never expose them in browser code.
Limited-time free API quota
  • When the launch campaign is active, eligible topped-up users can opt in by sending X-HiAPI-Promotion: deepseek-v4-flash-launch.
  • A promotion request uses free quota only and never falls back to balance billing automatically.
  • After the daily quota is exhausted, the API returns HTTP 429 with code promotion_quota_exhausted. Remove the promotion header only when your application intends to continue with paid usage.

Best suited for

High-throughput generation

Fast chat, summarization, extraction, and content workflows.

messagesstream
Reasoning and coding

Thinking mode for multi-step analysis and code generation.

thinkingreasoning_effort
Agent workflows

Tool calls and long context for multi-step automation.

toolsmessages
Structured output

JSON mode for machine-readable responses.

response_format

Request parameters

model string required

Use deepseek-v4-flash.

example deepseek-v4-flash
messages array required

Conversation messages in order. Each item contains a role and content.

role enum required

Message role.

enum: systemuserassistanttool
content string required

Message text.

example Explain sparse attention in three sentences.
stream boolean optional

Return Server-Sent Events when true.

default false
max_tokens integer optional

Maximum generated tokens. Input plus output must fit the context window.

example 1024
thinking object optional

Enable or disable thinking mode. Thinking is enabled by default.

type enum required

Thinking-mode switch.

default enabled enum: enableddisabled
reasoning_effort enum optional

Thinking effort. Use max explicitly for maximum effort; on DeepSeek V4 Flash, xhigh is accepted but maps to high.

default high enum: highmax
response_format object optional

Set type=json_object for JSON mode and explicitly ask for JSON in the prompt.

tools array optional

OpenAI-compatible function tool definitions.

API examples

Request examples

Maximum thinking effort

Keep thinking enabled and set reasoning_effort=max.

Request body
{
  "model": "deepseek-v4-flash",
  "messages": [
    {
      "role": "system",
      "content": "You are a concise technical assistant."
    },
    {
      "role": "user",
      "content": "Explain sparse attention in three sentences."
    }
  ],
  "thinking": {
    "type": "enabled"
  },
  "reasoning_effort": "max",
  "stream": false
}
Streaming response

Set stream=true and read SSE chunks until [DONE].

Request body
{
  "model": "deepseek-v4-flash",
  "messages": [
    {
      "role": "system",
      "content": "You are a concise technical assistant."
    },
    {
      "role": "user",
      "content": "Explain sparse attention in three sentences."
    }
  ],
  "thinking": {
    "type": "enabled"
  },
  "reasoning_effort": "high",
  "stream": true
}
Non-thinking JSON response

Disable thinking and request a JSON object.

Request body
{
  "model": "deepseek-v4-flash",
  "messages": [
    {
      "role": "user",
      "content": "Return JSON with keys summary and risks."
    }
  ],
  "thinking": {
    "type": "disabled"
  },
  "response_format": {
    "type": "json_object"
  }
}

Response schema

Non-streaming responses follow the Chat Completions schema. Thinking mode also returns reasoning_content; usage is the billing detail source.

{
  "id": "chatcmpl_example",
  "object": "chat.completion",
  "model": "deepseek-v4-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Sparse attention computes only selected token relationships."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 18,
    "total_tokens": 42,
    "prompt_tokens_details": {
      "cached_tokens": 0
    }
  }
}
  1. Read the answer from choices[0].message.content.
  2. In thinking mode, reasoning is returned in choices[0].message.reasoning_content.
  3. Read prompt, completion, cache, and total Token counts from usage.
  4. For streaming, process each SSE data chunk until the terminal [DONE] event.

FAQ

What is DeepSeek V4 Flash?

DeepSeek V4 Flash is the speed- and cost-efficient open-weight MoE model in the DeepSeek V4 family. According to DeepSeek, it has 284B total parameters, activates 13B parameters per token, supports a 1M-token context window, and provides non-thinking, Think High, and Think Max modes.

How do I change the thinking mode and reasoning effort?

Thinking is enabled by default. Set thinking.type to enabled or disabled, and use reasoning_effort=high or max while thinking is enabled. Use max explicitly for maximum effort; on DeepSeek V4 Flash, xhigh is accepted but maps to high.

Which endpoint and model ID should I use?

Send POST requests to /v1/chat/completions and set model to deepseek-v4-flash.

Can the same HiAPI API key call media models?

Yes. The key is shared, but media generation uses POST /v1/tasks and a different request shape.

How are tokens billed?

Input, output, and cached-input tokens are billed separately. Use the live HiAPI pricing page as the source of truth. View live pricing.

How do I migrate an OpenAI SDK client?

Keep the Chat Completions request shape, replace the base URL with https://api.hiapi.ai/v1, use a HiAPI API key, and set the model to deepseek-v4-flash.

Next steps