> 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/ki-plattformen-and-agenten/jan.md).

# Jan.ai Offline-Assistent

Deploye Jan.ai Server auf Clore.ai — ein vollständig offlinefähiger, mit OpenAI kompatibler LLM-Server mit Modell-Hub, Gesprächsverwaltung und GPU-beschleunigter Inferenz, unterstützt durch die Cortex-Engine.

## Überblick

[Jan.ai](https://github.com/janhq/jan) ist eine Open-Source-ChatGPT-Alternative mit Fokus auf Datenschutz und über 40.000 GitHub-Sternen. Während Jan am bekanntesten als Desktop-Anwendung ist, ist seine Server-Komponente — **Jan Server** — stellt eine vollständig OpenAI-kompatible REST-API bereit, die auf Cloud-GPU-Infrastruktur wie Clore.ai bereitgestellt werden kann.

Jan Server basiert auf der [Cortex.cpp](https://github.com/janhq/cortex.cpp) Inference-Engine, einer Hochleistungs-Laufzeitumgebung, die `llama.cpp`, `TensorRT-LLM`, und ONNX-Backends unterstützt. Auf Clore.ai kannst du einen GPU-Server schon ab **$0.20/Stunde**, Jan Server mit Docker Compose ausführen, jedes GGUF- oder GPTQ-Modell laden und es über eine OpenAI-kompatible API bereitstellen — alles, ohne dass deine Daten das Gerät verlassen.

**Wichtige Funktionen:**

* 🔒 100% offline — keine Daten verlassen jemals deinen Server
* 🤖 OpenAI-kompatible API (`/v1/chat/completions`, `/v1/models`, usw.)
* 📦 Modell-Hub mit Modell-Downloads per Ein-Kommando
* 🚀 GPU-Beschleunigung via CUDA (llama.cpp + TensorRT-LLM-Backends)
* 💬 Integriertes Konversationsmanagement und Thread-Verlauf
* 🔌 Drop-in-Ersatz für OpenAI in bestehenden Anwendungen

***

## Anforderungen

{% hint style="warning" %}
**Multi-GPU-Rigs der 80GB-Klasse sind auf dem Clore.ai-Marktplatz nicht gelistet.** Die größten heute gelisteten Systeme sind 4× RTX PRO 6000 Blackwell (je 96 GB, 380 GB gesamt) und 8–11× RTX 5090 (je 32 GB). Kapazitäten für A100 / H200 / B200 werden als [Bare Metal](https://clore.ai/bare-metal) auf Anfrage verkauft. Prüfe [GPU-Preise & Verfügbarkeit](/guides/guides_v2-de/erste-schritte/pricing.md) bevor du eine Bereitstellung dimensionierst.
{% endhint %}

### Hardware-Anforderungen

| Stufe             | GPU            | VRAM  | RAM    | Speicher   | Clore.ai-Preis                            |
| ----------------- | -------------- | ----- | ------ | ---------- | ----------------------------------------- |
| **Minimum**       | RTX 3060 12 GB | 12 GB | 16 GB  | 50 GB SSD  | 0,03–0,07 $/Std.                          |
| **Empfohlen**     | RTX 3090       | 24 GB | 32 GB  | 100 GB SSD | ca. 0,07–0,21 $/h                         |
| **High-End**      | RTX 4090       | 24 GB | 64 GB  | 200 GB SSD | ca. 0,14–0,42 $/h                         |
| **Große Modelle** | A100 80GB      | 80 GB | 128 GB | 500 GB SSD | [Bare Metal](https://clore.ai/bare-metal) |

### VRAM-Referenz für Modelle

| Modell              | Erforderlicher VRAM | Empfohlene GPU |
| ------------------- | ------------------- | -------------- |
| Llama 3.1 8B (Q4)   | \~5 GB              | RTX 3060       |
| Llama 3.1 8B (FP16) | \~16 GB             | RTX 3090       |
| Llama 3.3 70B (Q4)  | \~40 GB             | A100 40GB      |
| Llama 3.1 405B (Q4) | \~220 GB            | 4× A100 80GB   |
| Mistral 7B (Q4)     | \~4 GB              | RTX 3060       |
| Qwen2.5 72B (Q4)    | \~45 GB             | A100 80GB      |

### Softwarevoraussetzungen

* Clore.ai-Konto mit aufgeladenem Guthaben
* Grundkenntnisse in Docker
* (Optional) OpenSSH-Client für Portweiterleitung

***

## Schnellstart

### Schritt 1 — Mieten Sie einen GPU-Server auf Clore.ai

1. Navigiere zu [clore.ai](https://clore.ai) und melde dich an
2. Server filtern: **GPU-Typ** → RTX 3090 oder besser, **Docker** → aktiviert
3. Wähle einen Server und wähle die **Docker** Bereitstellungsoption
4. Verwende das offizielle `nvidia/cuda:12.8.1-devel-ubuntu22.04` Basis-Image oder ein beliebiges CUDA-Image
5. Ports öffnen: **1337** (Jan Server API), **39281** (Cortex API), **22** (SSH)

### Schritt 2 — Mit deinem Server verbinden

```bash
# Per SSH mit deinem Clore.ai-Server verbinden
ssh -p <CLORE_SSH_PORT> root@<CLORE_SERVER_IP>

# Prüfen, ob die GPU verfügbar ist
nvidia-smi
```

### Schritt 3 — Docker Compose installieren (falls nicht vorhanden)

```bash
# Prüfen, ob Docker Compose verfügbar ist
docker compose version

# Installieren, falls fehlt (Ubuntu/Debian)
apt-get update && apt-get install -y docker-compose-plugin

# Prüfen
docker compose version
```

### Schritt 4 — Jan Server mit Docker Compose bereitstellen

```bash
# Arbeitsverzeichnis erstellen
mkdir -p /workspace/jan-server && cd /workspace/jan-server

# Die offizielle Jan-Server-docker-compose.yml herunterladen
curl -fsSL https://raw.githubusercontent.com/janhq/jan-server/main/docker-compose.yml \
  -o docker-compose.yml

# Konfiguration überprüfen und bearbeiten
cat docker-compose.yml
```

Wenn die Upstream-Compose-Datei nicht verfügbar ist oder du volle Kontrolle möchtest, erstelle sie manuell:

```yaml
# /workspace/jan-server/docker-compose.yml
version: '3.8'

services:
  jan-server:
    image: ghcr.io/janhq/cortex:latest
    container_name: jan-server
    restart: unless-stopped
    ports:
      - "1337:1337"
      - "39281:39281"
    volumes:
      - jan-data:/root/jan
      - jan-models:/root/cortex/models
    environment:
      - CUDA_VISIBLE_DEVICES=0
      - JAN_API_HOST=0.0.0.0
      - JAN_API_PORT=1337
      - CORTEX_API_PORT=39281
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:1337/health"]
      interval: 30s
      timeout: 10s
      retries: 5
      start_period: 60s

volumes:
  jan-data:
    driver: local
  jan-models:
    driver: local
```

```bash
# Jan Server starten
docker compose up -d

# Startprotokoll verfolgen (auf die Meldung "Server started" warten)
docker compose logs -f jan-server
```

### Schritt 5 — Prüfen, ob der Server läuft

```bash
# Serverzustand überprüfen
curl http://localhost:1337/health

# Verfügbare Modelle auflisten (anfangs leer)
curl http://localhost:1337/v1/models

# Erwartete Antwort:
# {"object":"list","data":[]}
```

### Schritt 6 — Lade dein erstes Modell

```bash
# Llama 3.2 3B laden (guter Einstieg, ~2 GB)
curl -X POST http://localhost:1337/v1/models/pull \
  -H "Content-Type: application/json" \\
  -d '{"model": "llama3.2:3b-gguf-q4-km"}'

# Oder Mistral 7B Instruct Q4 laden
curl -X POST http://localhost:1337/v1/models/pull \
  -H "Content-Type: application/json" \\
  -d '{"model": "mistral:7b-instruct-v0.3-gguf-q4-km"}'

# Download-Fortschritt überwachen
curl http://localhost:1337/v1/models
```

### Schritt 7 — Modell starten und chatten

```bash
# Modell starten (lädt es in den GPU-VRAM)
curl -X POST http://localhost:1337/v1/models/start \
  -H "Content-Type: application/json" \\
  -d '{"model": "llama3.2:3b-gguf-q4-km"}'

# Deine erste Chat-Anfrage senden
curl http://localhost:1337/v1/chat/completions \
  -H "Content-Type: application/json" \\
  -d '{
    "model": "llama3.2:3b-gguf-q4-km",
    "messages": [
      {"role": "system", "content": "Du bist ein hilfreicher Assistent."},
      {"role": "user", "content": "Hallo! Wobei kannst du mir helfen?"}
    ],
    "temperature": 0.7,
    "max_tokens": 512,
    "stream": false
  }'
```

***

## Konfiguration

### Umgebungsvariablen

| Variable               | Standard              | Beschreibung                                                           |
| ---------------------- | --------------------- | ---------------------------------------------------------------------- |
| `JAN_API_HOST`         | `0.0.0.0`             | Host, an den der API-Server gebunden wird                              |
| `JAN_API_PORT`         | `1337`                | Jan-Server-API-Port                                                    |
| `CORTEX_API_PORT`      | `39281`               | Interner Cortex-Engine-Port                                            |
| `CUDA_VISIBLE_DEVICES` | `all`                 | Welche GPUs freigegeben werden sollen (durch Kommas getrennte Indizes) |
| `JAN_DATA_FOLDER`      | `/root/jan`           | Pfad zum Jan-Datenordner                                               |
| `CORTEX_MODELS_PATH`   | `/root/cortex/models` | Pfad zum Modellspeicher                                                |

### Multi-GPU-Konfiguration

Für Server mit mehreren GPUs (z. B. 2× RTX 3090 auf Clore.ai):

```yaml
environment:
  - CUDA_VISIBLE_DEVICES=0,1  # Beide GPUs verwenden
```

Oder um bestimmte GPUs zu reservieren:

```bash
# Jan Server nur auf GPU 0 ausführen
docker run -d \
  --name jan-server \\
  --gpus '"device=0"' \\
  -p 1337:1337 \\
  -v jan-data:/root/jan \\
  -v jan-models:/root/cortex/models \\
  ghcr.io/janhq/cortex:latest
```

### Benutzerdefinierte Modellkonfiguration

```bash
# Alle geladenen Modelle auflisten
curl http://localhost:1337/v1/models | jq '.data[].id'

# Modelldetails abrufen
curl http://localhost:1337/v1/models/llama3.2:3b-gguf-q4-km

# Ein laufendes Modell stoppen (VRAM freigeben)
curl -X POST http://localhost:1337/v1/models/stop \\
  -H "Content-Type: application/json" \\
  -d '{"model": "llama3.2:3b-gguf-q4-km"}'

# Ein Modell löschen (Speicherplatz freigeben)
curl -X DELETE http://localhost:1337/v1/models/llama3.2:3b-gguf-q4-km
```

### Die API mit einem Token absichern

Jan Server enthält standardmäßig keine Authentifizierung. Verwende Nginx als Reverse Proxy:

```bash
apt-get install -y nginx apache2-utils

# Passwortdatei erstellen
htpasswd -c /etc/nginx/.htpasswd admin

# Nginx konfigurieren
cat > /etc/nginx/sites-available/jan-server << 'EOF'
server {
    listen 80;
    server_name _;

    location / {
        auth_basic "Jan Server";
        auth_basic_user_file /etc/nginx/.htpasswd;
        proxy_pass http://127.0.0.1:1337;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_read_timeout 300s;
    }
}
EOF

ln -s /etc/nginx/sites-available/jan-server /etc/nginx/sites-enabled/
nginx -t && systemctl restart nginx
```

***

## GPU-Beschleunigung

### CUDA-Beschleunigung überprüfen

Die Cortex-Engine von Jan Server erkennt CUDA automatisch. Prüfe, ob sie die GPU verwendet:

```bash
# GPU-Speichernutzung nach dem Laden eines Modells prüfen
nvidia-smi

# Sollte zeigen, dass der Cortex-Prozess VRAM nutzt
# Beispielausgabe:
# | Processes:                                                            |
# |  GPU   GI   CI        PID   Type   Process name            GPU Memory |
# |    0    N/A  N/A    12345    C   /usr/local/bin/cortex    8192MiB |
```

### Inference-Backends wechseln

Cortex unterstützt mehrere Backends:

```bash
# Prüfen, welche Backends im Container verfügbar sind
docker exec jan-server cortex engines list

# TensorRT-LLM-Backend für NVIDIA-GPUs verwenden (schneller, erfordert mehr Einrichtung)
docker exec jan-server cortex engines install tensorrt-llm

# llama.cpp-Backend verwenden (Standard, am kompatibelsten)
docker exec jan-server cortex engines install llama-cpp
```

### Kontextfenster- und Batchgrößen-Tuning

```bash
# Modellparameter für GPU-Performance anpassen
curl -X POST http://localhost:1337/v1/models/start \
  -H "Content-Type: application/json" \\
  -d '{
    "model": "llama3.2:3b-gguf-q4-km",
    "ctx_len": 8192,
    "ngl": 99,
    "n_batch": 512,
    "n_parallel": 4,
    "cpu_threads": 8
  }'
```

| Parameter    | Beschreibung                           | Empfehlung                                 |
| ------------ | -------------------------------------- | ------------------------------------------ |
| `ngl`        | GPU-Layer (höher = mehr GPU-Nutzung)   | Setze auf `99` um die GPU voll auszunutzen |
| `ctx_len`    | Größe des Kontextfensters              | 4096–32768 je nach VRAM                    |
| `n_batch`    | Batchgröße für die Prompt-Verarbeitung | 512 für RTX 3090, 256 für kleinere         |
| `n_parallel` | Gleichzeitige Anfrage-Slots            | 4–8 für den Einsatz als API-Server         |

***

## Tipps & bewährte Praktiken

### 🎯 Modellauswahl für Clore.ai-Budgets

```bash
# Budget-Stufe ($0.03–0.07/Stunde, RTX 3060 12GB):
# Q4_K_M-Quantisierungen von 7B-Modellen verwenden
curl -X POST http://localhost:1337/v1/models/pull \
  -d '{"model": "mistral:7b-instruct-v0.3-gguf-q4-km"}'

# Standard-Stufe ($0.07–0.21/Stunde, RTX 3090 24GB):
# Q5_K_M-Quantisierungen von 13B-Modellen oder Q4 von 30B-Modellen verwenden
curl -X POST http://localhost:1337/v1/models/pull \
  -d '{"model": "llama3.1:8b-instruct-gguf-q5-km"}'

# High-End-Stufe ([Bare Metal](https://clore.ai/bare-metal), A100 80GB):
# Vollständige 70B-Modelle in hoher Präzision ausführen
curl -X POST http://localhost:1337/v1/models/pull \
  -d '{"model": "llama3.3:70b-instruct-gguf-q4-km"}'
```

### 💾 Persistenter Modellspeicher

Da Clore.ai-Instanzen flüchtig sind, solltest du externen Speicher einbinden:

```bash
# Ein benanntes Volume verwenden (bleibt mit Docker erhalten)
docker compose down
# Modelle bleiben im benannten Volume 'jan-models' erhalten

# Für wirklich persistenten Speicher über Instanzen hinweg,
# Modelle in Object Storage hochladen und beim Start laden:
cat > /workspace/startup.sh << 'EOF'
#!/bin/bash
docker compose up -d
sleep 30
# Häufig verwendete Modelle vorab laden
curl -X POST http://localhost:1337/v1/models/pull \
  -H "Content-Type: application/json" \\
  -d '{"model": "mistral:7b-instruct-v0.3-gguf-q4-km"}'
EOF
chmod +x /workspace/startup.sh
```

### 🔗 Jan Server als OpenAI-Drop-in verwenden

```python
# Python — vorhandene OpenAI-Clientbibliotheken verwenden
from openai import OpenAI

client = OpenAI(
    base_url="http://<CLORE_IP>:1337/v1",
    api_key="not-required"  # Jan Server hat standardmäßig keine Authentifizierung
)

response = client.chat.completions.create(
    model="llama3.2:3b-gguf-q4-km",
    messages=[{"role": "user", "content": "Explain quantum computing"}],
    temperature=0.7
)
print(response.choices[0].message.content)
```

```bash
# Streaming-Unterstützung
curl http://localhost:1337/v1/chat/completions \
  -H "Content-Type: application/json" \\
  -d '{
    "model": "llama3.2:3b-gguf-q4-km",
    "messages": [{"role": "user", "content": "Write a haiku about GPUs"}],
    "stream": true
  }'
```

### 📊 Ressourcenverbrauch überwachen

```bash
# GPU-Auslastung in Echtzeit beobachten
watch -n 1 nvidia-smi

# Ressourcenverbrauch des Containers prüfen
docker stats jan-server

# Detaillierte Logs anzeigen
docker compose logs --tail=100 jan-server

# Modell-Ladezeiten prüfen
docker compose logs jan-server | grep -E "(loaded|started|error)"
```

***

## Fehlerbehebung

### Container startet nicht — GPU nicht gefunden

```bash
# Prüfen, ob die NVIDIA-Docker-Runtime konfiguriert ist
docker info | grep -i nvidia

# GPU-Zugriff direkt testen
docker run --rm --gpus all nvidia/cuda:12.8.1-base-ubuntu22.04 nvidia-smi

# Wenn dies fehlschlägt, Docker-Daemon-Konfiguration prüfen
cat /etc/docker/daemon.json
# Sollte enthalten: {"runtimes": {"nvidia": {...}}}
```

### Modell-Download hängt oder schlägt fehl

```bash
# Speicherplatz prüfen
df -h /root

# Container-Logs auf Fehler prüfen
docker compose logs jan-server | tail -50

# Den Download erneut versuchen
curl -X POST http://localhost:1337/v1/models/pull \
  -H "Content-Type: application/json" \\
  -d '{"model": "mistral:7b-instruct-v0.3-gguf-q4-km"}'
```

### Kein VRAM mehr (CUDA out of memory)

```bash
# Aktuelle VRAM-Nutzung prüfen
nvidia-smi --query-gpu=memory.used,memory.free --format=csv

# Zuerst alle laufenden Modelle stoppen
curl http://localhost:1337/v1/models | jq -r '.data[].id' | while read model; do
  curl -X POST http://localhost:1337/v1/models/stop \\
    -H "Content-Type: application/json" \\
    -d "{\"model\": \"$model\"}"
done

# Ein stärker quantisiertes Modell verwenden (Q3 oder Q4 statt Q8)
# Q4_K_M verwendet typischerweise etwa 50 % des VRAM-Bedarfs von Q8
```

### Keine Verbindung zur API von außerhalb des Containers möglich

```bash
# Sicherstellen, dass Port 1337 an alle Schnittstellen gebunden ist
docker ps --format "table {{.Names}}\t{{.Ports}}"
# Sollte anzeigen: 0.0.0.0:1337->1337/tcp

# Clore.ai-Firewallregeln prüfen — Port 1337 in den Servereinstellungen öffnen
# Zuerst lokal testen:
curl http://127.0.0.1:1337/health

# Dann von außen testen:
curl http://<CLORE_SERVER_IP>:<MAPPED_PORT>/health
```

### Langsame Inferenz (CPU-Fallback)

```bash
# Bestätigen, dass CUDA verwendet wird (nicht die CPU)
docker exec jan-server cortex ps
# Sollte zugewiesenen GPU-Speicher anzeigen

# GPU-Layer beim Modellstart erzwingen
curl -X POST http://localhost:1337/v1/models/start \
  -H "Content-Type: application/json" \\
  -d '{"model": "mistral:7b-instruct-v0.3-gguf-q4-km", "ngl": 99}'
```

***

## Weiterführende Lektüre

* [Offizielle Jan.ai-Dokumentation](https://jan.ai/docs) — Vollständige Plattformdokumentation
* [Jan-GitHub-Repository](https://github.com/janhq/jan) — Quellcode und Issues
* [Jan Server / Jan API](https://github.com/janhq/jan-server) — Server-spezifische Dokumentation
* [Cortex.cpp-Engine](https://github.com/janhq/cortex.cpp) — Die zugrunde liegende Inferenz-Engine
* [Clore.ai-Einstieg](/guides/guides_v2-de/erste-schritte/getting-started.md) — Grundlagen der Plattform
* [GPU-Vergleichsleitfaden](/guides/guides_v2-de/erste-schritte/gpu-comparison.md) — Die richtige GPU auswählen
* [Ollama auf Clore.ai ausführen](/guides/guides_v2-de/sprachmodelle/ollama.md) — Alternativer LLM-Server
* [vLLM auf Clore.ai ausführen](/guides/guides_v2-de/sprachmodelle/vllm.md) — Inferenzserver mit hohem Durchsatz
* [Hugging Face Model Hub](https://huggingface.co/models?library=gguf) — GGUF-Modelle finden

> 💡 **Kostentipp:** Eine RTX 3090 auf Clore.ai ($0.07–0.21/Stunde) kann Llama 3.1 8B ausführen mit **\~50 Tokens/Sekunde** — genug für den persönlichen Gebrauch oder APIs mit wenig Traffic. Für Produktions-Workloads solltest du vLLM in Betracht ziehen (siehe [vLLM-Anleitung](/guides/guides_v2-de/sprachmodelle/vllm.md))


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-de/ki-plattformen-and-agenten/jan.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
