All articles

Run DeepSeek V4.1 Flash on your own Lium GPUs

Run DeepSeek-V4.1-Flash on a Lium GPU node with vLLM, then call your own OpenAI-compatible endpoint from your laptop.
Lium team5 min read
deepseek
vllm
llm-inference
h100
DeepSeek V4.1 Flash doesn't have to live behind someone else's API. Rent a GPU node on Lium, serve the open weights yourself, and connect your app to your own endpoint. You choose the exact model release and serving settings without buying GPUs.
In this guide, we'll rent an 8x H100 node on Lium, serve the official DeepSeek-V4.1-Flash release with vLLM, and send a chat request from a laptop. You can follow the same steps and adapt them for your own workload.

1. Pick the GPUs

We follow the vLLM recipe for this model, which lists an 8x H100 setup. The model is deepseek-ai/DeepSeek-V4.1-Flash. It's MIT-licensed, so you can run it, modify it, and use it commercially. The weights are about 510 GB, so plan for a long first download and enough disk on the node.
Lium bills by the second. Check the current H100 price before you launch; this example uses a whole 8-GPU node.

2. Rent the node and start the server

You need a Lium account with enough balance for a few hours on the node, and Python 3 on your laptop.
Install the CLI and sign in once. lium init opens the browser and saves your API key and SSH key. lium ls shows free nodes, cheapest first. --min-download 2000 keeps only nodes that download at 2 Gbps or more, because the 510 GB of weights dominate the first start and a slow node can run out the one-hour start timeout below before the server ever answers.
bash
curl -fsSL https://lium.io/install.sh | bash   # or: pip install lium.io
lium init
lium ls --gpu H100 --count 8 --min-download 2000
V4.1 needs a vLLM build that is only published as a Docker image, so we start the pod from the vllm/vllm-openai nightly image instead of a template. We name it by its digest, the amd64 build that the tag nightly-bb87d227d4b964abb2a966cdf9194f3d376d9bbe (the vLLM commit it was built from) pointed to when we tested. A tag can be re-pushed, but a digest names exactly one image, so the pod runs the build we tested or nothing. Pinning by digest needs an up-to-date CLI: run pip install -U lium.io if yours is older. In this mode lium up runs the image's command and streams its logs rather than opening a shell.
First generate an API key on your laptop. Keep this terminal open: you'll use the key again in step 3.
bash
export VLLM_API_KEY=$(openssl rand -hex 16)
Then rent row 1 of that list (lium up 1). The server listens only on 127.0.0.1 inside the pod, so port 8000 is never published; you'll reach it through SSH. --ttl removes the pod after three hours so a forgotten test doesn't keep billing, and the -e flags set the environment from the recipe; HF_HOME puts the model download on the pod volume rather than the smaller root filesystem, and VLLM_ENGINE_READY_TIMEOUT_S gives the first start the hour the recipe allows instead of vLLM's ten-minute default. The command after --cmd is the recipe's 8x H100 setup: tensor parallel across 8 GPUs, the Engram tables offloaded to CPU memory, and the DeepSeek V4.1 parsers. --revision and --code-revision pin the weights and the model code that --trust-remote-code runs to one reviewed Hugging Face commit, so a later change to the model repository never runs in your pod unseen.
bash
lium up 1 -c 8 --name dsv41 --ttl 3h \
  --image vllm/vllm-openai@sha256:61f5734f6b65f1a50914e4fe6f2d54137bcc8bc6d18ab5dea416bc8be9598340 \
  -e VLLM_API_KEY="$VLLM_API_KEY" \
  -e VLLM_USE_V2_MODEL_RUNNER=1 \
  -e PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \
  -e HF_HOME=/workspace/hf \
  -e VLLM_ENGINE_READY_TIMEOUT_S=3600 \
  --entrypoint vllm \
  --cmd 'serve deepseek-ai/DeepSeek-V4.1-Flash --trust-remote-code --revision 2cba9e42aa026125f3ed06c6d98c1db82f7ca027 --code-revision 2cba9e42aa026125f3ed06c6d98c1db82f7ca027 --tensor-parallel-size 8 --engram-config "{\"cpu_offload\":true}" --max-num-batched-tokens 4096 --gpu-memory-utilization 0.92 --tokenizer-mode deepseek_v41 --reasoning-parser deepseek_v41 --host 127.0.0.1 --port 8000'
The first start downloads the weights before it loads them. On the node we rented, the 510 GB download took about 4.7 minutes, loading the weights onto the GPUs about 30 seconds, and the engine's profiling and warmup about 2.8 minutes. The server printed Application startup complete about 10 minutes after the pod was created. vLLM reported room for about 4.67 million tokens of KV cache (8.84 GiB per GPU after the 47 GiB of weights on each), which is 4.46 requests at the full 1M-token context. Your times depend on the node's download speed. The server is ready when the log prints Application startup complete. Press Ctrl+C to stop following the logs; the pod keeps running. If lium up stops following the log early with a connection error, the pod is still starting: use lium logs dsv41 -f to watch it.
Keep the server private even with the key: not every vLLM route requires it (/health answered without a key in our test, while /v1/models returned 401).

3. Call the endpoint

Open a second terminal for an SSH tunnel. It sends your laptop's 127.0.0.1:8000 to the same address inside the pod without opening that port to the internet. The $(...) part prints the pod's SSH command from lium describe, such as ssh root@203.0.113.7 -p 40123, and the flags after it turn that into a tunnel. It works in bash and zsh. Leave it running.
bash
$(lium describe dsv41 --json | python3 -c 'import json,sys; print(json.load(sys.stdin)["access"]["ssh_cmd"])') \
  -N -L 8000:127.0.0.1:8000
Despite its name, lium port-forward isn't this kind of tunnel. It relays plain TCP to a port published on the pod's public address, so it can't reach the loopback-only server and would send your key unencrypted.
Now return to the first terminal, where VLLM_API_KEY is still set, and make a request. The model thinks by default; DeepSeek recommends temperature 1.0 and top_p 0.95 (or 1.0). You can also use an OpenAI-compatible client with base URL http://127.0.0.1:8000/v1 and the same API key.
bash
curl http://127.0.0.1:8000/v1/chat/completions \
  -H "Authorization: Bearer $VLLM_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"model": "deepseek-ai/DeepSeek-V4.1-Flash", "temperature": 1.0, "top_p": 0.95,
       "messages": [{"role": "user", "content": "Explain MoE models in two sentences."}]}'
On our run this request took 3.5 seconds and returned the answer below with 216 completion tokens (152 of them reasoning). A longer 1,500-token answer ran at about 138 tokens per second for a single request.
Mixture-of-Experts (MoE) models replace dense layers with many expert subnetworks plus a router that selects only a few experts to process each token. This sparse conditional computation lets the model have a huge total parameter count while keeping per-token compute much lower than a dense model of the same size.
The reasoning field of the reply (choices[0].message.reasoning) holds the model's reasoning and content holds the answer. The vLLM recipe shows how to change the reasoning effort.
The curl example is just a starting point. Point any OpenAI-compatible client at the same URL with the same key, and try prompts from your own workload.

4. Shut it down when you're done

When you're finished, remove the pod; the three-hour TTL will do it automatically if you forget.
bash
lium rm dsv41
That's the full loop: rent the GPUs, run the model you chose, use it through your own endpoint, and release the node when you're finished.
Get new posts by e-mail: Subscribe to the Lium newsletter