> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aireserve.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Serve DeepSeek V4.1 Flash

> Provision 8×H200, pin the released V4.1 Flash checkpoint, and qualify text and image serving with a V4.1-capable vLLM nightly.

DeepSeek V4.1 Flash is the only released V4.1 checkpoint. There is no plain
`DeepSeek-V4.1` artifact and no released `DeepSeek-V4.1-Pro` checkpoint. This
playbook serves `deepseek-ai/DeepSeek-V4.1-Flash`.

> [!WARNING]
>
> **Vendor-verified · AI Reserve qualification pending.** The architecture is
> not served by a normal vLLM pip wheel. Use a vLLM 0.30-era nightly from
> 2026-09-10 or later, then pin the image digest that passes. Never let a
> floating `nightly` update in place under production traffic.

## Recipe contract

| Item | Pinned value |
| - | - |
| Artifact | `deepseek-ai/DeepSeek-V4.1-Flash` |
| Revision reviewed | `5254448103b6254fc646dacbca1cbbf20e9216c1` |
| Weights | Native MXFP4 experts + MXFP8 dense weights, FP8 Engram tables, BF16 embeddings; about 511 GB downloaded and about 614 GB runtime budget |
| Architecture | 552B backbone plus 196.6B Engram memory and DSpark drafter; 8B active in prefill / 16B in decode |
| Context | 1,048,576 architectural maximum |
| Primary engine | vLLM 0.30-era/nightly Docker; no supported normal pip wheel at review time |
| Reference image | `vllm/vllm-openai:nightly`; replace with a qualified digest dated 2026-09-10 or later |
| Hardware | 8×`H200_141GB` with weights resident; smaller H200 shapes require Engram host offload |
| Persistent storage | 800 GB minimum; use 1,000 GB when retaining rollback artifacts |
| Modalities | Text and images |
| License | MIT, ungated |
| Last reviewed | 2026-10-14 |

V4.1 uses a different tokenizer and parser contract from V4. Do not reuse
`deepseek_v4` flags: all three parser modes here are `deepseek_v41`.

## 0. Set up your shell

Every command on this page is copy-paste. Paste this block once per terminal
and replace only the API key; every later step reads these variables.

```bash theme={"dark"}
export AIRESERVE_API_KEY="aireserve_api_..."   # the only value you type: a key with Compute: Manage access
export API="https://api.aireserve.com"
export VLLM_API_KEY="$(openssl rand -hex 32)"  # generated for you; it protects your model server (see below)
echo "VLLM_API_KEY=$VLLM_API_KEY"               # save it: every request to the endpoint needs it
```

> [!NOTE]
>
> **Two keys, two jobs.** `AIRESERVE_API_KEY` authenticates you to AI Reserve
> and creates the volume, quote, and instance. `VLLM_API_KEY` is a password you
> invent for the vLLM server you are about to start: step 4 passes it as
> vLLM's `--api-key`, so the public HTTP port rejects anyone who does not
> send it. No vendor issues it and AI Reserve never sees it.

The Python and TypeScript tabs read the same three variables from the
environment. The shell tabs need `curl` and `jq`; the Python tabs need
`requests` (`python -m pip install requests`).

### Check stock first

A quote is free and creates nothing. Run one before creating storage, because
the volume in step 1 is placed next to this hardware and fails the same way
when none is in stock:

```bash theme={"dark"}
curl -sS -X POST "$API/v1/gpu/instances/quote" \
  -H "Authorization: Bearer $AIRESERVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"accelerator": "H200_141GB", "count": 8, "region": "united_states", "image": "vllm/vllm-openai:nightly", "diskGb": 100}' \
  | jq '{availability, price, error}'
```

A response with `availability` and `price` means you can continue. An `error`
with `code: no_capacity` means this shape is not in stock in that region right
now: try another `region` here and in steps 1 and 2, or wait, and read
[`no_capacity` reasons](/gpu-infrastructure/operations#no_capacity-reasons).

## 1. Allocate the model volume

**Available now.** The accelerator hint places the volume in a data center
where 8×H200 has stock today, so the instance in step 4 can mount it. If step 0
reported no stock, this call fails the same way.

```bash curl theme={"dark"}
ACCEPTED=$(curl -sS -X POST "$API/v1/gpu/volumes" \
  -H "Authorization: Bearer $AIRESERVE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: deepseek-v4-1-flash-weights-v1" \
  -d '{
    "name": "deepseek-v4-1-flash-weights",
    "region": "united_states",
    "sizeGb": 800,
    "acceleratorHint": "H200_141GB",
    "storageBillingAcknowledged": true
  }')
export VOLUME_ID=$(jq -r .resourceId <<<"$ACCEPTED")
export OPERATION_ID=$(jq -r .operationId <<<"$ACCEPTED")
jq -e .resourceId <<<"$ACCEPTED" >/dev/null \
  && echo "accepted: volume $VOLUME_ID (operation $OPERATION_ID)" \
  || { echo "The volume was not accepted:"; jq . <<<"$ACCEPTED"; }
```

```python Python theme={"dark"}
import os, requests, time

API = "https://api.aireserve.com"
AUTH = {"Authorization": f"Bearer {os.environ['AIRESERVE_API_KEY']}"}

response = requests.post(
    f"{API}/v1/gpu/volumes",
    headers={**AUTH, "Idempotency-Key": "deepseek-v4-1-flash-weights-v1"},
    json={
        "name": "deepseek-v4-1-flash-weights",
        "region": "united_states",
        "sizeGb": 800,
        "acceleratorHint": "H200_141GB",
        "storageBillingAcknowledged": True,
    },
    timeout=60,
)
response.raise_for_status()
accepted = response.json()
volume_id = accepted["resourceId"]
operation_id = accepted["operationId"]
```

```typescript TypeScript theme={"dark"}
const API = "https://api.aireserve.com";
const auth = { Authorization: `Bearer ${process.env.AIRESERVE_API_KEY}` };

const response = await fetch(`${API}/v1/gpu/volumes`, {
  method: "POST",
  headers: {
    ...auth,
    "Content-Type": "application/json",
    "Idempotency-Key": "deepseek-v4-1-flash-weights-v1",
  },
  body: JSON.stringify({
    name: "deepseek-v4-1-flash-weights",
    region: "united_states",
    sizeGb: 800,
    acceleratorHint: "H200_141GB",
    storageBillingAcknowledged: true,
  }),
});
if (!response.ok) throw new Error(await response.text());
const accepted = await response.json();
const volumeId = accepted.resourceId;
const operationId = accepted.operationId;
```

Wait for the operation to finish before you quote compute:

```bash curl theme={"dark"}
while :; do
  OPERATION=$(curl -sS "$API/v1/gpu/operations/$OPERATION_ID" \
    -H "Authorization: Bearer $AIRESERVE_API_KEY")
  STATUS=$(jq -r .status <<<"$OPERATION")
  echo "operation $OPERATION_ID: $STATUS"
  case "$STATUS" in
    succeeded) break ;;
    failed|cancelled)
      jq -r '.failure // empty | "whose: \(.actor)\nwhy:   \(.message)\nnext:  \(.next)"' <<<"$OPERATION"
      break ;;
  esac
  sleep 10
done
```

```python Python theme={"dark"}
def wait_for(operation_id):
    while True:
        operation = requests.get(f"{API}/v1/gpu/operations/{operation_id}", headers=AUTH, timeout=60).json()
        print("operation", operation_id, operation.get("status"))
        if operation.get("status") == "succeeded":
            return operation
        if operation.get("status") in {"failed", "cancelled"}:
            failure = operation.get("failure") or {}
            raise RuntimeError(f"{failure.get('actor', 'unknown')}: {failure.get('message', operation.get('errorMessage'))} {failure.get('next', '')}")
        time.sleep(10)

wait_for(operation_id)
```

```typescript TypeScript theme={"dark"}
async function waitFor(operationId: string) {
  while (true) {
    const response = await fetch(`${API}/v1/gpu/operations/${operationId}`, { headers: auth });
    const operation = await response.json();
    console.log("operation", operationId, operation.status);
    if (operation.status === "succeeded") return operation;
    if (["failed", "cancelled"].includes(operation.status)) {
      const failure = operation.failure ?? {};
      throw new Error(`${failure.actor ?? "unknown"}: ${failure.message ?? operation.errorMessage} ${failure.next ?? ""}`);
    }
    await new Promise((resolve) => setTimeout(resolve, 10_000));
  }
}

await waitFor(operationId);
```

## 2. Quote 8×H200

**Available now.** The quote binds the floating reference tag. For a real
release, replace it with the digest you qualified before requesting the quote.
A quote expires after 120 seconds, so run step 4 right after it; if it has
expired, run this step again.

```bash curl theme={"dark"}
QUOTE=$(curl -sS -X POST "$API/v1/gpu/instances/quote" \
  -H "Authorization: Bearer $AIRESERVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"accelerator\": \"H200_141GB\",
    \"count\": 8,
    \"region\": \"united_states\",
    \"image\": \"vllm/vllm-openai:nightly\",
    \"diskGb\": 100,
    \"volumeId\": \"$VOLUME_ID\",
    \"volumeMountPath\": \"/models\"
  }")
export QUOTE_ID=$(jq -r .quoteId <<<"$QUOTE")
jq '{quoteId, expiresAt, availability, price, storage, error}' <<<"$QUOTE"
```

```python Python theme={"dark"}
response = requests.post(
    f"{API}/v1/gpu/instances/quote",
    headers=AUTH,
    json={
        "accelerator": "H200_141GB",
        "count": 8,
        "region": "united_states",
        "image": "vllm/vllm-openai:nightly",
        "diskGb": 100,
        "volumeId": volume_id,
        "volumeMountPath": "/models",
    },
    timeout=60,
)
response.raise_for_status()
quote = response.json()
quote_id = quote["quoteId"]
print(quote["price"], quote["availability"], quote["expiresAt"])
```

```typescript TypeScript theme={"dark"}
const quoteResponse = await fetch(`${API}/v1/gpu/instances/quote`, {
  method: "POST",
  headers: { ...auth, "Content-Type": "application/json" },
  body: JSON.stringify({
    accelerator: "H200_141GB",
    count: 8,
    region: "united_states",
    image: "vllm/vllm-openai:nightly",
    diskGb: 100,
    volumeId,
    volumeMountPath: "/models",
  }),
});
if (!quoteResponse.ok) throw new Error(await quoteResponse.text());
const quote = await quoteResponse.json();
const quoteId = quote.quoteId;
console.log(quote.price, quote.availability, quote.expiresAt);
```

## 3. Download the pinned artifact

**Manual today.** Use a loader with the persistent volume attached, or let
vLLM populate `HF_HOME` during first start. The verification command requires
the current `hf` CLI from `huggingface_hub` 1.18 or later, not the deprecated
`huggingface-cli`:

```bash theme={"dark"}
hf download deepseek-ai/DeepSeek-V4.1-Flash \
  --revision 5254448103b6254fc646dacbca1cbbf20e9216c1 \
  --local-dir /models/DeepSeek-V4.1-Flash

hf cache verify deepseek-ai/DeepSeek-V4.1-Flash \
  --revision 5254448103b6254fc646dacbca1cbbf20e9216c1 \
  --local-dir /models/DeepSeek-V4.1-Flash \
  --fail-on-missing-files
```

No official BF16, GPTQ, AWQ, or GGUF production artifact is part of this
recipe. Treat every conversion as a separate model requiring task-quality,
vision, long-context, tool, and latency acceptance.

## 4. Launch the V4.1 server

**Available now, runtime qualification pending.** This starts target-only
serving with the vision tower enabled. DSpark comes later, after the target
baseline passes. The eight-GPU topology keeps Engram resident instead of
depending on host-memory offload.

```bash curl theme={"dark"}
LAUNCH=$(jq -n \
  --arg quoteId "$QUOTE_ID" \
  --arg apiKey "$VLLM_API_KEY" \
  '{
    quoteId: $quoteId,
    name: "deepseek-v4-1-flash-vllm",
    env: {
      HF_HOME: "/models/hf",
      VLLM_ENGINE_READY_TIMEOUT_S: "3600",
      VLLM_USE_RUST_FRONTEND: "1"
    },
    ports: [{port: 8000, protocol: "http"}],
    publicPortsAcknowledged: true,
    dockerStartCmd: [
      "--model=deepseek-ai/DeepSeek-V4.1-Flash",
      "--revision=5254448103b6254fc646dacbca1cbbf20e9216c1",
      "--served-model-name=deepseek-v4.1-flash",
      "--host=0.0.0.0", "--port=8000",
      "--api-key=\($apiKey)",
      "--tensor-parallel-size=8",
      "--tokenizer-mode=deepseek_v41",
      "--attention-config={\"backend\":\"FLASHINFER_MLA_SPARSE_DSV41\",\"indexer_kv_dtype\":\"mxfp4\",\"indexer_sparse_logits\":true}",
      "--kv-cache-dtype=fp8",
      "--max-model-len=1048576",
      "--max-num-seqs=128",
      "--engram-config={\"cpu_offload\":false}",
      "--tool-call-parser=deepseek_v41",
      "--enable-auto-tool-choice",
      "--reasoning-parser=deepseek_v41",
      "--mm-encoder-tp-mode=data"
    ]
  }' | curl -sS -X POST "$API/v1/gpu/instances" \
    -H "Authorization: Bearer $AIRESERVE_API_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: deepseek-v4-1-flash-serve-v1" \
    --data-binary @-)
export INSTANCE_ID=$(jq -r .resourceId <<<"$LAUNCH")
export OPERATION_ID=$(jq -r .operationId <<<"$LAUNCH")
jq -e .resourceId <<<"$LAUNCH" >/dev/null \
  && echo "accepted: instance $INSTANCE_ID (operation $OPERATION_ID)" \
  || { echo "The launch was not accepted:"; jq . <<<"$LAUNCH"; }
```

```python Python theme={"dark"}
command = [
    "--model=deepseek-ai/DeepSeek-V4.1-Flash",
    "--revision=5254448103b6254fc646dacbca1cbbf20e9216c1",
    "--served-model-name=deepseek-v4.1-flash",
    "--host=0.0.0.0", "--port=8000",
    f"--api-key={os.environ['VLLM_API_KEY']}",
    "--tensor-parallel-size=8",
    "--tokenizer-mode=deepseek_v41",
    '--attention-config={"backend":"FLASHINFER_MLA_SPARSE_DSV41","indexer_kv_dtype":"mxfp4","indexer_sparse_logits":true}',
    "--kv-cache-dtype=fp8",
    "--max-model-len=1048576",
    "--max-num-seqs=128",
    '--engram-config={"cpu_offload":false}',
    "--tool-call-parser=deepseek_v41",
    "--enable-auto-tool-choice",
    "--reasoning-parser=deepseek_v41",
    "--mm-encoder-tp-mode=data",
]
response = requests.post(
    f"{API}/v1/gpu/instances",
    headers={**AUTH, "Idempotency-Key": "deepseek-v4-1-flash-serve-v1"},
    json={
        "quoteId": quote_id,
        "name": "deepseek-v4-1-flash-vllm",
        "env": {
            "HF_HOME": "/models/hf",
            "VLLM_ENGINE_READY_TIMEOUT_S": "3600",
            "VLLM_USE_RUST_FRONTEND": "1",
        },
        "ports": [{"port": 8000, "protocol": "http"}],
        "publicPortsAcknowledged": True,
        "dockerStartCmd": command,
    },
    timeout=60,
)
response.raise_for_status()
launched = response.json()
instance_id = launched["resourceId"]
operation_id = launched["operationId"]
wait_for(operation_id)
```

```typescript TypeScript theme={"dark"}
const command = [
  "--model=deepseek-ai/DeepSeek-V4.1-Flash",
  "--revision=5254448103b6254fc646dacbca1cbbf20e9216c1",
  "--served-model-name=deepseek-v4.1-flash",
  "--host=0.0.0.0", "--port=8000",
  `--api-key=${process.env.VLLM_API_KEY!}`,
  "--tensor-parallel-size=8",
  "--tokenizer-mode=deepseek_v41",
  '--attention-config={"backend":"FLASHINFER_MLA_SPARSE_DSV41","indexer_kv_dtype":"mxfp4","indexer_sparse_logits":true}',
  "--kv-cache-dtype=fp8",
  "--max-model-len=1048576",
  "--max-num-seqs=128",
  '--engram-config={"cpu_offload":false}',
  "--tool-call-parser=deepseek_v41",
  "--enable-auto-tool-choice",
  "--reasoning-parser=deepseek_v41",
  "--mm-encoder-tp-mode=data",
];
const launchResponse = await fetch(`${API}/v1/gpu/instances`, {
  method: "POST",
  headers: {
    ...auth,
    "Content-Type": "application/json",
    "Idempotency-Key": "deepseek-v4-1-flash-serve-v1",
  },
  body: JSON.stringify({
    quoteId,
    name: "deepseek-v4-1-flash-vllm",
    env: {
      HF_HOME: "/models/hf",
      VLLM_ENGINE_READY_TIMEOUT_S: "3600",
      VLLM_USE_RUST_FRONTEND: "1",
    },
    ports: [{ port: 8000, protocol: "http" }],
    publicPortsAcknowledged: true,
    dockerStartCmd: command,
  }),
});
if (!launchResponse.ok) throw new Error(await launchResponse.text());
const launched = await launchResponse.json();
const instanceId = launched.resourceId;
const operationId = launched.operationId;
await waitFor(operationId);
```

Wait for the launch operation the same way as in step 1 (`wait_for` and
`waitFor` are already defined there):

```bash theme={"dark"}
while :; do
  OPERATION=$(curl -sS "$API/v1/gpu/operations/$OPERATION_ID" \
    -H "Authorization: Bearer $AIRESERVE_API_KEY")
  STATUS=$(jq -r .status <<<"$OPERATION")
  echo "operation $OPERATION_ID: $STATUS"
  case "$STATUS" in
    succeeded) break ;;
    failed|cancelled)
      jq -r '.failure // empty | "whose: \(.actor)\nwhy:   \(.message)\nnext:  \(.next)"' <<<"$OPERATION"
      break ;;
  esac
  sleep 10
done
```

A running instance is not a ready model. vLLM still has to load about
511 GB of weights (downloading them first unless step 3 staged them) and
shard them across eight GPUs, which takes tens of minutes. Step 5 waits for
`/v1/models` before the first request. To watch progress:

```bash theme={"dark"}
curl -N "$API/v1/gpu/instances/$INSTANCE_ID/logs?tail=200" \
  -H "Authorization: Bearer $AIRESERVE_API_KEY"
```

For text-only traffic, qualify a second profile with `--language-model-only`
and remove `--mm-encoder-tp-mode data`. Do not silently route image requests to
that profile.

## 5. Verify reasoning, tools, and vision

Set `ENDPOINT` to the returned port-8000 URL.

```bash curl theme={"dark"}
CONNECTIONS=$(curl -sS "$API/v1/gpu/instances/$INSTANCE_ID/connections" \
  -H "Authorization: Bearer $AIRESERVE_API_KEY")
export ENDPOINT=$(jq -er '.http[] | select(.port == 8000) | .url' <<<"$CONNECTIONS")
[ -n "$ENDPOINT" ] && echo "ENDPOINT=$ENDPOINT" || jq . <<<"$CONNECTIONS"
```

```python Python theme={"dark"}
response = requests.get(
    f"{API}/v1/gpu/instances/{instance_id}/connections",
    headers=AUTH,
    timeout=60,
)
response.raise_for_status()
connection = next(item for item in response.json()["http"] if item["port"] == 8000)
endpoint = connection["url"]
```

```typescript TypeScript theme={"dark"}
const connectionResponse = await fetch(`${API}/v1/gpu/instances/${instanceId}/connections`, {
  headers: auth,
});
if (!connectionResponse.ok) throw new Error(await connectionResponse.text());
const connections = await connectionResponse.json();
const connection = connections.http.find((item: { port: number }) => item.port === 8000);
if (!connection) throw new Error("port 8000 is not available in instance connections");
const endpoint = connection.url;
```

Wait until the model is loaded. The first successful `/v1/models` is the
readiness signal; until then the port returns connection errors or 5xx:

```bash theme={"dark"}
until curl -fsS "$ENDPOINT/v1/models" -H "Authorization: Bearer $VLLM_API_KEY" >/dev/null 2>&1; do
  echo "model still loading..."; sleep 30
done
```

```bash curl theme={"dark"}
curl -sS "$ENDPOINT/v1/models" \
  -H "Authorization: Bearer $VLLM_API_KEY"

curl -sS "$ENDPOINT/v1/chat/completions" \
  -H "Authorization: Bearer $VLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "messages": [{"role": "user", "content": "What is 17*19? Return only the integer."}],
    "temperature": 1,
    "top_p": 0.95,
    "max_tokens": 4096,
    "chat_template_kwargs": {"thinking": true, "reasoning_effort": 75}
  }'
```

```python Python theme={"dark"}
response = requests.post(
    f"{endpoint}/v1/chat/completions",
    headers={"Authorization": f"Bearer {os.environ['VLLM_API_KEY']}"},
    json={
        "model": "deepseek-v4.1-flash",
        "messages": [{"role": "user", "content": "What is 17*19? Return only the integer."}],
        "temperature": 1,
        "top_p": 0.95,
        "max_tokens": 4096,
        "chat_template_kwargs": {"thinking": True, "reasoning_effort": 75},
    },
    timeout=300,
)
response.raise_for_status()
print(response.json())
```

```typescript TypeScript theme={"dark"}
const response = await fetch(`${endpoint}/v1/chat/completions`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.VLLM_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "deepseek-v4.1-flash",
    messages: [{ role: "user", content: "What is 17*19? Return only the integer." }],
    temperature: 1,
    top_p: 0.95,
    max_tokens: 4096,
    chat_template_kwargs: { thinking: true, reasoning_effort: 75 },
  }),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
```

### Vision smoke test

`IMAGE_URL` is any image the server can fetch; a public sample is set here so
the test runs as written. This must pass before the multimodal profile is
considered ready:

```bash theme={"dark"}
export IMAGE_URL="https://upload.wikimedia.org/wikipedia/commons/3/3f/JPEG_example_flower.jpg"  # any public image works
```

```bash curl theme={"dark"}
curl -sS "$ENDPOINT/v1/chat/completions" \
  -H "Authorization: Bearer $VLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"model\": \"deepseek-v4.1-flash\",
    \"messages\": [{
      \"role\": \"user\",
      \"content\": [
        {\"type\": \"text\", \"text\": \"Describe the image in one sentence.\"},
        {\"type\": \"image_url\", \"image_url\": {\"url\": \"$IMAGE_URL\"}}
      ]
    }],
    \"max_tokens\": 1024,
    \"chat_template_kwargs\": {\"thinking\": false}
  }"
```

```python Python theme={"dark"}
response = requests.post(
    f"{endpoint}/v1/chat/completions",
    headers={"Authorization": f"Bearer {os.environ['VLLM_API_KEY']}"},
    json={
        "model": "deepseek-v4.1-flash",
        "messages": [{
            "role": "user",
            "content": [
                {"type": "text", "text": "Describe the image in one sentence."},
                {"type": "image_url", "image_url": {"url": os.environ["IMAGE_URL"]}},
            ],
        }],
        "max_tokens": 1024,
        "chat_template_kwargs": {"thinking": False},
    },
    timeout=300,
)
response.raise_for_status()
print(response.json()["choices"][0]["message"]["content"])
```

```typescript TypeScript theme={"dark"}
const visionResponse = await fetch(`${endpoint}/v1/chat/completions`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.VLLM_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "deepseek-v4.1-flash",
    messages: [{
      role: "user",
      content: [
        { type: "text", text: "Describe the image in one sentence." },
        { type: "image_url", image_url: { url: process.env.IMAGE_URL } },
      ],
    }],
    max_tokens: 1024,
    chat_template_kwargs: { thinking: false },
  }),
});
if (!visionResponse.ok) throw new Error(await visionResponse.text());
console.log((await visionResponse.json()).choices[0].message.content);
```

The self-host encoder maps `low/high/xhigh/max` to `25/50/75/100`; DeepSeek's
hosted API maps its named tiers differently. Use an integer when parity
matters. Thinking defaults on, so a small output cap may be exhausted before
visible content appears.

Acceptance must also send:

* a base64 image and a remote image URL through the OpenAI multimodal message shape;
* multiple images in one prompt;
* a tool call encoded through DeepSeek's tagged markup language (DSML),
  followed by a tool result while preserving prior `reasoning_content`;
* streaming responses in thinking and non-thinking modes;
* invalid tool output to prove the application rejects it safely.

## 6. Qualify load and DSpark

Start with target-only serving:

```bash theme={"dark"}
OPENAI_API_KEY="$VLLM_API_KEY" vllm bench serve \
  --backend openai-chat \
  --base-url "$ENDPOINT" \
  --endpoint /v1/chat/completions \
  --model deepseek-v4.1-flash \
  --dataset-name random \
  --random-input-len 8192 \
  --random-output-len 1024 \
  --request-rate 1 \
  --num-prompts 64
```

Run separate text and vision sweeps. Progress through 4K, 32K, 128K, 384K,
then near-1M contexts while varying concurrency and image count. Capture
p50/p95/p99 TTFT, TPOT, queue time, throughput, errors, OOMs, HBM/host memory,
KV usage, and tool/JSON validity.

Then enable the checkpoint's five-token DSpark block with real rejection.
Never use `rejection_sample_method: synthetic` or a synthetic acceptance
length as production evidence. Compare target-only and DSpark after clean
restarts, and do not combine DSpark with prefill/decode disaggregation until
the engine documents that combination as supported.

> [!WARNING]
>
> AI Reserve raw compute does not supply production replicas, health-aware
> load balancing or a managed load balancer, autoscaling, draining, durable
> workload logs, or customer GPU metrics. Add and test those layers before
> exposing the endpoint to clients. A protected raw port plus one successful
> request is not an industry-standard service.

## 7. Clean up

```bash curl theme={"dark"}
curl -sS -X DELETE "$API/v1/gpu/instances/$INSTANCE_ID" \
  -H "Authorization: Bearer $AIRESERVE_API_KEY" \
  -H "Idempotency-Key: deepseek-v4-1-flash-terminate-v1"
curl -sS -X DELETE "$API/v1/gpu/volumes/$VOLUME_ID" \
  -H "Authorization: Bearer $AIRESERVE_API_KEY" \
  -H "Idempotency-Key: deepseek-v4-1-flash-delete-weights-v1"
```

```python Python theme={"dark"}
for path, key in [
    (f"/v1/gpu/instances/{instance_id}", "deepseek-v4-1-flash-terminate-v1"),
    (f"/v1/gpu/volumes/{volume_id}", "deepseek-v4-1-flash-delete-weights-v1"),
]:
    response = requests.delete(f"{API}{path}", headers={**AUTH, "Idempotency-Key": key}, timeout=60)
    response.raise_for_status()
```

```typescript TypeScript theme={"dark"}
for (const [path, key] of [
  [`/v1/gpu/instances/${instanceId}`, "deepseek-v4-1-flash-terminate-v1"],
  [`/v1/gpu/volumes/${volumeId}`, "deepseek-v4-1-flash-delete-weights-v1"],
] as const) {
  const response = await fetch(`${API}${path}`, {
    method: "DELETE",
    headers: { ...auth, "Idempotency-Key": key },
  });
  if (!response.ok) throw new Error(await response.text());
}
```

## Primary sources

* [DeepSeek V4.1 Flash model card](https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash)
* [Pinned model snapshot](https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash/tree/5254448103b6254fc646dacbca1cbbf20e9216c1)
* [Reference inference guide](https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash/blob/main/inference/README.md)
* [vLLM DeepSeek V4.1 Flash recipe](https://recipes.vllm.ai/deepseek-ai/DeepSeek-V4.1-Flash)
* [SGLang DeepSeek V4.1 cookbook](https://docs.sglang.io/cookbook/autoregressive/DeepSeek/DeepSeek-V4_1)
* [DeepSeek thinking-mode contract](https://api-docs.deepseek.com/guides/thinking_mode)
* [DeepSeek V4.1 Flash license](https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash/blob/main/LICENSE)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.