> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/de/integrationen/connections/llama.cpp-mit-unsloth-verbinden-ggufs-mit-llama-server-ausfuhren.md).

# llama.cpp mit Unsloth verbinden: GGUFs mit llama-server ausführen

Llama.cpp ist eine Open-Source-Inferenz-Engine, mit der GGUF-Modelle effizient auf lokaler Hardware ausgeführt werden, und [Unsloth](https://github.com/unslothai/unsloth) macht es einfach, diese Modelle direkt in einer Open-Source-UI-Chat-Oberfläche auszuführen. Durch das Starten eines lokalen `llama-server`, können Sie ein GGUF-Modell von Ihrem Rechner oder Hugging Face bereitstellen, es mit Unsloth verbinden und es wie jedes andere externe Chat-Modell verwenden.

Diese Anleitung führt durch die Installation von llama.cpp und das Starten `llama-server`, die Verbindung mit Unsloth, das Aktivieren Ihres Modells und das Konfigurieren von Prompt-Caching, Kontextlänge, API-Schlüsseln, FA und Chat-Vorlagen.

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FhoLxJoFPUmjxslMPot7h%2Fexport-1779046578662.gif?alt=media&amp;token=83b946dd-d8e1-4630-a143-b7b0e4d052a4" alt=""><figcaption></figcaption></figure>

## Einrichtung

{% stepper %}
{% step %}

### llama.cpp installieren

Installieren Sie zuerst llama.cpp, damit Sie das `llama-server` Befehl zu verbinden.

Verwenden Sie eine der offiziellen Installationsoptionen:

* Laden Sie ein vorgefertigtes [llama.cpp-Binary](https://github.com/ggml-org/llama.cpp/releases)
* llama.cpp aus [source](https://github.com/ggml-org/llama.cpp/blob/master/docs/build.md)

Prüfen Sie nach der Installation, ob llama-server in Ihrem Terminal funktioniert:

`llama-server --help`
{% endstep %}

{% step %}

### Wählen Sie ein GGUF-Modell

llama-server kann eine lokale .gguf-Datei laden oder ein GGUF-Modell von Hugging Face herunterladen.

Um ein Hugging-Face-GGUF-Repository direkt bereitzustellen, verwenden Sie den Repo- und Quant-Namen:

`llama-server -hf unsloth/Qwen3.6-27B-GGUF:UD-Q4_K_XL`

Wenn Sie ein lokales Modell laden möchten, können Sie auch die folgenden Schritte befolgen.&#x20;

Starten `llama-server` mit dem Modell, das Sie bereitstellen möchten:

```bash
llama-server \\
  --model /path/to/model.gguf \
  --host 0.0.0.0 \
  --port 8080
```

Dies stellt einen API-Endpunkt bereit unter: `http://localhost:8080/v1`

Um einen API-Schlüssel zu verlangen, fügen Sie hinzu:

```bash
--api-key 1234-myapi-key
```

{% endstep %}

{% step %}

### Verbinden Sie Llama.cpp mit Unsloth

Öffnen **Einstellungen → Verbindungen**, dann klicken Sie auf **Verbindung hinzufügen**. Wählen Sie **llama.cpp**, und geben Sie dann Ihre Serverdetails ein:

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FU9TcWUfyBHEDWs91g8jx%2Fimage.png?alt=media&amp;token=2a7a974a-9e2e-4bac-96f4-09e55e1767b9" alt="" width="563"><figcaption></figcaption></figure>

wenn Sie llama-server nicht mit `--api-key`, lassen Sie das Feld für den API-Schlüssel leer. Geben Sie die Basis-URL Ihres Servers ein, z. B. `http://localhost:8080/v1`\
Klicken Sie **Modelle laden** um verfügbare Modell-IDs abzurufen, oder geben Sie Modell-IDs manuell ein, wenn Ihr Server `/models`.

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FXBMWShY6KWmxRJLwmieH%2Fimage.png?alt=media&amp;token=1809ec26-84c6-4c61-b6a5-6dfa5bed769c" alt="" width="563"><figcaption></figcaption></figure>

Dann, nachdem Sie auf **Verbindung hinzufügen,** Die von Ihnen aktivierten Modelle erscheinen nun unter **Verbunden** im **Modell auswählen** Dropdown-Menü.
{% endstep %}

{% step %}

### Bereit zum Chatten&#x20;

Nachdem Sie die Verbindung gespeichert haben, wird Ihr llama.cpp-Modell unter **Verbindung** im Modell-Dropdown angezeigt. Wählen Sie es aus, um darüber zu chatten **llama-server**.

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FhoLxJoFPUmjxslMPot7h%2Fexport-1779046578662.gif?alt=media&amp;token=83b946dd-d8e1-4630-a143-b7b0e4d052a4" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

### Prompt-Caching

Prompt-Caching reduziert Latenz und Kosten, wenn Anfragen denselben langen Präfix wiederverwenden. Verwenden Sie die **Prompt-Caching** Einstellung in der Unsloth-Seitenleiste, um das Caching-Verhalten für unterstützte Verbindungen zu steuern.

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fq4csmTX5rS9isMkNkhTX%2FPrompt%20Caching%20Diagram%20(1).png?alt=media&amp;token=ade433bf-5eaf-4146-a266-525a85a6c98d" alt="" width="375"><figcaption></figcaption></figure>

Bei llama.cpp ist Prompt-Caching standardmäßig aktiviert und kann beim Starten deaktiviert werden\
`llama-server` mit:

```bash
--no-cache-prompt
```

### **Häufige llama-server-Argumente**

Das obige Beispiel verwendet nur die erforderlichen Verbindungseinstellungen. Sie können je nach Modell und Hardware weitere llama-server-Argumente hinzufügen.

Zu den häufigen Optionen gehören:

```bash
  --ctx-size 8192 \        # Legt die Kontextlänge fest
  --parallel 2 \           # Legt die Anzahl paralleler Slots fest
  --flash-attn on \        # Aktiviert Flash Attention, wenn unterstützt
  --jinja \                # Verwendet die Chat-Vorlage des Modells
  --api-key 1234-key \     # Erfordert einen API-Schlüssel
  --no-cache-prompt        # Deaktiviert Prompt-Caching
```

Die vollständige Liste der Server-Argumente finden Sie in der offiziellen [README des llama.cpp-Servers](https://github.com/ggml-org/llama.cpp/blob/master/tools/server/README.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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://unsloth.ai/docs/de/integrationen/connections/llama.cpp-mit-unsloth-verbinden-ggufs-mit-llama-server-ausfuhren.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
