Deploy DeepSeek V4.1 Flash with vLLM
Self-host DeepSeek's 552B MoE open-weight model with native vision and 1M-token context using vLLM — the cheapest frontier-adjacent open model as of September 2026.
DeepSeek V4.1 Flash is a 552B-parameter mixture-of-experts model with native image understanding and a 1-million-token context window, released September 10, 2026 under the MIT license. It is open-weight, making it self-hostable. DeepSeek says it "comprehensively surpassed" the retired V4 Pro across performance, cost, speed, and task completion — and it's dramatically cheaper than Western frontier models.
This recipe deploys V4.1 Flash with vLLM for an OpenAI-compatible API endpoint.
- GPU: Multi-GPU setup required for a 552B MoE model. At FP8/NVFP4 quantization, 4× H100 80GB or equivalent is a practical minimum; at BF16 you need substantially more. Check the latest vLLM and DeepSeek docs for current memory requirements.
- CUDA 12.1+ and compatible NVIDIA drivers
- Python 3.10+
- vLLM 0.7+ (or latest — V4.1 Flash support landed in recent releases)
- Docker (optional, for containerized deployment)
DeepSeek's API pricing for V4.1 Flash is $0.30/1M input (peak) and $1.20/1M output (peak), with off-peak at half. Cache hits drop to $0.006/1M. Self-hosting eliminates per-token cost but requires GPU hardware, power, and operations. The break-even point depends on your token volume — for high-volume agentic workloads running 24/7, self-hosting can be cheaper within months.
- Bind the vLLM server to loopback (
--host 127.0.0.1) and put a reverse proxy with TLS in front for production - The model accepts image input natively — ensure your input pipeline sanitizes uploaded images
- Keep vLLM updated for security patches
- Use environment variables for any API keys if connecting to external tool services
- OOM errors: Reduce
--max-model-len, use FP8 quantization (--quantization fp8), or add more GPUs - Slow first token: MoE models have high cold-start; warm the model with a dummy request after load
- Model download failures: Use
huggingface-cliwith resume support; verify checksums
Steps
pip install vllm --upgrade
Or use the official vLLM Docker image:
docker pull vllm/vllm-openai:latest
DeepSeek V4.1 Flash weights are available on HuggingFace. The model ID is deepseek-ai/DeepSeek-V4.1-Flash (verify on HuggingFace before pulling).
# Using huggingface-cli
pip install huggingface_hub
huggingface-cli download deepseek-ai/DeepSeek-V4.1-Flash
For large models, consider downloading to a mounted volume and using
--model-pathto point vLLM at the local copy.
python -m vllm.entrypoints.openai.api_server \
--model deepseek-ai/DeepSeek-V4.1-Flash \
--tensor-parallel-size 4 \
--max-model-len 1048576 \
--trust-remote-code \
--host 0.0.0.0 \
--port 8000
Key flags:
--tensor-parallel-size 4: Split across 4 GPUs (adjust to your hardware)--max-model-len 1048576: Enable the full 1M context window--trust-remote-code: Required for DeepSeek's custom modeling code
version: '3.8'
services:
vllm-deepseek:
image: vllm/vllm-openai:latest
runtime: nvidia
environment:
- NVIDIA_VISIBLE_DEVICES=all
volumes:
- /path/to/models:/models
- hf_cache:/root/.cache/huggingface
command: >
--model deepseek-ai/DeepSeek-V4.1-Flash
--tensor-parallel-size 4
--max-model-len 1048576
--trust-remote-code
--host 0.0.0.0
--port 8000
ports:
- "8000:8000"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
volumes:
hf_cache:
docker compose up -d
curl http://localhost:8000/v1/models
# Test a completion
curl http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-ai/DeepSeek-V4.1-Flash",
"messages": [{"role": "user", "content": "Write a Python function to check if a number is prime."}]
}'
Recipe verified 2026-09-27. Commands are tested but your environment may differ.
Browse related services