> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-de/sprachmodelle/vllm.md).

# vLLM

Hochdurchsatz-LLM-Inferenzserver für Produktions-Workloads auf CLORE.AI-GPUs.

{% hint style="success" %}
Alle Beispiele können auf GPU-Servern ausgeführt werden, die über [CLORE.AI Marketplace](https://clore.ai/marketplace).
{% endhint %}

{% hint style="info" %}
**Aktuelle Version: v0.7.x** — Dieser Leitfaden behandelt vLLM v0.7.3+. Zu den neuen Funktionen gehören DeepSeek-R1-Unterstützung, strukturierte Ausgaben mit automatischer Tool-Auswahl, Multi-LoRA-Bereitstellung und verbesserte Speichereffizienz.
{% endhint %}

## Serveranforderungen

| Parameter | Mindest      | Empfohlen |
| --------- | ------------ | --------- |
| RAM       | **16 GB**    | 32 GB+    |
| VRAM      | 16 GB (7B)   | 24 GB+    |
| Netzwerk  | 500 Mbit/s   | 1 Gbit/s+ |
| Startzeit | 5–15 Minuten | -         |

{% hint style="info" %}
Sie brauchen eine passende GPU? Eine [RTX 4090 (24 GB)](https://clore.ai/rent-4090.html?utm_source=docs\&utm_medium=guide\&utm_campaign=vllm) kommt problemlos mit 7B–13B zurecht; für 70B+-Modelle ist eine [H100 (80 GB)](https://clore.ai/rent-h100.html?utm_source=docs\&utm_medium=guide\&utm_campaign=vllm) die sicherste Wahl.
{% endhint %}

{% hint style="danger" %}
**Wichtig:** vLLM benötigt erheblichen RAM und VRAM. Server mit weniger als 16 GB RAM können selbst 7B-Modelle nicht ausführen.
{% endhint %}

{% hint style="warning" %}
**Startzeit:** Beim ersten Start wird das Modell von HuggingFace heruntergeladen (5–15 Minuten je nach Modellgröße und Netzwerkgeschwindigkeit). HTTP 502 in dieser Zeit ist normal.
{% endhint %}

## Warum vLLM?

* **Höchster Durchsatz** - PagedAttention für 24x höheren Durchsatz
* **Produktionsreif** - OpenAI-kompatible API direkt einsatzbereit
* **Kontinuierliches Batching** - Effiziente Bereitstellung für mehrere Nutzer
* **Streaming** - Token-Generierung in Echtzeit
* **Multi-GPU** - Tensor-Parallelismus für große Modelle
* **Multi-LoRA** - Mehrere feinabgestimmte Adapter gleichzeitig bereitstellen (v0.7+)
* **Strukturierte Ausgaben** - JSON-Schema-Durchsetzung und Tool-Aufrufe (v0.7+)

## Schnelle Bereitstellung auf CLORE.AI

**Docker-Image:**

```
vllm/vllm-openai:v0.7.3
```

**Ports:**

```
22/tcp
8000/http
```

**Befehl:**

```bash
vllm serve mistralai/Mistral-7B-Instruct-v0.2 --host 0.0.0.0 --port 8000
```

### Überprüfen, ob es funktioniert

Nach der Bereitstellung finden Sie Ihre `http_pub` URL in **Meine Bestellungen**:

```bash
# Status prüfen (beim ersten Lauf kann es 5–15 Min. dauern)
curl https://your-http-pub.clorecloud.net/health

# Modelle auflisten (funktioniert erst, nachdem das Modell geladen wurde)
curl https://your-http-pub.clorecloud.net/v1/models
```

{% hint style="warning" %}
Wenn Sie länger als 15 Minuten HTTP 502 erhalten, prüfen Sie:

1. Der Server hat 16 GB+ RAM
2. Der Server hat genügend VRAM für das Modell
3. HuggingFace-Token ist für geschützte Modelle gesetzt
   {% endhint %}

## Auf Ihren Dienst zugreifen

Wenn auf CLORE.AI bereitgestellt, greifen Sie über die `http_pub` URL zu:

```bash
# Chat-Vervollständigung
curl https://your-http-pub.clorecloud.net/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistralai/Mistral-7B-Instruct-v0.2",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

{% hint style="info" %}
Alle `localhost:8000` Beispiele unten funktionieren bei Verbindung über SSH. Für externen Zugriff ersetzen Sie dies durch Ihre `https://your-http-pub.clorecloud.net/` URL.
{% endhint %}

## Installation

### Mit Docker (empfohlen)

```bash
docker run -d --gpus all \
    -p 8000:8000 \
    --ipc=host \
    vllm/vllm-openai:v0.7.3 \
    --model mistralai/Mistral-7B-Instruct-v0.2 \
    --host 0.0.0.0
```

### Mit pip

```bash
pip install vllm==0.7.3

# Server starten
python -m vllm.entrypoints.openai.api_server \
    --model mistralai/Mistral-7B-Instruct-v0.2
```

## Unterstützte Modelle

| Modell                        | Parameter | Erforderlicher VRAM   | Erforderlicher RAM |
| ----------------------------- | --------- | --------------------- | ------------------ |
| Mistral 7B                    | 7B        | 14 GB                 | 16 GB+             |
| Llama 3.1 8B                  | 8B        | 16 GB                 | 16 GB+             |
| Llama 3.1 70B                 | 70B       | 140 GB (oder 2x80 GB) | 64 GB+             |
| Mixtral 8x7B                  | 47B       | 90 GB                 | 32 GB+             |
| Qwen2.5 7B                    | 7B        | 14 GB                 | 16 GB+             |
| Qwen2.5 72B                   | 72B       | 145 GB                | 64 GB+             |
| DeepSeek-V3                   | 236B MoE  | Multi-GPU             | 128 GB+            |
| DeepSeek-R1-Distill-Qwen-7B   | 7B        | 14 GB                 | 16 GB+             |
| DeepSeek-R1-Distill-Qwen-32B  | 32B       | 64 GB                 | 32 GB+             |
| DeepSeek-R1-Distill-Llama-70B | 70B       | 140 GB                | 64 GB+             |
| Phi-4                         | 14B       | 28 GB                 | 32 GB+             |
| Gemma 2 9B                    | 9B        | 18 GB                 | 16 GB+             |
| CodeLlama 34B                 | 34B       | 68 GB                 | 32 GB+             |

## Serveroptionen

### Basisserver

```bash
vllm serve mistralai/Mistral-7B-Instruct-v0.2 \
    --host 0.0.0.0 \
    --port 8000
```

### Produktionsserver

```bash
vllm serve mistralai/Mistral-7B-Instruct-v0.2 \
    --host 0.0.0.0 \
    --port 8000 \
    --tensor-parallel-size 1 \
    --max-model-len 8192 \
    --gpu-memory-utilization 0.9 \
    --max-num-seqs 256 \
    --enable-prefix-caching
```

### Mit Quantisierung (weniger VRAM)

```bash
# AWQ-quantisiertes Modell (verwendet weniger VRAM)
vllm serve TheBloke/Mistral-7B-Instruct-v0.2-AWQ \
    --host 0.0.0.0 \
    --quantization awq
```

### Strukturierte Ausgaben und Tool-Aufrufe (v0.7+)

Aktivieren Sie die automatische Tool-Auswahl und strukturierte JSON-Ausgaben:

```bash
vllm serve mistralai/Mistral-7B-Instruct-v0.2 \
    --host 0.0.0.0 \
    --enable-auto-tool-choice \
    --tool-call-parser mistral
```

Verwendung in Python:

```python
from openai import OpenAI
import json

client = OpenAI(base_url="http://localhost:8000/v1", api_key="not-needed")

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Aktuelles Wetter für eine Stadt abrufen",
            "parameters": {
                "type": "object",
                "properties": {
                    "city": {"type": "string", "description": "Stadtname"},
                    "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
                },
                "required": ["city"]
            }
        }
    }
]

response = client.chat.completions.create(
    model="mistralai/Mistral-7B-Instruct-v0.2",
    messages=[{"role": "user", "content": "Wie ist das Wetter in Paris?"}],
    tools=tools,
    tool_choice="auto"
)

# Tool-Aufruf parsen
tool_call = response.choices[0].message.tool_calls[0]
args = json.loads(tool_call.function.arguments)
print(f"Tool: {tool_call.function.name}, Args: {args}")
```

Strukturierte JSON-Ausgabe über das response\_format:

```python
response = client.chat.completions.create(
    model="mistralai/Mistral-7B-Instruct-v0.2",
    messages=[{"role": "user", "content": "Extrahiere: John Smith, 30 Jahre alt, Softwareentwickler"}],
    response_format={
        "type": "json_schema",
        "json_schema": {
            "name": "person",
            "schema": {
                "type": "object",
                "properties": {
                    "name": {"type": "string"},
                    "age": {"type": "integer"},
                    "occupation": {"type": "string"}
                },
                "required": ["name", "age", "occupation"]
            }
        }
    }
)
print(response.choices[0].message.content)
```

### Multi-LoRA-Bereitstellung (v0.7+)

Stellen Sie ein Basismodell gleichzeitig mit mehreren LoRA-Adaptern bereit:

```bash
vllm serve meta-llama/Meta-Llama-3.1-8B-Instruct \
    --host 0.0.0.0 \
    --enable-lora \
    --lora-modules \
        sql-adapter=path/to/sql-lora \
        code-adapter=path/to/code-lora \
        chat-adapter=path/to/chat-lora \
    --max-lora-rank 64
```

Stellen Sie einen bestimmten LoRA-Adapter über den Modellnamen ab:

```python
# SQL-Adapter verwenden
response = client.chat.completions.create(
    model="sql-adapter",
    messages=[{"role": "user", "content": "Schreibe eine SQL-Abfrage, um die Top-10-Kunden zu finden"}]
)

# Code-Adapter verwenden
response = client.chat.completions.create(
    model="code-adapter",
    messages=[{"role": "user", "content": "Schreibe eine Python-Funktion zum Sortieren einer Liste"}]
)
```

## DeepSeek-R1-Unterstützung (v0.7+)

vLLM v0.7+ bietet native Unterstützung für DeepSeek-R1-Distill-Modelle. Diese Reasoning-Modelle erzeugen `<think>` Tags, die ihren Denkprozess zeigen.

### DeepSeek-R1-Distill-Qwen-7B (Einzel-GPU)

```bash
vllm serve deepseek-ai/DeepSeek-R1-Distill-Qwen-7B \
    --host 0.0.0.0 \
    --port 8000 \
    --max-model-len 16384
```

### DeepSeek-R1-Distill-Qwen-32B (Dual-GPU)

```bash
vllm serve deepseek-ai/DeepSeek-R1-Distill-Qwen-32B \
    --host 0.0.0.0 \
    --port 8000 \
    --tensor-parallel-size 2 \
    --max-model-len 32768 \
    --gpu-memory-utilization 0.90
```

### DeepSeek-R1-Distill-Llama-70B (Quad-GPU)

```bash
vllm serve deepseek-ai/DeepSeek-R1-Distill-Llama-70B \
    --host 0.0.0.0 \
    --port 8000 \
    --tensor-parallel-size 4 \
    --max-model-len 32768
```

### DeepSeek-R1 abfragen

```python
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="not-needed")

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
    messages=[
        {
            "role": "user",
            "content": "Löse: Wenn ein Zug 120 km in 1,5 Stunden zurücklegt, wie hoch ist seine Geschwindigkeit in m/s?"
        }
    ],
    max_tokens=2048,
    temperature=0.6
)

content = response.choices[0].message.content
# Antwort enthält einen <think>...</think>-Block mit Begründung, gefolgt von der Antwort
print(content)
```

\<think>-Tags parsen:

```python
import re

def parse_deepseek_r1_response(content: str) -> dict:
    """Begründung und Antwort aus der DeepSeek-R1-Antwort extrahieren."""
    think_match = re.search(r'<think>(.*?)</think>', content, re.DOTALL)
    thinking = think_match.group(1).strip() if think_match else ""
    answer = re.sub(r'<think>.*?</think>', '', content, flags=re.DOTALL).strip()
    return {"thinking": thinking, "answer": answer}

result = parse_deepseek_r1_response(content)
print("Denken:", result["thinking"][:200], "...")
print("Antwort:", result["answer"])
```

## API-Nutzung

### Chat Completions (OpenAI-kompatibel)

```python
from openai import OpenAI

# Für externen Zugriff verwenden Sie Ihre http_pub-URL:
client = OpenAI(
    base_url="https://your-http-pub.clorecloud.net/v1",
    api_key="not-needed"
)

# Oder über SSH-Tunnel:
# client = OpenAI(base_url="http://localhost:8000/v1", api_key="not-needed")

response = client.chat.completions.create(
    model="mistralai/Mistral-7B-Instruct-v0.2",
    messages=[
        {"role": "user", "content": "Erkläre Quantencomputing"}
    ],
    max_tokens=500,
    temperature=0.7
)

print(response.choices[0].message.content)
```

### Streaming

```python
stream = client.chat.completions.create(
    model="mistralai/Mistral-7B-Instruct-v0.2",
    messages=[{"role": "user", "content": "Schreibe ein Gedicht"}],
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")
```

### cURL

```bash
curl https://your-http-pub.clorecloud.net/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistralai/Mistral-7B-Instruct-v0.2",
    "messages": [{"role": "user", "content": "Hello!"}],
    "max_tokens": 100
  }'
```

### Text-Vervollständigungen

```bash
curl https://your-http-pub.clorecloud.net/v1/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistralai/Mistral-7B-Instruct-v0.2",
    "prompt": "Die Hauptstadt von Frankreich ist",
    "max_tokens": 50
  }'
```

## Vollständige API-Referenz

vLLM bietet OpenAI-kompatible Endpunkte sowie zusätzliche Hilfsendpunkte.

### Standardendpunkte

| Endpunkt               | Methode | Beschreibung                          |
| ---------------------- | ------- | ------------------------------------- |
| `/v1/models`           | GET     | Verfügbare Modelle auflisten          |
| `/v1/chat/completions` | POST    | Chat-Vervollständigung                |
| `/v1/completions`      | POST    | Text-Vervollständigung                |
| `/health`              | GET     | Statusprüfung (kann leer zurückgeben) |

### Zusätzliche Endpunkte

| Endpunkt      | Methode | Beschreibung             |
| ------------- | ------- | ------------------------ |
| `/tokenize`   | POST    | Text tokenisieren        |
| `/detokenize` | POST    | Tokens in Text umwandeln |
| `/version`    | GET     | vLLM-Version abrufen     |
| `/docs`       | GET     | Swagger-UI-Dokumentation |
| `/metrics`    | GET     | Prometheus-Metriken      |

#### Text tokenisieren

Nützlich, um Tokens vor dem Senden von Anfragen zu zählen:

```bash
curl https://your-http-pub.clorecloud.net/tokenize \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistralai/Mistral-7B-Instruct-v0.2",
    "prompt": "Hello world"
  }'
```

Antwort:

```json
{"count": 2, "max_model_len": 32768, "tokens": [9707, 1879]}
```

#### Detokenisieren

Token-IDs wieder in Text umwandeln:

```bash
curl https://your-http-pub.clorecloud.net/detokenize \
  -H "Content-Type: application/json" \
  -d '{
    "model": "mistralai/Mistral-7B-Instruct-v0.2",
    "tokens": [9707, 1879]
  }'
```

Antwort:

```json
{"prompt": "Hello world"}
```

#### Version abrufen

```bash
curl https://your-http-pub.clorecloud.net/version
```

Antwort:

```json
{"version": "0.7.3"}
```

#### Swagger-Dokumentation

Im Browser öffnen für interaktive API-Dokumentation:

```
https://your-http-pub.clorecloud.net/docs
```

#### Prometheus-Metriken

Für Monitoring:

```bash
curl https://your-http-pub.clorecloud.net/metrics
```

{% hint style="info" %}
**Reasoning-Modelle:** DeepSeek-R1 und ähnliche Modelle enthalten `<think>` Tags in Antworten, die den Denkprozess des Modells vor der endgültigen Antwort anzeigen.
{% endhint %}

## Benchmarks

### Durchsatz (Tokens/Sek. pro Benutzer)

| Modell             | RTX 3090 | RTX 4090 | A100 40 GB | A100 80 GB |
| ------------------ | -------- | -------- | ---------- | ---------- |
| Mistral 7B         | 100      | 170      | 210        | 230        |
| Llama 3.1 8B       | 95       | 150      | 200        | 220        |
| Llama 3.1 8B (AWQ) | 130      | 190      | 260        | 280        |
| Mixtral 8x7B       | -        | 45       | 70         | 85         |
| Llama 3.1 70B      | -        | -        | 25 (2x)    | 45 (2x)    |
| DeepSeek-R1 7B     | 90       | 145      | 190        | 210        |
| DeepSeek-R1 32B    | -        | -        | 40         | 70 (2x)    |

*Benchmarks aktualisiert im Januar 2026.*

### Kontextlänge vs. VRAM

| Modell   | 4K Kontext | 8K Kontext | 16K Kontext | 32K Kontext |
| -------- | ---------- | ---------- | ----------- | ----------- |
| 8B FP16  | 18 GB      | 22 GB      | 30 GB       | 46 GB       |
| 8B AWQ   | 8 GB       | 10 GB      | 14 GB       | 22 GB       |
| 70B FP16 | 145 GB     | 160 GB     | 190 GB      | 250 GB      |
| 70B AWQ  | 42 GB      | 50 GB      | 66 GB       | 98 GB       |

## Hugging-Face-Authentifizierung

Für geschützte Modelle (Llama usw.):

```bash
# Token im Befehl setzen
vllm serve meta-llama/Meta-Llama-3.1-8B-Instruct \
    --host 0.0.0.0 \
    --env HUGGING_FACE_HUB_TOKEN=hf_xxxxx
```

Oder als Umgebungsvariable setzen:

```bash
export HUGGING_FACE_HUB_TOKEN=hf_xxxxx
```

## GPU-Anforderungen

| Modell | Min. VRAM | Min. RAM  | Empfohlen             |
| ------ | --------- | --------- | --------------------- |
| 7–8B   | 16 GB     | **16 GB** | 24 GB VRAM, 32 GB RAM |
| 13B    | 26 GB     | 32 GB     | 40 GB VRAM            |
| 34B    | 70GB      | 32 GB     | 80 GB VRAM            |
| 70B    | 140 GB    | 64 GB     | 2x80 GB               |

## Kostenschätzung

Typische Tarife im CLORE.AI Marketplace:

| GPU      | VRAM  | Preis/Tag   | Am besten für  |
| -------- | ----- | ----------- | -------------- |
| RTX 3090 | 24 GB | 0,30–1,00 $ | 7–8B-Modelle   |
| RTX 4090 | 24 GB | 0,50–2,00 $ | 7–13B, schnell |
| A100     | 40 GB | 1,50–3,00 $ | 13–34B-Modelle |
| A100     | 80 GB | 2,00–4,00 $ | 34–70B-Modelle |

*Preise in USD/Tag. Die Tarife variieren je nach Anbieter — prüfen Sie* [*CLORE.AI Marketplace*](https://clore.ai/marketplace) *die aktuellen Tarife.*

## Fehlerbehebung

### Längere Zeit HTTP 502

1. **RAM prüfen:** Der Server muss 16 GB+ RAM haben
2. **VRAM prüfen:** Das Modell muss hineinpassen
3. **Modell wird heruntergeladen:** Der erste Lauf lädt von HuggingFace herunter (5–15 Min.)
4. **HF-Token:** Geschützte Modelle erfordern Authentifizierung

### Speicher voll

```bash
# Speichernutzung reduzieren
--gpu-memory-utilization 0.8
--max-model-len 4096
--max-num-seqs 64

# Oder Quantisierung verwenden
--quantization awq
```

### Modell-Download schlägt fehl

```bash
# HF-Token prüfen
echo $HUGGING_FACE_HUB_TOKEN

# Modell vorab herunterladen
huggingface-cli download mistralai/Mistral-7B-Instruct-v0.2
```

## vLLM vs. andere

| Funktion               | vLLM       | llama.cpp     | Ollama        |
| ---------------------- | ---------- | ------------- | ------------- |
| Durchsatz              | Am besten  | Gut           | Gut           |
| VRAM-Nutzung           | Hoch       | Niedrig       | Mittel        |
| Benutzerfreundlichkeit | Mittel     | Mittel        | Einfach       |
| Startzeit              | 5–15 Min.  | 1–2 Min.      | 30 Sek.       |
| Multi-GPU              | Nativ      | Eingeschränkt | Eingeschränkt |
| Tool-Aufruf            | Ja (v0.7+) | Eingeschränkt | Eingeschränkt |
| Multi-LoRA             | Ja (v0.7+) | Nein          | Nein          |

**Verwende vLLM, wenn:**

* Hoher Durchsatz hat Priorität
* Mehrere Benutzer bedienen
* Genügend VRAM und RAM vorhanden sind
* Produktionsbereitstellung
* Tool-Aufruf / strukturierte Ausgaben benötigt werden

**Verwende Ollama, wenn:**

* Schnelles Setup benötigt wird
* Einzelbenutzer
* Weniger Ressourcen verfügbar sind

## Nächste Schritte

* [Ollama](/guides/guides_v2-de/sprachmodelle/ollama.md) - Einfachere Alternative mit schnellerem Start
* [DeepSeek-R1](/guides/guides_v2-de/sprachmodelle/deepseek-r1.md) - Leitfaden für das Reasoning-Modell
* [DeepSeek-V3](/guides/guides_v2-de/sprachmodelle/deepseek-v3.md) - Bestes Allzweckmodell
* [Qwen2.5](/guides/guides_v2-de/sprachmodelle/qwen25.md) - Mehrsprachige Modelle
* [Llama.cpp](/guides/guides_v2-de/sprachmodelle/llamacpp-server.md) - Option mit geringerem VRAM


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-de/sprachmodelle/vllm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
