Please rotate your device

To continue exploring this website, please rotate your device to a vertical orientation

DeepSeek V4.1 Flash

deepseek-ai/DeepSeek-V4.1-Flash

A 552B-parameter multimodal MoE model activating 8B/16B per token, with a 1M-token context for agentic workloads.

Model APIlarge languageimage processing

DeepSeek-V4.1-Flash is a multimodal Mixture-of-Experts model with a 552B-parameter backbone, activating just 8B parameters per token during prefill and 16B during decoding. It natively processes images and text, supports a 1M-token context window, and introduces a Causal Encoder-Decoder architecture with Compressed Sparse Attention 2 to make long-context inference more efficient. Configurable reasoning-effort levels let developers trade latency and cost for deeper deliberation.

Compared with DeepSeek-V4-Flash-0731, DeepSeek-V4.1-Flash reduces the global KV-cache footprint by roughly 4× while delivering stronger coding, reasoning, and agentic performance. This makes it well suited to multimodal agents and input-heavy workloads that require long-context understanding without sacrificing inference efficiency.

Input

python
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://inference.baseten.co/v1",
    api_key=os.environ["BASETEN_API_KEY"],
)

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4.1-Flash",
    messages=[
        {"role": "user", "content": "<PROMPT>"},
    ],
    max_tokens=4096,
    temperature=1,
    top_p=0.95,
    extra_body={
        "chat_template_kwargs": {"thinking": True, "reasoning_effort": "high"}
    },
)

message = response.choices[0].message
print(message.reasoning_content)
print(message.content)

Output

json
{
  "id": "chatcmpl-7f3a9c2e14b84d1e9a0c5b2f8d6e1a37",
  "object": "chat.completion",
  "created": 1785600000,
  "model": "deepseek-ai/DeepSeek-V4.1-Flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "reasoning_content": "<REASONING CONTENT>",
        "content": "<RESPONSE CONTENT>"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 38,
    "completion_tokens": 214,
    "total_tokens": 252,
    "completion_tokens_details": {
      "reasoning_tokens": 61
    }
  }
}