This is the full developer documentation for KoboldCpp
# Documentation
> Guides and reference for KoboldCpp: download and install, models and hardware, launcher settings, features, the API and troubleshooting.
KoboldCpp runs AI models on your own computer. This community wiki has the details. New to it? The [beginner guide](https://koboldcpp.net/getting-started/) takes you from download to your first chat in four steps. The project also has its own [KoboldCpp wiki on GitHub](https://github.com/LostRuins/koboldcpp/wiki).
[Click here for online KoboldCpp API documentation](https://lite.koboldai.net/koboldcpp_api)
## Download and install
Every release file and what it needs: [Release files and system requirements](https://koboldcpp.net/docs/install/releases/). Step by step for [Windows](https://koboldcpp.net/docs/install/windows/), [Linux](https://koboldcpp.net/docs/install/linux/), [macOS](https://koboldcpp.net/docs/install/macos/), [Android](https://koboldcpp.net/docs/install/android/), and [Colab and Docker](https://koboldcpp.net/docs/install/colab-docker/). Also: [Updating](https://koboldcpp.net/docs/install/updating/), [Build from source](https://koboldcpp.net/docs/install/from-source/) and [Staying safe](https://koboldcpp.net/docs/install/staying-safe/).
## Models and hardware
* Models: [GGUF and quantization](https://koboldcpp.net/docs/models/gguf-and-quantization/), [Where to get models](https://koboldcpp.net/docs/models/where-to-get-models/), [How much memory a model needs](https://koboldcpp.net/docs/models/memory/).
* Hardware: [GPU backends](https://koboldcpp.net/docs/hardware/backends/), [GPU layers](https://koboldcpp.net/docs/hardware/gpu-layers/), [Multiple GPUs](https://koboldcpp.net/docs/hardware/multi-gpu/), [Saving VRAM](https://koboldcpp.net/docs/hardware/saving-vram/), [Old PCs and CPU-only](https://koboldcpp.net/docs/hardware/old-and-cpu-only/), [Apple Silicon](https://koboldcpp.net/docs/hardware/apple-silicon/), [RPC](https://koboldcpp.net/docs/hardware/rpc/).
## Launcher and settings
The [launcher tour](https://koboldcpp.net/docs/settings/launcher-tour/) explains every tab. Also: [Context size](https://koboldcpp.net/docs/settings/context-size/), [Config files](https://koboldcpp.net/docs/settings/config-files/), [Templates](https://koboldcpp.net/docs/settings/templates/), [Command line](https://koboldcpp.net/docs/settings/command-line/), [Admin mode](https://koboldcpp.net/docs/settings/admin-mode/).
## Features
[KoboldAI Lite](https://koboldcpp.net/docs/features/lite/), [Image and video generation](https://koboldcpp.net/docs/features/image-generation/), [Speech-to-text](https://koboldcpp.net/docs/features/speech-to-text/), [Text-to-speech](https://koboldcpp.net/docs/features/text-to-speech/), [Music](https://koboldcpp.net/docs/features/music/), [Vision and audio input](https://koboldcpp.net/docs/features/vision/), [Embeddings](https://koboldcpp.net/docs/features/embeddings/), [Web search and MCP tools](https://koboldcpp.net/docs/features/web-search-and-mcp/), [KoboldCpp Agent](https://koboldcpp.net/docs/features/agent/), [AI Horde worker](https://koboldcpp.net/docs/features/horde-worker/), [Multiplayer and server saves](https://koboldcpp.net/docs/features/multiplayer-and-saves/).
## Apps and API
[Connect SillyTavern and other apps](https://koboldcpp.net/docs/api/connect-apps/), the [API overview](https://koboldcpp.net/docs/api/overview/) and [endpoints](https://koboldcpp.net/docs/api/endpoints/), [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/), [Remote access](https://koboldcpp.net/docs/api/remote-access/), [Streaming and multiple users](https://koboldcpp.net/docs/api/streaming/).
## Troubleshooting
[Won't start](https://koboldcpp.net/docs/troubleshooting/wont-start/), [Model won't load](https://koboldcpp.net/docs/troubleshooting/model-wont-load/), [Out of memory](https://koboldcpp.net/docs/troubleshooting/out-of-memory/), [GPU not used or slow](https://koboldcpp.net/docs/troubleshooting/gpu-and-speed/), [Bad or strange output](https://koboldcpp.net/docs/troubleshooting/output-quality/), [Connection and API problems](https://koboldcpp.net/docs/troubleshooting/connection/), [OS-specific problems](https://koboldcpp.net/docs/troubleshooting/os-specific/). Short answers: the [FAQ](https://koboldcpp.net/docs/faq/).
## Reference
[Command-line flags](https://koboldcpp.net/docs/reference/flags/) and [Deprecated flags](https://koboldcpp.net/docs/reference/deprecated-flags/).
# Connect SillyTavern and other apps
> KoboldAI Lite is built in. To use KoboldCpp from SillyTavern or other apps, pick the right address - KoboldAI API, OpenAI-compatible /v1 or Ollama.
KoboldCpp has its own chat interface, KoboldAI Lite, at `http://localhost:5001`. You do not need another app. Connect one only if you prefer its interface or features.
## Which address to use
Start KoboldCpp with a model first. Then enter the address that matches the connection type you pick in the app:
| Connection type in the app | Address |
| -------------------------- | ----------------------------------------------------------------------------------- |
| KoboldAI or KoboldCpp | `http://localhost:5001` |
| OpenAI-compatible | `http://localhost:5001/v1` |
| Ollama | `http://localhost:11434` (start KoboldCpp on port 11434, [see below](#ollama-apps)) |
* If an app asks for the full KoboldAI API address, use `http://localhost:5001/api`.
* `localhost` only works on the PC that runs KoboldCpp. For a phone or another PC, see [Remote access](https://koboldcpp.net/docs/api/remote-access/).
* If you changed **Port:** on the **Network** tab (`--port`), use your port in place of `5001`.
When KoboldCpp is ready, the console shows the addresses:
Console
```text
Starting Kobold API on port 5001 at http://localhost:5001/api/
Starting OpenAI Compatible API on port 5001 at http://localhost:5001/v1/
Starting llama.cpp secondary WebUI at http://localhost:5001/lcpp/
```
## API key
* **No password set:** if the app requires an API key, enter any text.
* **Password set:** enter your password as the API key. See [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/).
## Model name
OpenAI-style apps often ask for a model name. KoboldCpp ignores it and always uses the model it has loaded, so any name works. `http://localhost:5001/v1/models` lists the loaded model.
The exception is router mode, where the model name selects which model to load. See [Admin mode](https://koboldcpp.net/docs/settings/admin-mode/).
## Reply length
Set the response length (max tokens) in the app. If the app does not send one, KoboldCpp uses **Default Gen Amt:** on the **Context** tab (`--defaultgenamt`, default 2048).
## SillyTavern
SillyTavern has its own connection type for KoboldCpp:
1. In SillyTavern, click **API Connections** (the plug icon in the top bar).
2. Set **API** to **Text Completion** and **API Type** to **KoboldCpp**.
3. Enter `http://localhost:5001` in **API URL**.
4. If you set a password, enter it in **koboldcpp API key (optional)**.
5. Click **Connect**.
KoboldCpp understands the SillyTavern-specific sampler fields, such as banned strings.
SillyTavern can also use KoboldCpp for images when an image model is loaded, through the A1111/Forge or ComfyUI APIs. Use the same `http://localhost:5001` address. See [Image generation](https://koboldcpp.net/docs/features/image-generation/).
## Ollama apps
Apps that only speak the Ollama API look for it on port 11434.
1. On the **Network** tab, set **Port:** to `11434`. On the command line, add `--port 11434`.
2. Launch. The console prints `Ollama Emulation is now available at port 11434.`
3. In the app, use `http://localhost:11434`.
If Ollama itself is running, it already uses port 11434 and KoboldCpp cannot start on it. Close Ollama first.
## Anthropic-API apps
KoboldCpp serves the Anthropic Messages API at `/v1/messages`. With a password, the app must send it as `Authorization: Bearer `. KoboldCpp does not accept the `x-api-key` header that Anthropic clients normally use. Configure such apps to send a Bearer token. If an app can't, run KoboldCpp without a password only where no one else can reach it, for example with **Host:** set to `127.0.0.1`.
## Other apps and tools
* **KoboldAI Lite online:** the hosted copy at [lite.koboldai.net](https://lite.koboldai.net) can connect to your local KoboldCpp.
* **KoboldAI United and KoboldAI Client:** enter the KoboldAI API address.
* **Bundled interfaces:** besides KoboldAI Lite, KoboldCpp serves the llama.cpp WebUI at `/lcpp/`, the image interface at `/sdui` and the music and speech interface at `/musicui`. The last two only generate when the matching model is loaded. See [KoboldAI Lite](https://koboldcpp.net/docs/features/lite/).
* **KoboldCpp Agent:** the bundled coding agent connects to `http://127.0.0.1:5001/v1` by default. See [Agent](https://koboldcpp.net/docs/features/agent/).
* **GPTLocalhost:** a Microsoft Word add-in that uses KoboldCpp.
* **Speech-to-text clients:** KoboldCpp accepts WAV, MP3 and FLAC audio. WebM recordings are not supported. See [Speech-to-text](https://koboldcpp.net/docs/features/speech-to-text/).
## Go deeper
* [API overview](https://koboldcpp.net/docs/api/overview/)
* [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/)
* [Remote access](https://koboldcpp.net/docs/api/remote-access/)
* [Streaming and multiple users](https://koboldcpp.net/docs/api/streaming/)
# API endpoints reference
> Every KoboldCpp API endpoint by family - path, method, purpose, whether the password protects it and which model or flag it needs.
Every endpoint KoboldCpp serves, grouped by API family. For request fields, see the API docs at `/api` on your instance or [lite.koboldai.net/koboldcpp\_api](https://lite.koboldai.net/koboldcpp_api).
How to read the tables:
* **Password:** **Yes** means the endpoint needs the password when one is set (`--password`). **No** means it never checks. **Admin** means admin mode and the admin password. See [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/).
* **Needs:** the model or flag that must be loaded for the endpoint to do its job. "Text model" is the model in **GGUF Text Model:**.
* A path in brackets is an alias that does the same.
* A short path after a comma continues the first path's prefix: `/api/extra/multiplayer/status`, `/getstory` means `/api/extra/multiplayer/getstory`.
## KoboldAI (native)
| Path | Method | Password | Purpose | Needs |
| ---------------------------------------------------------------- | --------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
| `/api/v1/generate` (`/api/latest/generate`) | POST | Yes | Generate text | Text model |
| `/api/extra/generate/stream` | POST | Yes | Generate text, streamed as server-sent events | Text model |
| `/api/extra/generate/check` | GET, POST | Yes | Text generated so far by the running request; POST with `genkey` for your own request | Text model |
| `/api/extra/abort` | POST | Yes | Stop generating; with `genkey` only your own request | Text model |
| `/api/extra/last_logprobs` | GET, POST | Yes | Token probabilities of the last generation | Text model |
| `/api/extra/tokencount` (`/api/extra/tokenize`) | POST | Yes | Count and list tokens; also accepts OpenAI-style `messages` | Text model |
| `/api/extra/detokenize` | POST | Yes | Turn token IDs back into text | Text model |
| `/api/extra/json_to_grammar` | POST | Yes | Convert a JSON schema to a grammar | |
| `/api/v1/model` | GET | Partly | Loaded model name; without a valid key it returns `koboldcpp/protected-model` | |
| `/api/v1/config/max_length`, `/api/v1/config/max_context_length` | GET | No | Limits reported to KoboldAI clients: `max_length` is 1024 unless `--hordegenlen` is set (not **Default Gen Amt:**); `max_context_length` is the context size, or `--hordemaxctx` if set | |
| `/api/v1/config/soft_prompt`, `/api/v1/config/soft_prompts_list` | GET | No | Compatibility stubs for KoboldAI clients | |
| `/api/v1/info/version` | GET | No | KoboldAI API version (`1.2.5`) | |
| `/api/extra/version` | GET | No | KoboldCpp version and active features | |
| `/api/extra/true_max_context_length` | GET | No | Context size the server allocated | |
| `/api/extra/perf` | GET | No | Speed of the last request, queue length | |
| `/api/extra/preloadstory` | GET | No | Story set with `--preloadstory` | `--preloadstory` |
| `/api/extra/websearch` | POST | Yes | Web search, body `{"q": "..."}`; returns `[]` when off | `--websearch` |
| `/api/extra/multiplayer/status`, `/getstory`, `/setstory` | POST | Yes | Shared multiplayer session | `--multiplayer` |
| `/api/extra/data/list`, `/load`, `/save` | POST | Yes | Server-side save slots | `--savedatafile` |
| `/api/extra/transcribe` | POST | Yes | Speech-to-text | Whisper model or audio mmproj |
| `/api/extra/tts` | POST | Yes | Text-to-speech | TTS model |
| `/api/extra/speakers_list` | GET | No | TTS voices | |
| `/api/extra/embeddings` | POST | Yes | Embeddings | Embeddings model |
| `/api/extra/music/prepare` | POST | Yes | Plan a song (audio codes) | Music models |
| `/api/extra/music/generate` | POST | Yes | Generate music as WAV or MP3 | Music models |
| `/request` | POST | Yes | Legacy format: `{text, max}` in, `{"data": {"seqs": [...]}}` out | Text model |
| `/api`, `/docs` | GET | No | API documentation | |
Without `--savedatafile`, `/api/extra/data/list` and `/load` close the connection without an answer, and `/save` returns HTTP 400.
## OpenAI-compatible
| Path | Method | Password | Purpose | Needs |
| ---------------------------------------------------- | ------ | -------- | -------------------------------------------------------------------- | ------------------------------------ |
| `/v1/completions` (`/v1/completion`, `/completions`) | POST | Yes | Text completion | Text model |
| `/v1/chat/completions` (`/chat/completions`) | POST | Yes | Chat, with tools and images; thinking text in `reasoning_content` | Text model; vision mmproj for images |
| `/v1/responses` (`/responses`) | POST | Yes | OpenAI Responses API | Text model |
| `/v1/models` (`/models`) | GET | No | Loaded model; in router mode also the admin-directory configs | |
| `/v1/embeddings` | POST | Yes | Embeddings; supports `encoding_format: base64` | Embeddings model |
| `/v1/audio/transcriptions` (`/audio/transcriptions`) | POST | Yes | Speech-to-text; JSON with `audio_data`, or a multipart `file` upload | Whisper model or audio mmproj |
| `/v1/audio/speech` (`/audio/speech`) | POST | Yes | Text-to-speech; `response_format: mp3` for MP3 | TTS model |
| `/v1/audio/voices` (`/audio/voices`) | GET | No | TTS voices | |
| `/v1/images/generations` (`/images/generations`) | POST | **No** | Generate an image | Image model |
| `/v1/images/edits` (`/images/edits`) | POST | **No** | Edit an image | Image model |
| `/v1` | GET | No | Landing page | |
## Anthropic-compatible
| Path | Method | Password | Purpose | Needs |
| ---------------------------- | ------ | ---------------- | -------------------------------------------------- | ---------- |
| `/v1/messages` (`/messages`) | POST | Yes, Bearer only | Anthropic Messages API, with images and tool calls | Text model |
## Ollama-compatible
Run KoboldCpp with `--port 11434` so Ollama apps find it.
| Path | Method | Password | Purpose | Needs |
| ---------------------- | ------ | -------- | ------------------------------------------------------ | ---------------- |
| `/api/generate` | POST | Yes | Text completion; streams unless `"stream": false` | Text model |
| `/api/chat` | POST | Yes | Chat with tool calls; streams unless `"stream": false` | Text model |
| `/api/embed` | POST | Yes | Embeddings | Embeddings model |
| `/api/tags`, `/api/ps` | GET | No | Model list | |
| `/api/version` | GET | No | Reports Ollama version `0.7.0` | |
| `/api/show` | POST | No | Fixed placeholder model info | |
## A1111 / Forge (images)
| Path | Method | Password | Purpose | Needs |
| -------------------------------------------------------------------------------------------------------------- | ------ | ----------------------- | --------------------------------------- | ----------------------------------------------------------- |
| `/sdapi/v1/txt2img` | POST | **No** | Text to image; also video with `frames` | Image model |
| `/sdapi/v1/img2img` | POST | **No** | Image to image, inpainting | Image model |
| `/sdapi/v1/upscale`, `/sdapi/v1/extra-single-image` | POST | **No** | Upscale an image | Upscaler (`--sdupscaler`) |
| `/sdapi/v1/interrogate` | POST | **No** | Describe an image | Vision mmproj; returns 503 `No Vision model loaded` without |
| `/sdapi/v1/sd-models`, `/options`, `/samplers`, `/schedulers`, `/loras`, `/upscalers`, `/latent-upscale-modes` | GET | No | Lists and settings | Image model |
| `/sdapi/v1/progress`, `/sdapi/v1/get_last.json` | GET | No (scoped by `genkey`) | Progress and last result | Image model |
## ComfyUI-compatible (images)
| Path | Method | Password | Purpose | Needs |
| ----------------------------------------------------------- | ------ | -------- | --------------------------------------------------------------- | ----------- |
| `/prompt` | POST | **No** | Generate an image; answers when it is done, with a fixed job ID | Image model |
| `/upload/image` (`/api/upload/image`) | POST | **No** | Upload an input image | Image model |
| `/view` (`/view.png`, `/api/view`, `/view_image`) | GET | No | Get the generated image | Image model |
| `/history` (`/api/history`) | GET | No | Emulated history that only holds the last image | Image model |
| `/ping`, `/system_stats`, `/object_info` | GET | No | Compatibility answers; `/system_stats` holds placeholder values | |
| `/models/checkpoints`, `/models/loras` (also under `/api/`) | GET | No | Model lists | |
| `/ws` | GET | No | WebSocket handshake only | |
## XTTS-compatible (speech)
| Path | Method | Password | Purpose | Needs |
| ------------------------------------------------ | ------ | -------- | --------------------------------- | --------- |
| `/tts_to_audio` | POST | **No** | Text-to-speech | TTS model |
| `/speakers_list`, `/speakers` | GET | No | Voices | |
| `/get_tts_settings` | GET | No | Settings stub | |
| `/set_tts_settings` | POST | No | Accepts anything, changes nothing | |
| `/voice/check`, `/voice/speakers`, `/voice/vits` | GET | No | Legacy TTS endpoints | |
## Admin
Only active with admin mode (**Enable Model Administration**, `--admin`). See [Admin mode](https://koboldcpp.net/docs/settings/admin-mode/).
| Path | Method | Password | Purpose |
| ---------------------------------------------------------------------- | ------ | -------- | -------------------------------------------------------------------------------------------------------- |
| `/api/admin/list_options` | GET | Admin | Configs and models you can switch to |
| `/api/admin/reload_config` | POST | Admin | Switch config or model, body `{"filename": "..."}`; `unload_model` and `initial_model` are special names |
| `/api/admin/check_state`, `/save_state`, `/load_state`, `/clear_state` | POST | Admin | Save and restore the KV cache |
## Other
| Path | Method | Password | Purpose | Needs |
| -------------------------- | ------ | -------- | ---------------------------------------------------------------------- | ------------------------------ |
| `/mcp` | POST | Yes | MCP JSON-RPC proxy (`initialize`, `tools/list`, `tools/call`) | `--mcpfile` |
| `/props` | GET | No | llama.cpp-style info: chat template, `n_ctx`, vision and audio support | |
| `/slots` | GET | No | Always 501; not supported | |
| `/.well-known/serviceinfo` | GET | No | Service info | |
| `/` | GET | No | KoboldAI Lite | |
| `/noscript` | GET | No | Interface without JavaScript | |
| `/lcpp/` | GET | No | llama.cpp WebUI | |
| `/sdui` | GET | No | Stable UI for images | Image model to generate |
| `/musicui` | GET | No | Music and TTS interface | Music or TTS model to generate |
| `/manifest.json` | GET | No | Web app manifest | |
## Not in the official API docs
The API docs at `/api` leave out: the Ollama, ComfyUI and XTTS endpoints, `/v1/images/edits`, `/v1/audio/voices`, `/mcp`, `/request`, `/sdapi/v1/extra-single-image`, the A1111 GET lists other than `sd-models`, `options` and `samplers`, the soft prompt stubs and `/slots`.
# API overview: KoboldAI, OpenAI and Ollama APIs
> The APIs KoboldCpp serves on one port - KoboldAI, OpenAI, Anthropic, Ollama, A1111/Forge, ComfyUI, XTTS and Whisper - and where to find the API docs.
KoboldCpp serves several APIs at once, all on the same port (5001 by default). Many apps built for other servers, such as OpenAI, Ollama or Automatic1111, can use KoboldCpp once you point them to its address. Not every feature of those servers is supported.
## API documentation
KoboldCpp serves many compatibility REST APIs. Swagger API documentation is provided:
* **On your instance:** Run KoboldCpp, then open `http://localhost:5001/api` for interactive API docs hosted locally.
* **Online API docs:** An online copy of the docs is hosted at [lite.koboldai.net/koboldcpp\_api](https://lite.koboldai.net/koboldcpp_api).
Both cover the KoboldAI, OpenAI, Anthropic and A1111 endpoints. The Ollama, ComfyUI and XTTS emulation is not in them; see [Endpoints](https://koboldcpp.net/docs/api/endpoints/).
## API families
| API | Base path | Use it for |
| ---------------------- | ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| KoboldAI (native) | `/api/v1/`, `/api/extra/` | Text generation with full sampler control, plus KoboldCpp extras such as token counting, abort and multiplayer. KoboldAI Lite uses this API. |
| OpenAI | `/v1/` | Completions, chat completions (with tools and images), embeddings, audio and images |
| OpenAI Responses | `/v1/responses` | Apps built for the OpenAI Responses API |
| Anthropic Messages | `/v1/messages` | Apps built for the Anthropic API, with images and tool calls |
| Ollama | `/api/generate`, `/api/chat`, `/api/embed`, `/api/tags` | Ollama apps; run KoboldCpp on port 11434 so they find it |
| A1111 / Forge | `/sdapi/v1/` | Image generation, upscaling and image captioning |
| ComfyUI | `/prompt`, `/view`, `/history` | Apps that send image jobs to ComfyUI |
| XTTS | `/tts_to_audio`, `/speakers_list` | Apps built for an XTTS text-to-speech server |
| OpenAI audio (Whisper) | `/v1/audio/transcriptions`, `/v1/audio/speech` | Speech-to-text and text-to-speech |
Each family needs the matching model loaded. Text endpoints need a text model, image endpoints an image model, and so on. [Endpoints](https://koboldcpp.net/docs/api/endpoints/) lists every path and what it needs.
## First requests
Two examples with `curl`. They use Linux and macOS shell quoting.
KoboldAI API:
Terminal
```sh
curl http://localhost:5001/api/v1/generate \
-H "Content-Type: application/json" \
-d '{"prompt": "Once upon a time", "max_length": 50}'
```
The reply text is in `results[0].text`.
OpenAI chat completions:
Terminal
```sh
curl http://localhost:5001/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"messages": [{"role": "user", "content": "Hello there!"}], "max_tokens": 50}'
```
On Windows, Command Prompt needs the command on one line, with the inner quotes escaped. In PowerShell, type `curl.exe` instead of `curl`.
Command Prompt
```bat
curl http://localhost:5001/api/v1/generate -H "Content-Type: application/json" -d "{\"prompt\": \"Once upon a time\", \"max_length\": 50}"
```
If you set a password, add `-H "Authorization: Bearer "`. See [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/).
## What is loaded
| Path | Shows |
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /api/extra/version` | Which features are available: `llm`, `txt2img`, `vision`, `audio`, `transcribe`, `tts`, `embeddings`, `music`, `websearch`, `multiplayer`, `jinja`, `mcp`, `admin`, `router`, `protected` and more |
| `GET /v1/models` | The loaded text model; in router mode also the files you can switch to |
| `GET /props` | Chat template, context size (`n_ctx`) and whether vision and audio input work |
| `GET /api/extra/true_max_context_length` | The context size the server allocated |
| `GET /api/extra/perf` | Speed of the last request and the queue length |
## Chat formatting
The chat-style APIs (OpenAI chat, Responses, Anthropic, Ollama chat) send messages, and KoboldCpp turns them into the prompt format the model expects.
* By default, KoboldCpp guesses the format from the model's chat template (**Chat Adapter:** on the **Loaded Files** tab, `--chatcompletionsadapter`, default `AutoGuess`). The console prints `Chat completion heuristic: `.
* **Use Jinja** (`--jinja`) renders the model's own chat template instead. Try it if chat replies look badly formatted with a newer model.
* For tool calls with Jinja, also tick **Jinja for Tools** (`--jinjatools`).
## Advanced: server-side defaults
These apply to every request from every app:
| Launcher (**Context** tab) | Flag | Effect |
| -------------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Default Gen Amt:** | `--defaultgenamt` | Reply length when the request sets none (default 2048, at most half the context) |
| **Prompt Limit:** | `--genlimit` | Hard cap on reply length; longer requests are cut to it |
| **Default Params:** | `--gendefaults` | JSON with default values for fields the request leaves out, using the native KoboldAI and A1111 field names, e.g. `{"rep_pen": 1.1}`. For the reply length, use **Default Gen Amt:** instead. |
| **Override** | `--gendefaultsoverwrite` | Makes **Default Params:** overwrite values the request did send |
## Advanced: routing details
* Most paths are matched by their ending; a few, such as `/props` and `/prompt`, must match exactly. The query string and a trailing slash don't change which endpoint answers: `http://localhost:5001/api/v1/generate/` works the same as without the slash.
* Paths starting with `/lcpp/` are mapped to the root, so `/lcpp/v1/models` answers like `/v1/models`. This is how the bundled llama.cpp WebUI at `/lcpp/` reaches the API.
* An unknown GET path returns 404 with a short HTML page that links to `/api`. An unknown POST path returns 404.
* `POST /mcp` is a JSON-RPC proxy to the MCP servers from **MCP JSON:** (`--mcpfile`). See [Web search and MCP](https://koboldcpp.net/docs/features/web-search-and-mcp/).
* Admin mode adds `/api/admin/` endpoints for swapping models. See [Admin mode](https://koboldcpp.net/docs/settings/admin-mode/).
## Go deeper
* [Endpoints](https://koboldcpp.net/docs/api/endpoints/)
* [Streaming and multiple users](https://koboldcpp.net/docs/api/streaming/)
* [Connect other apps](https://koboldcpp.net/docs/api/connect-apps/)
# Passwords and security
> Protect a shared KoboldCpp with a password and admin password, limit who can connect, and know which endpoints stay open.
By default KoboldCpp has no password and accepts connections on all network interfaces. Any device that can reach your PC on port 5001 can use it.
## Safe setup at a glance
| Your situation | Do this |
| --------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| Only you, on this PC | Set **Host:** to `127.0.0.1` (`--host 127.0.0.1`). |
| Other devices on your network, or **Remote Tunnel** | Set a **Password:** (`--password`). |
| Admin mode is on | Always set an **Admin Password:** (`--adminpassword`). |
| Sharing with an image model loaded | Image generation is not password-protected. Limit image size with `--sdclamped`, or don't load an image model. |
## Set a password
* **Launcher:** **Network** tab → **Password:**
* **Command line:** `--password `
* **Environment variable:** `KCPP_PASSWORD`
In apps, enter the password where they ask for an API key. KoboldAI Lite asks for it in an **API Key Required** box when it opens.
## How clients send the password
Clients must send the header `Authorization: Bearer `. This is the same way OpenAI apps send their API key.
Terminal
```sh
curl http://localhost:5001/v1/chat/completions \
-H "Authorization: Bearer mypassword" \
-H "Content-Type: application/json" \
-d '{"messages": [{"role": "user", "content": "Hello!"}]}'
```
On Windows, write it on one line with escaped quotes; see [First requests](https://koboldcpp.net/docs/api/overview/#first-requests).
* No other header works. KoboldCpp does not accept `x-api-key`, which Anthropic clients use.
* A missing or wrong password returns HTTP 401: `{"detail": {"error": "Unauthorized", "msg": "Authentication key is missing or invalid.", "type": "unauthorized"}}`
## What the password protects
**Protected:**
* Text generation on every API: KoboldAI, OpenAI, Responses, Anthropic, Ollama
* Token counting, generation check, abort, logprobs
* Speech-to-text, `/api/extra/tts`, `/v1/audio/speech`, embeddings, music
* Web search, multiplayer, server-side saves, `/mcp`
**Not protected:**
* Image generation: `/sdapi/v1/txt2img`, `/sdapi/v1/img2img`, `/v1/images/*`, ComfyUI `/prompt` and `/upload/image`
* Upscaling: `/sdapi/v1/upscale`, `/sdapi/v1/extra-single-image`
* Image captioning: `/sdapi/v1/interrogate`
* XTTS text-to-speech: `/tts_to_audio`
* Info pages (GET), such as `/api/extra/version`, `/api/extra/perf`, `/v1/models` and `/props`
* `/api/v1/model` hides the model name without the password, but `/v1/models` and `/props` still show it.
* The web interfaces (KoboldAI Lite, `/sdui` and the others) load without a password. Their requests to protected endpoints need it.
If you share an instance that has an image or TTS model loaded, anyone who can reach it can generate images and speech. Limit image size with **Clamp Resolution (Hard):** on the **Image Gen** tab (`--sdclamped`), or only load those models on instances you trust.
## Admin password
Admin mode (**Enable Model Administration** on the **Admin** tab, `--admin`) lets clients switch and unload models.
Caution
Always set an admin password when you enable admin mode.
* **Launcher:** **Admin** tab → **Admin Password:**
* **Command line:** `--adminpassword `
* **Environment variable:** `KCPP_ADMINPASSWORD`
The admin password also works as the normal password. Give other users the normal password and keep the admin password for yourself. See [Admin mode](https://koboldcpp.net/docs/settings/admin-mode/).
## Passwords in saved files
* A saved config (`.kcpps`) contains your passwords in plain text. Don't share it.
* Templates (`.kcppt`, **Generate LaunchTemplate** on the **Extra** tab) leave the passwords out. Share those instead, after checking them for local file paths and an embedded story.
## Who can connect
**Host:** on the **Network** tab (`--host`) sets which network address KoboldCpp listens on.
| Host | Who can connect |
| ----------------------------- | ----------------------------------------------- |
| Empty (default) | Any device that can reach this PC |
| `127.0.0.1` | Only this PC |
| One of this PC's IP addresses | Devices that reach this PC through that network |
For access from other devices, see [Remote access](https://koboldcpp.net/docs/api/remote-access/).
**Remote Tunnel** also works with `127.0.0.1`, because its `cloudflared` program runs on the same PC. If you only use KoboldCpp locally and through the tunnel, set **Host:** to `127.0.0.1` and leave **Router Mode** off, so that other devices on your network cannot connect directly.
## Browser access (CORS)
KoboldCpp allows requests from web pages on any site. This is what lets browser apps, such as the hosted KoboldAI Lite at lite.koboldai.net, talk to your local server. There is no setting to restrict it.
It also means that any web page open in your browser can send requests to your KoboldCpp. The password keeps them out of the protected endpoints.
## HTTPS (SSL)
KoboldCpp serves plain HTTP by default. To serve HTTPS, give it a certificate and a key:
* **Launcher:** **Network** tab → **SSL Cert:** and **SSL Key:**
* **Command line:** `--ssl cert.pem key.pem`
The key must be unencrypted (no passphrase). If a file is missing, KoboldCpp prints `Your SSL configuration is INVALID. SSL will not be used.` and serves plain HTTP. If a file exists but is not a valid certificate or key, the server does not start.
To make a self-signed certificate for testing:
Terminal
```sh
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365 -nodes
```
Browsers warn about self-signed certificates until you trust them. **Remote Tunnel** links are HTTPS already, without a certificate of your own.
## Limits for shared servers
| Launcher | Flag | Default | Effect |
| ------------------------------------------------------------ | ------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Multiuser Queue:** (**Network**) | `--multiuser` | 10 | How many requests it accepts at once, counting the one that runs (default: 1 runs, 9 wait); see [Streaming and multiple users](https://koboldcpp.net/docs/api/streaming/#several-users-at-once) |
| **Max Req. Size (MB):** (**Network**) | `--maxrequestsize` | 32 | Bigger requests get HTTP 500 `Payload is too big`. |
| **IP Rate Limiter (s):** (**Network**) | `--ratelimit` | 0 (off) | Each IP may start one generation per this many seconds; faster ones get HTTP 503. Behind **Remote Tunnel**, all users count as one IP. |
| **Prompt Limit:** (**Context**) | `--genlimit` | 0 (off) | Caps the reply length of every request |
| **Clamp Resolution (Hard):** (**Image Gen**) | `--sdclamped` | 0 (off) | Caps the longest image side; `--sdclamped` alone means 512 |
| **(Soft):**, next to Clamp Resolution (Hard) (**Image Gen**) | `--sdclampedsoft` | 0 | Caps the image area; 0 means 832×832 for SD 1.x/2.x and 1024×1024 for other models |
## Advanced: other network settings
* **NoCertify Mode (Insecure)** (`--nocertify`) turns off certificate checks for KoboldCpp's own outgoing connections, such as web search, MCP servers and the Horde worker. Model downloads use `aria2c`, `curl` or `wget`, which still check certificates. It does not affect the server's HTTPS.
* MCP servers from **MCP JSON:** (`--mcpfile`) that run as a local command have full access to your system. Remote MCP servers receive the data sent to them. Only add servers you trust. See [Web search and MCP](https://koboldcpp.net/docs/features/web-search-and-mcp/).
* RPC (sharing a GPU with other PCs) must not be exposed to the internet. See [RPC](https://koboldcpp.net/docs/hardware/rpc/).
* Don't combine **SingleInstance Mode** (`--singleinstance`) with **Remote Tunnel**.
## Related
* [Remote access](https://koboldcpp.net/docs/api/remote-access/)
* [Admin mode](https://koboldcpp.net/docs/settings/admin-mode/)
* [Endpoints](https://koboldcpp.net/docs/api/endpoints/)
# Remote access
> Use KoboldCpp from your phone or another PC - on the same network with the LAN IP, or over the internet with Remote Tunnel. Set a password first.
KoboldCpp runs on one PC, and you can use it from other devices. KoboldAI Lite works in any browser, including on phones.
| Where the other device is | Use |
| ------------------------- | ----------------------------------------- |
| Same Wi-Fi or network | [The PC's network address](#same-network) |
| Anywhere | [Remote Tunnel](#anywhere-remote-tunnel) |
Caution
Set a **Password:** on the **Network** tab (`--password`) before you open KoboldCpp to other devices. See [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/).
## Same network
KoboldCpp listens on all network interfaces by default, so devices on your network can already reach it.
1. If others share your network, set a **Password:** on the **Network** tab. Leave **Host:** on the same tab empty; with `127.0.0.1`, only this PC can connect.
2. Launch KoboldCpp.
3. Find the PC's IP address on your network, for example `192.168.1.20`.
* Windows: run `ipconfig` in Command Prompt and look for **IPv4 Address**.
* Linux: run `hostname -I`.
* macOS: run `ipconfig getifaddr en0`.
4. On the other device, open `http://:5001`, for example `http://192.168.1.20:5001`.
The console still prints `http://localhost:5001`. That address is only for the PC itself.
If the page does not load, the PC's firewall is usually blocking port 5001, or the IP address is wrong:
* **Windows:** on first launch, Windows may ask whether KoboldCpp may use the network. Allow **Private networks**. If you missed it, open **Windows Security** > **Firewall & network protection** > **Allow an app through firewall** and tick KoboldCpp for **Private**.
* **Linux (ufw):** `sudo ufw allow 5001/tcp`.
Browsers allow the microphone and camera only on HTTPS or on the PC itself (`localhost`). For voice input or the camera from another device, use the **Remote Tunnel** link or [HTTPS](https://koboldcpp.net/docs/api/passwords-and-security/#https-ssl).
For other apps, use the same address in place of `localhost`, for example `http://192.168.1.20:5001/v1` for OpenAI-compatible apps.
## Anywhere: Remote Tunnel
**Remote Tunnel** creates a public HTTPS link through Cloudflare. It works even behind a firewall.
1. Set a **Password:** on the **Network** tab.
2. Tick **Remote Tunnel** on the **Quick Launch** or **Network** tab. On the command line, add `--remotetunnel`.
3. Launch. The first time, KoboldCpp downloads Cloudflare's `cloudflared` program from GitHub.
4. Wait for the link in the console:
Console
```text
Your remote tunnel is ready, please connect to https://.trycloudflare.com
```
5. Open the link on any device to use KoboldAI Lite. For other apps, add `/api` or `/v1` to it, as printed in the console.
The link changes every time you launch KoboldCpp.
Anyone who has the link can reach your KoboldCpp. The password keeps them out of text generation, but not out of image generation. See [what the password protects](https://koboldcpp.net/docs/api/passwords-and-security/#what-the-password-protects).
If the tunnel fails, the console prints `Error: Could not create cloudflare tunnel!` or `Remote Tunnel Failed!`. KoboldCpp needs internet access to download `cloudflared` and to open the tunnel.
Remote Tunnel does not start in terminal-only modes (`--cli`, `--prompt`, `--benchmark`).
## Share with the world: AI Horde
To let anyone use your model through the AI Horde network instead of a private link, run KoboldCpp as a Horde worker. See [Horde worker](https://koboldcpp.net/docs/features/horde-worker/).
## Advanced: choose the network address
**Host:** (`--host`) sets the address KoboldCpp listens on. Leave it empty for all interfaces, use `127.0.0.1` for this PC only, or one of the PC's IP addresses to listen on that network only. When **Host:** is set, the console prints that address in place of `localhost`.
The port is **Port:** on the **Network** tab (`--port`, default 5001).
## Advanced: HTTPS on your network
On your own network, KoboldCpp serves plain HTTP. To serve HTTPS, set **SSL Cert:** and **SSL Key:** (`--ssl cert.pem key.pem`). The console addresses then start with `https://`. See [HTTPS (SSL)](https://koboldcpp.net/docs/api/passwords-and-security/#https-ssl).
With SSL on, **Remote Tunnel** connects to KoboldCpp over HTTPS and accepts its certificate even if it is self-signed.
## Safety checklist
* Set a **Password:** before you use **Remote Tunnel** or share on your network.
* If admin mode is on, set an **Admin Password:**.
* Image generation and `/tts_to_audio` are open to anyone who can reach the server. Load those models only on instances you trust, or limit image size with `--sdclamped`.
* For shared servers, consider `--ratelimit`, `--genlimit` and `--maxrequestsize`. See [Limits for shared servers](https://koboldcpp.net/docs/api/passwords-and-security/#limits-for-shared-servers).
## Related
* [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/)
* [Connect other apps](https://koboldcpp.net/docs/api/connect-apps/)
* [Connection problems](https://koboldcpp.net/docs/troubleshooting/connection/)
# Streaming and multiple users
> How each KoboldCpp API streams replies (SSE or NDJSON), how to poll and abort, and how the request queue behaves with several users.
Streaming sends the reply piece by piece while it is generated, instead of all at once at the end. KoboldAI Lite streams by default.
## Streaming per API
| API | How to turn it on | Format |
| ------------------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------- |
| KoboldAI | Call `/api/extra/generate/stream` in place of `/api/v1/generate` | Server-sent events (SSE): `event: message` + `data:` |
| OpenAI completions and chat | `"stream": true` | SSE: `data:` lines, last one `data: [DONE]` |
| OpenAI Responses | `"stream": true` | SSE with named `event:` lines |
| Anthropic Messages | `"stream": true` | SSE with named `event:` lines |
| Ollama (`/api/generate`, `/api/chat`) | On by default; `"stream": false` turns it off | NDJSON (`application/x-ndjson`), one JSON object per line |
## What the streams look like
Real first bytes from KoboldCpp, shortened.
**KoboldAI** (`/api/extra/generate/stream`). The last event has a `finish_reason`; there is no `[DONE]`.
```text
event: message
data: {"token": " to the team", "finish_reason": null}
event: message
data: {"token": "", "finish_reason": "length"}
```
**OpenAI chat** (`/v1/chat/completions`, `"stream": true`). Completions (`/v1/completions`) also end with `data: [DONE]`, but use `"object": "text_completion"` and put each piece in `choices[0].text` instead of `delta.content`.
```text
data: {"id": "chatcmpl-…", "object": "chat.completion.chunk", …, "choices": [{"index": 0, "finish_reason": null, "delta": {"role": "assistant", "content": "Hi! How can I"}}]}
data: [DONE]
```
**Anthropic** (`/v1/messages`, `"stream": true`). The events arrive in this order: `message_start`, `content_block_start`, `content_block_delta` (repeated), `content_block_stop`, `message_delta` (with `stop_reason`), `message_stop`.
**Ollama** (`/api/chat`). One JSON object per line; the last one has `"done": true` and a `done_reason`.
## Polling instead of streaming (KoboldAI)
Apps that can't read SSE can poll instead:
1. Start the request with `POST /api/v1/generate`.
2. While it runs, call `/api/extra/generate/check` to get the text generated so far.
When several users share the server, send a unique `genkey` in the generate request and in `POST /api/extra/generate/check`. Each user then sees only their own text.
KoboldAI Lite can also use polling; it is an option in Lite's settings.
## Stopping a generation
* `POST /api/extra/abort` stops the running generation. With `genkey` in the body, it only stops the request with that key.
* Image generation stops when the client disconnects, unless the request sets `keep_image_gen_on_disconnect` in `kcpp_extra_args`.
## Tool calls
* Without **Jinja for Tools** (`--jinjatools`), a tool-call reply is sent all at once, in stream format.
* With **Jinja for Tools**, tool calls stream as they are generated if KoboldCpp recognizes the model's tool-call format. Otherwise they are sent all at once. **Jinja for Tools** is on the **Context** tab and also turns on **Use Jinja**.
* During tool-call streams, KoboldCpp sends whitespace now and then to keep the connection open.
If generation fails in the middle of a stream, KoboldCpp sends an error object in the stream.
## Several users at once
KoboldCpp generates text for one request at a time. Other requests wait in a queue and run in turn. **Multiuser Queue:** on the **Network** tab (`--multiuser`) sets how many requests it accepts at once, counting the one that runs:
| `--multiuser` | Behaviour |
| --------------- | ----------------------------------------------------- |
| `10` (default) | 1 request runs, up to 9 wait |
| `N` (2 or more) | 1 request runs, up to N−1 wait |
| `1` | Same as 10 |
| `0` | No queue: while one request runs, others get HTTP 503 |
A request that finds the queue full gets HTTP 503 with `{"detail": {"msg": "Server is busy; please try again later.", "type": "service_unavailable"}}`.
Measured with four requests sent at once, each taking about 2.5 seconds:
| `--multiuser` | Results |
| ------------- | --------------------------------------------------------------- |
| default | All 4 succeed, finishing after about 2.5, 5, 7.5 and 10 seconds |
| `2` | 2 succeed, 2 get 503 |
| `0` | 1 succeeds, 3 get 503 |
Exceptions to `0`:
* When a Whisper, image, TTS or embeddings model is loaded, `0` acts like `2`.
* Otherwise, with **Parallel Requests:** above 1, `0` acts like `10`.
* The launcher shows values below 2 as 10. A `.kcpps` with `multiuser` set to `0` becomes 10 when you load it in the launcher.
`GET /api/extra/perf` shows the current queue.
## Advanced: parallel requests
**Parallel Requests:** on the **Network** tab (`--parallelrequests N`, also `--contbatch`) runs up to N text requests at the same time with continuous batching. It is experimental.
* Values from 0 to 32; 0 and 1 mean off.
* It turns off **Use ContextShift**.
* Only plain text requests run in parallel. Requests with images or audio, grammar, banned strings, many samplers (DRY, XTC, Mirostat and others), tool calls or reasoning effort run one at a time. **Use SmartCache**, a draft model and **Enable Guidance** also turn batching off.
* The console prints `Batching disabled due to …` when a request can't be batched.
See the [flag reference](https://koboldcpp.net/docs/reference/flags/#parallelrequests) for the full list.
## Related
* [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/) for `--ratelimit` and other limits
* [Endpoints](https://koboldcpp.net/docs/api/endpoints/)
* [Multiplayer and saves](https://koboldcpp.net/docs/features/multiplayer-and-saves/)
# Frequently asked questions (FAQ)
> Short answers to common KoboldCpp questions about downloads, models, memory, performance, features and the API, with links to the details.
Short answers, each with a link to the page that explains more. For error messages, see [Troubleshooting](https://koboldcpp.net/docs/troubleshooting/wont-start/).
## General
### What is KoboldCpp?
A program for running AI models (GGUF files) on your own computer. It is a single file with no installation, builds on llama.cpp, and includes the KoboldAI Lite web interface. Besides text, it can generate images, video and music, transcribe speech and speak text. See the [beginner guide](https://koboldcpp.net/getting-started/).
### Is it free?
Yes. KoboldCpp and KoboldAI Lite are open source under AGPL-3.0; the included llama.cpp, GGML and stable-diffusion.cpp parts are under MIT. You don't need an account to run it.
### Where is the official download?
Only on GitHub: the [official releases](https://github.com/LostRuins/koboldcpp/releases/latest). Files from other sites are not official. See [Staying safe](https://koboldcpp.net/docs/install/staying-safe/) for a list of known fake sites.
### Are my chats private?
KoboldCpp runs fully offline and sends your chats nowhere. KoboldAI Lite stores your stories in your browser. Some things use the internet by design:
* Model files you give as a URL are downloaded.
* **Enable WebSearch** (`--websearch`) searches the web.
* **Remote Tunnel** (`--remotetunnel`) makes KoboldCpp reachable over the internet.
* MCP tools (`--mcpfile`) send the model's tool calls to the MCP servers you set up.
* AI Horde and other apps you connect have their own privacy rules.
* In KoboldAI Lite, **Share** with **Web URL** uploads the story to a public pastebin.
The console shows your prompts and replies. **Quiet Mode** (`--quiet`) hides them.
## Download & setup
### Which file do I download?
| Your PC | Windows | Linux |
| ------------------------------------ | ---------------------- | ---------------------------- |
| NVIDIA graphics card | `koboldcpp.exe` | `koboldcpp-linux-x64` |
| AMD, Intel or no graphics card | `koboldcpp-nocuda.exe` | `koboldcpp-linux-x64-nocuda` |
| Older processor or older NVIDIA card | `koboldcpp-oldpc.exe` | `koboldcpp-linux-x64-oldpc` |
Apple Silicon Macs: `koboldcpp-mac-arm64`. See [Download KoboldCpp](https://koboldcpp.net/download/)
### Do I need a graphics card?
No. KoboldCpp runs on the processor alone. A graphics card makes it much faster, and it can hold part of a model that doesn't fit completely.
### Which model should I start with?
* Qwen3-VL-8B (Q4\_K\_S): the recommended all-rounder.
* Gemma3-4B: lightweight and fast.
* L3-8B-Stheno-v3.2: for creative writing and roleplay.
Or click **Get Help** in the launcher and load a **Newbie Template**, which downloads a model for you. See [Choose a model](https://koboldcpp.net/getting-started/model/).
### Which quant do I download? Do I need all the files?
You need one `.gguf` file, not the whole repository. If the quant is split into parts (`-00001-of-00003.gguf`), download all parts and select the first. Start with **Q4\_K\_M** or **Q4\_K\_S**. A lower quant is smaller, at some cost in quality. See [Choosing a quant](https://koboldcpp.net/docs/models/gguf-and-quantization/).
### What's the difference between GGUF and GGML?
GGUF is the current format for text models. GGML (`.bin`) is the old format: it still loads, but some newer features don't work and its context is limited to 16k.
### Can I use safetensors or PyTorch models?
Not for text models; convert them to GGUF first. Image models can be `.safetensors` or `.gguf`.
### Where do models downloaded from a URL go?
Into the current working directory. When you double-click KoboldCpp, that is its own folder. **Download Dir:** on the **Loaded Files** tab (`--downloaddir`) sets a different folder.
### How do I update?
Download the new file from the releases and use it instead of the old one. The launcher's **Update** button only opens the releases page. Save your settings with **Save Config** to keep them. See [Updating](https://koboldcpp.net/docs/install/updating/).
### Does it run on Android?
Yes, in Termux. KoboldCpp is compiled on the phone by an official setup script. See [Android (Termux)](https://koboldcpp.net/docs/install/android/).
### Does it run on Windows 7?
Not recommended. Use `koboldcpp-oldpc.exe`; the main builds need Windows 8 or newer. See [Windows 7](https://koboldcpp.net/docs/install/windows/#advanced-windows-7).
### My processor has no AVX2. Can I still use it?
Yes. KoboldCpp detects this and switches to a slower compatibility mode. You can also pick **Use CPU (Old CPU)** or **Use Vulkan (Old CPU)** (`--noavx2`), or for processors without AVX, **Failsafe Mode (Older CPU)** (`--failsafe`). The `oldpc` files add CUDA 11 for AVX1 processors and **Use Vulkan (Older CPU)** for graphics cards on processors without AVX. See [Processor requirements](https://koboldcpp.net/docs/install/releases/#processor-avx2-avx-no-avx).
### Can I run it without a model?
Yes. `--nomodel` (**Allow Launch Without Models** on the **Loaded Files** tab) starts KoboldCpp without loading a model. KoboldAI Lite can then connect to AI Horde or other online providers.
## Running & performance
### Which port does it use?
5001, so the chat is at `http://localhost:5001`. Change it with **Port:** on the **Network** tab or `--port`.
### How do I use the command line?
Pass the model and options after the file name, for example `koboldcpp.exe --model mymodel.gguf --contextsize 8192`. With a model, the launcher is skipped. `--help` lists all flags. Many llama.cpp short forms also work, such as `-m`, `-c`, `-ngl` and `-t`. See [Command line](https://koboldcpp.net/docs/settings/command-line/).
### How many GPU layers should I use?
Leave **GPU Layers:** at `-1`. KoboldCpp then fits as many layers into your VRAM as possible. A number you enter yourself turns this off. **Force AutoFit** (`--autofit`) forces the automatic fit even over manual settings. See [GPU layers](https://koboldcpp.net/docs/hardware/gpu-layers/).
### How much RAM or VRAM do I need?
Roughly the model's file size, plus memory for the context, plus some spare room. It depends on the model, the quant and the context size, so there is no fixed table. See [Memory](https://koboldcpp.net/docs/models/memory/).
### How many threads should I use?
The default works for most PCs: about half of your processor's threads, minus one, and at most 8 when the system reports an Intel processor. With the whole model on the graphics card, the thread count matters little.
### How do I make it faster?
* NVIDIA: **Use CUDA**.
* AMD and Intel graphics: **Use Vulkan**. On Linux, an official ROCm build also exists for AMD.
* Apple Silicon: the Mac build uses Metal automatically.
* Put as many layers on the graphics card as fit, and keep **Use FlashAttention** on.
See [GPU not used or slow](https://koboldcpp.net/docs/troubleshooting/gpu-and-speed/).
### Can I use several graphics cards?
Yes, with CUDA and with Vulkan. **Tensor Split:** (`--tensor_split`) sets the share per card, and **SplitMode:** (`--splitmode`) is `layer` (default) or `tensor`. See [Multiple GPUs](https://koboldcpp.net/docs/hardware/multi-gpu/).
### What's the difference between row and layer split?
Row split no longer exists. `--splitmode row` now uses tensor split and prints a warning. The choices are `layer` and `tensor`.
### How do I get a longer context?
Set **Context Size:** in the launcher or `--contextsize` (default 16384, up to 524288 on the command line; the launcher slider goes to 262144). GGUF models set their RoPE scaling automatically. More context needs more memory. See [Context size](https://koboldcpp.net/docs/settings/context-size/).
### What are ContextShift and FastForwarding?
Both avoid processing the whole prompt again. FastForwarding reuses the part of the prompt that didn't change; ContextShift drops the oldest text when the context is full. Both are on by default (`--noshift` and `--nofastforward` turn them off; turning off FastForwarding also turns off ContextShift). On models with SWA, ContextShift is off while SWA is on.
### What is SWA?
Sliding window attention: a much smaller context cache for models that support it, such as Gemma 3. It is on by default and turns ContextShift off. **Allow SWA** off (`--noswa`) disables it. The old `--useswa` flag does nothing.
### What is flash attention?
A faster, more memory-efficient way of computing attention. It is on by default; **Use FlashAttention** off (`--noflashattention`) disables it. The old `--flashattention` flag does nothing.
### What does quantized KV cache do?
It stores the context in lower precision to save memory: **Quantize KV Cache:** (`--quantkv`) with `f16` (default), `bf16`, `q8_0`, `q5_1` or `q4_0`. Keep flash attention on; without it, only part of the cache is quantized. The old numbers `1` and `2` still mean `q8_0` and `q4_0`.
### What are mmap and mlock?
**Use MMAP** (`--usemmap`, off by default) lets the system read the model file from disk as needed. **Use mlock** (`--usemlock`, off) keeps the model from being moved out of RAM. Both can be combined.
### What does lowvram do?
`--lowvram` keeps the context cache in system RAM instead of VRAM. It works with CUDA and Vulkan, but is slow and not recommended. It is a flag of its own, no longer an option of `--usecuda`.
### What is MMQ?
A CUDA method for quantized matrix multiplication, on by default (**Use MMQ**). `--nommq` turns it off.
### What is the `--foreground` flag?
Windows only. **Keep Foreground** (`--foreground`) brings the console to the front for every new request, which avoids slowdowns when the window is in the background.
### What does `--multiuser` do?
It queues requests from several users, up to 10 by default. `--multiuser 0` turns the queue off, so extra requests get a "Server is busy" error. With an image, Whisper, TTS or embeddings model loaded, or with **Parallel Requests:** above 1, a queue stays on.
### What are .kcpps and .kcppt files?
A `.kcpps` file is a saved launcher configuration (**Save Config**). A `.kcppt` file is a template to share: it leaves out settings specific to your PC and can contain model download links. Load either with **Load Config** or `--config`. See [Config files](https://koboldcpp.net/docs/settings/config-files/) and [Templates](https://koboldcpp.net/docs/settings/templates/).
### Can I benchmark my PC?
Yes. **Run Benchmark** on the **Hardware** tab, or `--benchmark`. With a file name, `--benchmark results.csv` appends the results to that file.
## Features
### Which interfaces are included?
| Address | Interface |
| ----------- | ------------------------------------------------ |
| `/` | KoboldAI Lite |
| `/lcpp/` | llama.cpp web UI |
| `/sdui` | StableUI (generating needs an image model) |
| `/musicui` | Music UI (generating needs a music or TTS model) |
| `/noscript` | UI without JavaScript |
| `/api` | API documentation |
See [KoboldAI Lite](https://koboldcpp.net/docs/features/lite/).
### Can it generate images?
Yes. Load an image model on the **Image Gen** tab or with `--sdmodel` (`.safetensors` or `.gguf`). Some model families need extra files. See [Image generation](https://koboldcpp.net/docs/features/image-generation/).
### What else can it do?
| Feature | Flag | Page |
| ------------------------ | -------------------------- | -------------------------------------------------------- |
| Speech to text (Whisper) | `--whispermodel` | [Speech to text](https://koboldcpp.net/docs/features/speech-to-text/) |
| Text to speech | `--ttsmodel` | [Text to speech](https://koboldcpp.net/docs/features/text-to-speech/) |
| Music | `--musicllm` and others | [Music](https://koboldcpp.net/docs/features/music/) |
| Vision and audio input | `--mmproj` | [Vision](https://koboldcpp.net/docs/features/vision/) |
| Embeddings | `--embeddingsmodel` | [Embeddings](https://koboldcpp.net/docs/features/embeddings/) |
| Web search, MCP tools | `--websearch`, `--mcpfile` | [Web search and MCP](https://koboldcpp.net/docs/features/web-search-and-mcp/) |
### Can I switch models without restarting?
Yes, with admin mode: **Enable Model Administration** (`--admin`) with a folder of configs (`--admindir`). Router mode (`--routermode`) switches by the model name in each request, autoswap mode (`--autoswapmode`) by request type, and `--adminunloadtimeout` unloads the model when idle. Set an admin password (`--adminpassword`) when you enable admin mode. See [Admin mode](https://koboldcpp.net/docs/settings/admin-mode/).
### What is the KoboldCpp Agent?
A coding agent for the terminal, new in v1.122. Start it with **Launch KoboldCpp Agent** on the **Admin** tab or `--agent`. It needs a context of at least 28672 tokens, which KoboldCpp sets automatically; 12 GB of VRAM or more is recommended. See [Agent](https://koboldcpp.net/docs/features/agent/).
### Can I chat in the terminal?
Yes. `--cli` starts an interactive chat in the terminal without a web server. `--prompt "your text"` runs one prompt, prints the reply and exits.
### Can I see what's inside a model file?
Yes. `--analyze mymodel.gguf`, or **Analyze Model** on the **Extra** tab, prints the metadata and tensors of a GGUF or safetensors file.
### Can I share my model on AI Horde?
Yes, with the built-in Horde worker on the **Horde Worker** tab. See [Horde worker](https://koboldcpp.net/docs/features/horde-worker/).
### Which old flags no longer work?
| Flag | Status |
| -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `--useclblast` | Removed (CLBlast was replaced by Vulkan); KoboldCpp exits with `unrecognized arguments`. Use `--usevulkan` |
| `--usemirostat`, `--unbantokens`, `--stream`, `--psutil_set_threads` | Removed; KoboldCpp exits with `unrecognized arguments` |
| `--flashattention`, `--useswa`, `--nommap` | Accepted, but do nothing; both features are on by default, mmap is off |
| `--noblas` | Still works, same as `--usecpu` |
| `--sdt5xxl`, `--sdvaecpu`, `--sdclipgpu` | Deprecated; use `--sdllm`, `--sdvaedevice`, `--sdclipdevice` |
Full list: [Deprecated flags](https://koboldcpp.net/docs/reference/deprecated-flags/).
## API
### Is there an OpenAI-compatible API?
Yes, at `http://localhost:5001/v1`. KoboldCpp also speaks the KoboldAI API (`/api`), and emulates the Ollama, Anthropic, A1111/Forge and ComfyUI APIs. See [API overview](https://koboldcpp.net/docs/api/overview/).
### How do I connect SillyTavern or another app?
Point the app at `http://localhost:5001` for the KoboldAI API, or `http://localhost:5001/v1` for the OpenAI API. See [Connect apps](https://koboldcpp.net/docs/api/connect-apps/).
### How do I control the reply length over the API?
Send `max_tokens` (OpenAI) or `max_length` (KoboldAI) in the request. If an app sends none, KoboldCpp uses **Default Gen Amt:** (`--defaultgenamt`, 2048, at most half the context).
### Does it support streaming?
Yes. KoboldAI Lite streams replies by default (SSE). Over the API, the KoboldAI API streams at `/api/extra/generate/stream`, the OpenAI and Anthropic endpoints with `"stream": true`, and the Ollama endpoints by default. See [Streaming](https://koboldcpp.net/docs/api/streaming/).
### How do I use KoboldCpp from another device?
* Same network: open `http://:5001` on the other device.
* Over the internet: turn on **Remote Tunnel** (`--remotetunnel`) for a public `trycloudflare.com` link.
Set a password first. See [Remote access](https://koboldcpp.net/docs/api/remote-access/).
### How do I secure a public instance?
* Set a password (**Password:**, `--password`). Image generation and the `/tts_to_audio` endpoint are not password-protected, so anyone who can reach the server can use them. On shared servers, limit image generation with `--sdclamped`.
* With admin mode on, set `--adminpassword`.
* Limit requests with `--maxrequestsize`, `--ratelimit` and `--genlimit`.
See [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/).
# KoboldCpp Agent
> The coding agent bundled with KoboldCpp. It reads and edits files and runs commands in a terminal. Setup, safety, commands and options.
KoboldCpp includes a small terminal agent, similar to OpenCode or Claude Code. You give it a task, and it uses tools to read and edit files, run shell commands and fetch web pages. It talks to KoboldCpp's OpenAI-compatible API.
At least 12 GB of VRAM is recommended.
Caution
The agent can change files and run commands on your computer. By default it asks before every tool call except `ask_user`. Keep it that way until you trust the model with your files. The agent works in the folder KoboldCpp was started from; change it with `/workdir`.
## Quick start
1. With 24 GB of VRAM or more, click **Get Help** in the launcher, choose **Newbie Templates**, pick `HighSpec-CodingAgent` and click **Load Template**. With less, load your own model on the **Quick Launch** tab; it needs room for a context of 28672 (see below).
2. On the **Admin** tab, tick **Launch KoboldCpp Agent**.
3. Click **Launch**. When the model has loaded, the agent opens in a new terminal window.
4. Type a task and press Enter. Approve or reject each tool call.
On the command line:
Terminal
```sh
koboldcpp --model mymodel.gguf --agent
```
Add `--cli` to run the agent in the same terminal instead of a new window.
## Settings KoboldCpp changes for the agent
When the agent is on, KoboldCpp adjusts these settings at launch and prints a warning listing them:
| Setting | Changed to |
| ------------------------------------ | -------------- |
| Context size | at least 28672 |
| Default generation amount | at least 8192 |
| **Use Jinja** (`--jinja`) | on |
| **Jinja for Tools** (`--jinjatools`) | on |
The larger context needs more memory. See [Context size](https://koboldcpp.net/docs/settings/context-size/).
## Tools
| Tool | What it does |
| ----------------------- | ------------------------------------- |
| `read`, `write`, `edit` | Read, create and change files. |
| `shell` | Run a shell command. |
| `glob`, `grep` | Find files and search their contents. |
| `web_fetch` | Download a web page. |
| `view_image` | Look at an image file. |
| `ask_user` | Ask you a question. |
If KoboldCpp has [MCP servers](https://koboldcpp.net/docs/features/web-search-and-mcp/) loaded, the agent adds their tools too. MCP tools run on the KoboldCpp server; the built-in tools run where the agent runs.
If the working folder has an `AGENTS.md` file, the agent reads it as project instructions.
## Commands
Type these at the agent prompt:
| Command | What it does |
| --------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `/help` | List all commands. |
| `/confirm on` | Ask before every tool call except `ask_user` (default). |
| `/confirm off` | Run all tool calls without asking. |
| `/confirm auto` | Ask only when the agent's own review does not approve the call. |
| `/tools` | List the tools. `/tools NAME on` or `/tools NAME off` turns one on or off and clears the conversation. |
| `/workdir PATH` | Change the working folder. Clears the conversation. |
| `/compact` | Summarize the conversation to free context. |
| `/clear` | Start over. |
| `/reasoning on`, `/reasoning off` | Show or hide the model's reasoning. |
| `/verbose on`, `/verbose off` | Show or hide full tool arguments and results. |
| `/connect` | Switch to another endpoint, API key or model. |
| `/exit` or `/quit` | Stop the agent. |
## Other backends
The agent works with any OpenAI-compatible API. `koboldcpp --agent` with no other arguments opens only the agent, without starting a server. It connects to `http://127.0.0.1:5001/v1`, or to the URL in the `OPENAI_BASE_URL` environment variable. Use `/connect` to change the endpoint.
## Advanced: agent options
When you run `kcpp_agent.py` from a source checkout, it takes these options:
| Option | Default |
| ------------------- | ------------------------------------------------ |
| `--base-url` | `OPENAI_BASE_URL`, or `http://127.0.0.1:5001/v1` |
| `--api-key` | `OPENAI_API_KEY`, or `local` |
| `--model` | `OPENAI_MODEL`, or `local-model` |
| `--temperature` | `0.4` |
| `--max-tokens` | not set |
| `--request-timeout` | `600` seconds |
| `--confirmation` | `on` (also `off`, `auto`) |
| `--no-color` | off |
On Linux, KoboldCpp opens the agent in the first terminal it finds: x-terminal-emulator, gnome-terminal, konsole, mate-terminal, xfce4-terminal or xterm. Without any of them, use `--cli`.
## Related
* [Web search and MCP tools](https://koboldcpp.net/docs/features/web-search-and-mcp/)
* [Connect other apps](https://koboldcpp.net/docs/api/connect-apps/)
# Embeddings
> Serve an embeddings model from KoboldCpp for search and RAG apps, through the OpenAI, Ollama and KoboldCpp embeddings endpoints.
An embeddings model turns text into a list of numbers (a vector). Apps use these vectors to find text with similar meaning, for example for document search and RAG. KoboldCpp serves an embeddings model next to the text model.
You need this if an app asks for an embeddings endpoint, or to use **KoboldCpp Embeddings** in Lite's TextDB (**Context** > **TextDB**). Normal chatting in KoboldAI Lite does not need it.
## Quick start
Started with a `Chatbot` newbie template? It already loads an embeddings model. Skip to step 4.
1. Download an embeddings model as a `.gguf` file. A good first pick is [bge-m3-q8\_0.gguf](https://huggingface.co/ggml-org/bge-m3-Q8_0-GGUF/resolve/main/bge-m3-q8_0.gguf), the one the `LowSpec-Chatbot` template uses.
2. In the launcher, open the **Loaded Files** tab and select the file in **Embeds Model:**.
3. Click **Launch**.
4. In your app, set the embeddings endpoint to `http://localhost:5001/v1` (OpenAI-compatible).
On the command line:
Terminal
```sh
koboldcpp --model mymodel.gguf --embeddingsmodel embeddings-model.gguf
```
## API
| Endpoint | Format |
| ---------------------------- | ----------------------------------------------- |
| `POST /v1/embeddings` | OpenAI. Supports `"encoding_format": "base64"`. |
| `POST /api/embed` | Ollama |
| `POST /api/extra/embeddings` | KoboldCpp |
With `--password` set, these endpoints need the password.
## Advanced options
| Launcher field | Flag | What it does |
| ----------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **ECtx:** | `--embeddingsmaxctx` | Maximum input length in tokens. Default `4096`, never more than the model was trained for. `0` uses the text model's context size. A negative value uses the model's trained context. |
| **GPU** (next to **Embeds Model:**) | `--embeddingsgpu` | Puts the embeddings model on the GPU. Usually not needed. |
An empty **ECtx:** field in the launcher saves as `0`.
With bge-m3 on a PC with an RTX 3090, **GPU** embedded 32 texts of about 340 tokens in 0.69 s instead of 1.3 s on the CPU, and used about 300 MiB more VRAM.
## Related
* [Connect other apps](https://koboldcpp.net/docs/api/connect-apps/)
* [API endpoints](https://koboldcpp.net/docs/api/endpoints/)
# AI Horde worker
> Share your model with the AI Horde, a volunteer network. How to set up the built-in Horde worker in KoboldCpp and what the options do.
The [AI Horde](https://aihorde.net) is a volunteer network: people run models on their own computers and others use them over the internet. KoboldCpp has a built-in worker, so you can share your text model with the Horde while you run it.
The worker only takes Horde jobs while you are not using the model yourself: it waits until there has been no local request for 20 seconds.
## Set it up
You need an AI Horde API key. Register at [aihorde.net/register](https://aihorde.net/register) to get one.
1. Load your text model as usual.
2. In the launcher, open the **Horde Worker** tab and tick **Configure for Horde**.
3. Enter your key in **API Key (If Embedded Worker):** and a name for your worker in **Horde Worker Name:**.
4. Click **Launch**.
On the command line:
Terminal
```sh
koboldcpp --model mymodel.gguf --hordekey YOUR_KEY --hordeworkername my-worker
```
Both the key and the worker name are required. With only the key, KoboldCpp prints "Horde worker could not start. You need to specify a horde worker name with --hordeworkername".
With a Horde worker, KoboldCpp switches to quiet mode automatically.
Caution
**Save Config** stores your Horde API key in plain text in the `.kcpps` file. Do not share that file. Templates (`.kcppt`) leave the key and worker name out.
## Options
| Launcher field | Flag | What it does |
| --------------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------- |
| **Horde Model Name:** | `--hordemodelname` | The model name shown on the Horde. Empty means the file name. KoboldCpp adds `koboldcpp/` in front. |
| **Gen. Length:** | `--hordegenlen` | Most tokens your worker generates per Horde job. Default `1024`. |
| **Max Context:** | `--hordemaxctx` | Largest context your worker accepts from a Horde job. `0` means your context size; it cannot go higher. |
| **API Key (If Embedded Worker):** | `--hordekey` | Your AI Horde API key. |
| **Horde Worker Name:** | `--hordeworkername` | Your worker's name on the Horde. |
## Advanced
* These three settings are not Horde-only. **Horde Model Name:** also renames the model in `/api/v1/model` and `/v1/models`. **Gen. Length:** and **Max Context:** are also what `/api/v1/config/max_length` and `/api/v1/config/max_context_length` report to other apps.
* With `--parallelrequests N`, KoboldCpp starts N workers under the same name.
* After repeated errors, the worker pauses for growing periods, and stops after too many.
* If the worker fails with certificate (SSL) errors, `--nocertify` turns off certificate checks for all outgoing connections. This is insecure: whoever intercepts the connection can read your Horde API key. Use it only as a last resort.
## Related
* [KoboldAI Lite](https://koboldcpp.net/docs/features/lite/): Lite can also use models from the AI Horde.
* [Config files](https://koboldcpp.net/docs/settings/config-files/)
# Image and video generation
> Generate and edit images, and videos, with KoboldCpp. Which model files you need, how to load them, and how to use StableUI, Lite and the image APIs.
KoboldCpp generates and edits images with a bundled copy of stable-diffusion.cpp. It also generates videos with some model families. Image generation runs next to the text model, or on its own.
## Quick start
1. Download an image model. A good first pick is [PicX Real](https://huggingface.co/koboldcpp/imgmodel/resolve/main/picx_real_q8_0.gguf).
2. In the launcher, open the **Image Gen** tab and select the file in **Image Model:**.
3. Click **Launch**.
4. Open `http://localhost:5001/sdui` for StableUI, the bundled image interface.
A template is the other way in: click **Get Help**, choose **Newbie Templates**, and pick `LowSpec-ImageGen` or `MidSpec-ImageGen`. KoboldCpp downloads the files at launch.
On the command line:
Terminal
```sh
koboldcpp --sdmodel picx_real_q8_0.gguf
```
Add `--model` with a text model if you want to chat as well.
## Using it
* **StableUI** (`/sdui`): prompts, settings and a LoRA picker. It has a recovery mode for poor connections.
* **KoboldAI Lite**: open **Settings** > **Media** and set **Image Backend** to **KCPP / Forge / A1111**. Then use **Add File** > **Generate Image**, or turn on **Autogenerate images**.
* **Other apps**: KoboldCpp speaks the A1111/Forge API, the OpenAI images API and a ComfyUI-compatible API. Point apps such as SillyTavern at `http://localhost:5001`.
| API | Endpoints |
| ------------- | ------------------------------------------------------------------ |
| A1111 / Forge | `POST /sdapi/v1/txt2img`, `/sdapi/v1/img2img`, `/sdapi/v1/upscale` |
| OpenAI | `POST /v1/images/generations`, `/v1/images/edits` |
| ComfyUI | `POST /prompt`, `/upload/image`; `GET /view`, `/history` |
Videos use the same endpoints. See [API endpoints](https://koboldcpp.net/docs/api/endpoints/).
Caution
The password (`--password`) does not protect the image endpoints. Anyone who can reach your KoboldCpp can generate images. On a shared or public server, limit the image size with **Clamp Resolution (Hard):** (`--sdclamped`). See [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/).
## Supported models
Models come as `.safetensors` or `.gguf` files.
| Kind | Families |
| ------ | ------------------------------------------------------------------------ |
| Images | Stable Diffusion 1.5, SDXL, SD3, Flux, Qwen Image, Z-Image, Klein, Krea2 |
| Video | WAN 2.2, LTX2.3, Minimax H3 |
Recent releases also added SDXS (small and fast, usable on a CPU), Microsoft Lens, HiDream o1, LongCat, Ernie Image, Ideogram 4 and Boogu Edit.
Image models are on Hugging Face (search for the family name) and on CivitAI. The [popular templates](https://huggingface.co/koboldcpp/popular-templates) include ready setups, for example Z-Image Turbo and WAN 2.2.
## Models with several files
SD 1.5 and SDXL models are usually one file. Newer families such as Flux, SD3, Qwen Image and Z-Image need extra parts. Load them on the **Image Gen** tab:
| Part | Launcher field | Flag |
| --------------------------------- | ---------------- | -------------- |
| Main model (diffusion model) | **Image Model:** | `--sdmodel` |
| Text encoder or LLM (T5, Qwen, …) | **Image LLM:** | `--sdllm` |
| First CLIP model (Clip-L) | **Clip-1 File:** | `--sdclip1` |
| Second CLIP model (Clip-G) | **Clip-2 File:** | `--sdclip2` |
| VAE | **Image VAE:** | `--sdvae` |
| Audio VAE (LTX2.3 video only) | **Audio VAE:** | `--sdaudiovae` |
Leave a field empty if the model already contains that part. A template for the model fills in all fields for you.
## LoRAs
* **Fixed LoRAs:** list the files in **Image LoRAs:** (`--sdlora`), with their strength in **Multiplier:** (`--sdloramult`). They apply to every image.
* **Runtime LoRAs:** tick **Runtime LoRAs** and pick a folder in **LoRA Dir:** (`--sdlora `). KoboldCpp scans the folder and one level of subfolders. You choose LoRAs per image in StableUI, or with `` in the prompt.
## Saving memory
| Launcher field | Flag | Effect |
| -------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Compress Weights:** | `--sdquant` | Loads the model compressed to q8 (`1`) or q4 (`2`). A model downloaded pre-quantized loads faster. Cannot be combined with `--sdlora` on the command line. |
| **Automatic VAE (TAE SD)** | `--sdvaeauto` | Uses a tiny built-in VAE. Faster and uses less memory, but image quality can drop. May fix a bad VAE. Not available for every model type. |
| **Model Offload** | `--sdoffloadcpu` | Keeps image weights in RAM and moves them to VRAM when needed. |
| **VRAM Limiter (MB):** | `--sdvramlimit` | Limits how much VRAM image generation plans for. Actual use can go somewhat higher. `0` means no limit. |
| **VAE Tiling Threshold:** | `--sdtiledvae` | Decodes images in tiles when they have more pixels than this size squared (default `512`: above 512×512 pixels). `0` turns tiling off. |
The image templates turn on **Model Offload** and keep the text encoder on the CPU. Measured on an RTX 3090 with FLUX.2 klein at 4 steps:
| Setup | Peak VRAM | One 1024×1024 image |
| ----------------------------------------------------- | --------- | ------------------- |
| `LowSpec-ImageGen` (FLUX.2 klein 4B) | 3858 MiB | 14.2 s |
| `LowSpec-ImageGen`, **Model Offload** off | 4514 MiB | 13.9 s |
| `LowSpec-ImageGen`, VAE tiling off (`--sdtiledvae 0`) | 7584 MiB | 11.8 s |
| `MidSpec-ImageGen` (FLUX.2 klein 9B) | 7238 MiB | 22.8 s |
## Advanced options
| Launcher field | Flag | What it does |
| -------------------------------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| **Clamp Resolution (Hard):** | `--sdclamped [px]` | Limits the longest image side, keeping the aspect ratio. Without a value it means 512. |
| **(Soft):**, next to Clamp Resolution (Hard) | `--sdclampedsoft px` | Limits the image area (e.g. 640 allows 640x640, 512x768, 768x512). At `0` a default applies: 832 for SD 1.x/2.x, 1024 for others. Maximum 2048. |
| **Upscaler:** | `--sdupscaler` | Loads an ESRGAN upscaler for `/sdapi/v1/upscale`. |
| **PhotoMaker:** | `--sdphotomaker` | Face cloning for SDXL models. |
| **SD Flash Attention** | `--sdflashattention` | Flash attention for image generation. Separate from the text model's setting. |
| **Conv2D Direct:** | `--sdconvdirect` | `off` (default), `vaeonly` or `full`. May speed things up or save memory. Can crash on backends that don't support it. |
| **ImgThreads:** | `--sdthreads` | CPU threads for images. `0` uses the text model's thread count. |
| **ImgGPU:** | `--sdmaingpu` | GPU for the image weights. |
| **CLIP dev:** | `--sdclipdevice` | Device for the text encoders. Default: CPU. |
| **VAE dev:** | `--sdvaedevice` | Device for the VAE. Default: the main GPU. |
Every flag is listed in the [flag reference](https://koboldcpp.net/docs/reference/flags/). Older guides use `--sdt5xxl`, `--sdvaecpu` and `--sdclipgpu`; their replacements are `--sdllm`, `--sdvaedevice` and `--sdclipdevice`.
## Related
* [Vision](https://koboldcpp.net/docs/features/vision/): let the text model look at images.
* [Saving VRAM](https://koboldcpp.net/docs/hardware/saving-vram/)
* [API endpoints](https://koboldcpp.net/docs/api/endpoints/)
# KoboldAI Lite: the built-in web UI
> KoboldAI Lite is the web interface built into KoboldCpp. Its modes, UI styles, where the settings and samplers are, and the other bundled UIs.
KoboldAI Lite is the web interface built into KoboldCpp. After you click **Launch**, it opens at `http://localhost:5001`. You need nothing else to chat, write stories or play text adventures.
## Start chatting
1. Launch KoboldCpp with a model. With **Launch Browser** ticked (the default in the launcher), Lite opens by itself. Otherwise, open `http://localhost:5001`.
2. Type into the input box at the bottom and send.
3. To change how Lite behaves, click **Settings** in the top menu.
## Modes
Pick the mode in **Settings** > **General** > **Usage mode**.
| Mode | Use it for |
| ------------------ | -------------------------------------------------------------- |
| **Instruct Mode** | Giving the AI tasks, ChatGPT-style. |
| **Chat Mode** | Conversations with a character. |
| **Story Mode** | Novel-style writing, where you and the AI write the same text. |
| **Adventure Mode** | Interactive fiction and text RPGs. |
## UI styles
Next to the mode, **UI style** changes how the text is shown. Some styles are only available in some modes.
| Style | Look |
| ------------------- | ------------------------------------------------------------------ |
| **Classic Theme** | Plain text editor, for writing. |
| **Messenger Theme** | Chat bubbles. |
| **Aesthetic Theme** | Roleplay layout. The button next to it opens more display options. |
| **Corpo Theme** | Assistant-style layout. |
## Where the settings are
The launcher decides what the server can do: which model, how much context memory is reserved, which features are loaded. Lite decides what it sends with each request.
**Settings** has these tabs:
| Tab | What you find there |
| ------------ | --------------------------------------------------------------------------------------------- |
| **General** | Usage mode, UI style, your name and the AI's name. |
| **GUI** | Appearance. |
| **Samplers** | **Sampler Preset**, **Context Size**, **Max Output**, **Temperature** and the other samplers. |
| **Media** | Image generation, text-to-speech (**Audio Output**) and voice input (**Audio Input**). |
| **Tokens** | Token settings. |
| **Tools** | MCP tool calling and web search. |
| **Misc** | Save/load, advanced and experimental settings. |
**Context Size** in Lite covers the text Lite sends plus the reply (**Max Output**). The server cuts it down to the context it reserved at launch. If the server reserved 16384 or more, Lite raises its own value to match. A value you lowered yourself stays until the server's context changes. See [Context size](https://koboldcpp.net/docs/settings/context-size/).
The other top menu items:
* **New Session** starts over.
* **Scenarios** loads ready-made stories and characters.
* **Save / Load** saves and loads your story as a JSON file.
* **Context** (above the input box) holds memory, world info and the author's note.
* **Add File** (above the input box) adds images or audio, or generates an image.
## Other bundled interfaces
| Address | Interface | Available when |
| ----------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| `/` | KoboldAI Lite | Always. |
| `/sdui` | StableUI, for images | Always. Generating images needs an image model. See [Image generation](https://koboldcpp.net/docs/features/image-generation/). |
| `/musicui` | MusicUI, for music and speech | Always. Generating needs a music or TTS model. See [Music](https://koboldcpp.net/docs/features/music/). |
| `/lcpp/` | The llama.cpp web UI | Always. It can connect to MCP servers. |
| `/noscript` | A plain page without JavaScript, with story, chat and image modes | Always. For old or restricted browsers. |
| `/api` | The API documentation | Always. |
If you load only an image model, Lite offers to open StableUI. If you load only a music or TTS model, it offers MusicUI.
## Lite without KoboldCpp
Lite also runs at [lite.koboldai.net](https://lite.koboldai.net). That copy can connect to your KoboldCpp, to the AI Horde, or to online AI services.
To use the bundled Lite without a local model, tick **Allow Launch Without Models** on the **Loaded Files** tab (`--nomodel`). Lite then asks whether to connect to an external service.
## Advanced
* **TextDB** (**Context** > **TextDB**) is Lite's document lookup (RAG). **Local TextDB** searches in the browser. **KoboldCpp Embeddings** uses the loaded [embeddings model](https://koboldcpp.net/docs/features/embeddings/).
* Lite loads Tavern character cards, and imports SillyTavern chat exports (JSONL) and several other save formats.
* In **Settings** > **Samplers**, **Sampler Preset** switches between curated sampler sets.
## Related
* [Chat in your browser](https://koboldcpp.net/getting-started/chat/)
* [Context size](https://koboldcpp.net/docs/settings/context-size/)
* [Multiplayer and server saves](https://koboldcpp.net/docs/features/multiplayer-and-saves/)
* [Connect other apps](https://koboldcpp.net/docs/api/connect-apps/)
# Multiplayer and server saves
> Share one story with several people in KoboldAI Lite, keep saves on the server instead of in the browser, and preload a story for everyone.
KoboldAI Lite normally keeps your story in your browser. Three server features change that:
* **Multiplayer:** several people work on one shared story.
* **Server saves:** save slots on the KoboldCpp computer, shared by everyone who can connect.
* **Preloaded story:** a story that KoboldCpp offers to everyone who connects.
## Multiplayer
1. In the launcher, open the **Network** tab and tick **Shared Multiplayer** (`--multiplayer`).
2. Make KoboldCpp reachable for the others: same network, or **Remote Tunnel**. See [Remote access](https://koboldcpp.net/docs/api/remote-access/).
3. Set a **Password:** on the **Network** tab before you share the address.
4. Click **Launch**.
5. Give everyone the address and the password. They open KoboldAI Lite at your address, enter the password in the **API Key Required** box, and click **Join Multiplayer** in the top menu. **Exit Multiplayer** leaves the session.
The multiplayer endpoints need the password when one is set.
## Server saves
1. In the launcher, open the **Loaded Files** tab, tick **Enable Server Side SaveData File** and choose a file in **SaveData File:** (`--savedatafile`).
2. Click **Launch**.
3. In KoboldAI Lite, open **Save / Load** and choose **KoboldCpp Server Storage** as the location. The slots appear as **Server Slot 1**, **Server Slot 2** and so on.
* There are 12 slots. Each story can be up to 10 MB.
* KoboldCpp adds `.jsondb` to the file name: `--savedatafile saves` creates `saves.jsondb`. A missing file is created, including its folders.
* The slots are not private. Anyone who can connect can load, overwrite or delete them. The save endpoints need the password when one is set.
* Back up the `.jsondb` file to keep your saves. KoboldCpp rewrites the whole file on every save.
## Preloaded story
**Preload Story:** on the **Loaded Files** tab (`--preloadstory`) takes a story saved from Lite as JSON. KoboldCpp serves it to frontends such as Lite.
When you export a template (`.kcppt`) from the launcher, the preloaded story is embedded in the template.
## API
| Endpoint | Needs |
| ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
| `POST /api/extra/multiplayer/status`, `/api/extra/multiplayer/getstory`, `/api/extra/multiplayer/setstory` | `--multiplayer` |
| `POST /api/extra/data/list`, `/api/extra/data/load`, `/api/extra/data/save` | `--savedatafile` |
| `GET /api/extra/preloadstory` | `--preloadstory`. Returns `{}` when none is set. |
Without `--savedatafile`, `/api/extra/data/list` and `/api/extra/data/load` close the connection without an answer. `/api/extra/data/save` returns HTTP 400.
## Related
* [KoboldAI Lite](https://koboldcpp.net/docs/features/lite/)
* [Remote access](https://koboldcpp.net/docs/api/remote-access/)
* [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/)
# Music Generation
> Generate songs with ACE-Step in KoboldCpp. The four model files, the LowSpec-MusicGen template, MusicUI and the music API.
KoboldCpp generates music with ACE-Step 1.5 and ACE-Step XL. You describe a song, and it generates the audio.
## Quick start
Music needs three model files, plus an optional fourth. A template downloads them for you.
1. In the launcher, click **Get Help**.
2. Choose **Newbie Templates**, pick `LowSpec-MusicGen` and click **Load Template**.
3. Click **Launch**. KoboldCpp downloads the files.
4. Open `http://localhost:5001/musicui`.
## The model files
Download the files from [huggingface.co/koboldcpp/music](https://huggingface.co/koboldcpp/music) and load them on the **Audio** tab:
| File | Launcher field | Flag | Required |
| ----------------------------------------------- | ------------------ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Music LLM, e.g. `acestep-5Hz-lm` | **MusicLLM:** | `--musicllm` | No. Without it, choose **Main LLM** as **Lyrics Planner** in MusicUI to plan the song with the loaded text model. `/api/extra/music/prepare` needs it. |
| Embedding model, e.g. `Qwen3-Embedding-0.6B` | **MusicEmbeds:** | `--musicembeddings` | Yes |
| Diffusion model (DiT), e.g. `acestep-v15-turbo` | **MusicDiffuser:** | `--musicdiffusion` | Yes |
| VAE | **MusicVAE:** | `--musicvae` | Yes |
The diffusion model does not load without the embedding model and the VAE. KoboldCpp stops with "Invalid config: Music Diffusion requires Music embedding and Music VAE models!".
On the command line:
Terminal
```sh
koboldcpp --musicllm music-lm.gguf --musicembeddings music-embed.gguf --musicdiffusion music-dit.gguf --musicvae music-vae.gguf
```
## Using it
* **MusicUI** (`/musicui`) is the bundled interface for music and speech. It supports reference audio uploads and MP3 output. It also has a TTS tab.
* **KoboldAI Lite:** **Add File** > **Launch MusicUI**.
* **API:** the endpoints below.
| Endpoint | Returns |
| -------------------------------- | ----------------------------------------------------------------------------------------------- |
| `POST /api/extra/music/prepare` | JSON with the song plan (metadata and lyrics). Add `"gen_codes": true` to also get audio codes. |
| `POST /api/extra/music/generate` | WAV or MP3 audio |
The API works in two steps:
1. Send `caption` (a description of the song), `lyrics` and `duration` (in seconds) to `/api/extra/music/prepare`. The plan you get back contains the rewritten caption, the lyrics, `bpm`, `duration`, `keyscale`, `timesignature`, `vocal_language`, `seed` and further generation settings.
2. Send that plan to `/api/extra/music/generate`. It returns the audio.
With `--password` set, both endpoints need the password.
## Advanced options
| Launcher field | Flag | What it does |
| ------------------ | ---------------- | --------------------------------------------------------------------------- |
| **Music Low VRAM** | `--musiclowvram` | Keeps the music models out of VRAM when idle and swaps them in when needed. |
`LowSpec-MusicGen` turns **Music Low VRAM** on. Measured with that template on an RTX 3090 and a 10-second instrumental:
| **Music Low VRAM** | Peak VRAM | Prepare + generate |
| --------------------- | --------- | ------------------ |
| On (template default) | 5644 MiB | 6.1 s + 11.1 s |
| Off | 11330 MiB | 0.8 s + 2.1 s |
With only **MusicLLM:** set and no other music file, KoboldCpp loads the music LLM alone. It can then only plan songs: `/api/extra/music/prepare` works, but `/api/extra/music/generate` returns an empty response instead of audio.
## Related
* [Text-to-speech](https://koboldcpp.net/docs/features/text-to-speech/)
* [API endpoints](https://koboldcpp.net/docs/api/endpoints/)
# Speech-to-text with Whisper
> Turn speech into text with a Whisper model in KoboldCpp. Where to get the model, how to load it, voice input in Lite, and the transcription API.
KoboldCpp turns spoken audio into text with Whisper. You can talk to the AI in KoboldAI Lite, or send audio files to the transcription API.
## Quick start
Started with a `Chatbot` newbie template? It already loads a Whisper model. Skip to step 4.
1. Download a Whisper model (`.bin` file) from [huggingface.co/koboldcpp/whisper](https://huggingface.co/koboldcpp/whisper/tree/main). A good first pick is [whisper-base.en-q5\_1.bin](https://huggingface.co/koboldcpp/whisper/resolve/main/whisper-base.en-q5_1.bin), the one the `LowSpec-Chatbot` template uses.
2. In the launcher, open the **Audio** tab and select the file in **Whisper Model (Speech-To-Text):**.
3. Click **Launch**.
4. In KoboldAI Lite, open **Settings** > **Media** and set **Voice Input** under **Audio Input**.
On the command line:
Terminal
```sh
koboldcpp --model mymodel.gguf --whispermodel whisper-model.bin
```
## Voice input in Lite
**Settings** > **Media** > **Audio Input** > **Voice Input** has these modes:
| Mode | How it works |
| ------------------ | ----------------------------------------------- |
| **Detect Voice** | Hands-free: Lite detects when you speak. |
| **Push-To-Talk** | Lite records while you hold the voice button. |
| **Toggle-To-Talk** | The voice button switches recording on and off. |
The same section has **Suppress Non-Speech**, **Language** and **Delay**. The **Add File** menu also has a **Microphone** option.
Browsers allow the microphone only on HTTPS or on the PC itself (`localhost`). From another device, use the **Remote Tunnel** link or [HTTPS](https://koboldcpp.net/docs/api/passwords-and-security/#https-ssl).
## Audio formats
Whisper in KoboldCpp reads **WAV**, **MP3** and **FLAC**. Convert other formats, such as WebM or OGG, before you send them. Some apps send WebM by default.
## API
| Endpoint | Format |
| ------------------------------- | --------- |
| `POST /api/extra/transcribe` | KoboldCpp |
| `POST /v1/audio/transcriptions` | OpenAI |
Send the audio as base64 in `audio_data`, or as a multipart `file` upload. The answer is `{"text": "..."}`.
Optional fields:
| Field | Meaning |
| -------------------------- | ----------------------------------- |
| `language` (or `langcode`) | Language code. Default `auto`. |
| `prompt` | Text that guides the transcription. |
| `suppress_non_speech` | Ignore sounds that are not speech. |
A multipart upload reads only `language` and `prompt`. Use JSON for `langcode` and `suppress_non_speech`.
With `--password` set, these endpoints need the password.
## Without a Whisper model
If no Whisper model is loaded but the text model has an audio-capable mmproj, KoboldCpp transcribes with the text model instead. See [Vision and audio input](https://koboldcpp.net/docs/features/vision/).
## Related
* [Text-to-speech](https://koboldcpp.net/docs/features/text-to-speech/)
* [API endpoints](https://koboldcpp.net/docs/api/endpoints/)
# Text-to-speech (TTS)
> Let KoboldCpp read text aloud with Qwen3TTS, Kokoro, OuteTTS and other voice models. Loading, narration in Lite, voice cloning and the speech API.
KoboldCpp turns text into spoken audio. KoboldAI Lite can narrate the AI's replies, and apps can use the speech API.
## Quick start
Started with a `Chatbot` newbie template? It already loads a TTS model. Skip to step 4.
1. Download a TTS model (`.gguf` file) from [huggingface.co/koboldcpp/tts](https://huggingface.co/koboldcpp/tts/tree/main). A good first pick is [Kokoro\_no\_espeak\_Q4.gguf](https://huggingface.co/koboldcpp/tts/resolve/main/Kokoro_no_espeak_Q4.gguf), the one the `LowSpec-Chatbot` template uses.
2. In the launcher, open the **Audio** tab and select the file in **TTS Model (Text-To-Speech):**. Qwen3TTS and OuteTTS need a second file in **WavTokenizer Model (Required for some models):** (see below).
3. Click **Launch**.
4. In KoboldAI Lite, open **Settings** > **Media** and set **Text to speech** under **Audio Output** to **KoboldCpp TTS API**. Pick a **Voice**.
On the command line:
Terminal
```sh
koboldcpp --model mymodel.gguf --ttsmodel tts-model.gguf
```
## Supported engines
KoboldCpp reads the engine from the model file.
| Engine | Notes |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Qwen3TTS** | 0.6B and 1.7B sizes. Built-in voices, voice cloning and voice design. Needs its tokenizer file in **WavTokenizer Model (Required for some models):** (`--ttswavtokenizer`). Without it, loading fails. |
| **Kokoro** | Runs on the CPU. |
| **OuteTTS** | Needs a WavTokenizer file in **WavTokenizer Model (Required for some models):** (`--ttswavtokenizer`). Without it, loading fails. |
| **Parler**, **Dia** | Run on the CPU. |
## Voices
* **Built-in voices:** Qwen3TTS voices come with KoboldCpp. The voice list also has `random` and `instruct`.
* **Voice design (Qwen3TTS):** describe the voice in square brackets at the start of the text, for example `[A depressed woman is crying] I can't believe it.`
* **Voice cloning (Qwen3TTS):** put short `.wav` or `.mp3` recordings in a folder and select it in **TTS Voices Dir:** (`--ttsdir`). Each file becomes a voice named after the file. Only Qwen3TTS clones from these recordings, and only with a model file that includes a speaker encoder. Without one, or with a voice design description in the text, you get a normal voice instead.
## Using it
* **KoboldAI Lite:** **Settings** > **Media** > **Audio Output**. Besides the voice, you set **Narration triggered for**, **Narrate only dialog** and **Narration streaming**.
* **MusicUI** (`http://localhost:5001/musicui`) has a TTS tab.
* **Other apps:** use the OpenAI speech API or the XTTS API.
| Endpoint | Format |
| ---------------------------------------- | ----------- |
| `POST /api/extra/tts` | KoboldCpp |
| `POST /v1/audio/speech` | OpenAI |
| `POST /tts_to_audio` | XTTS |
| `GET /v1/audio/voices`, `/speakers_list` | Voice lists |
The audio comes back as WAV. Set `"response_format": "mp3"` for MP3. Qwen3TTS speaks several languages. Set `"language"` in the request on any of the endpoints above (default `en`).
Caution
The password (`--password`) protects `/api/extra/tts` and `/v1/audio/speech`, but not the XTTS endpoint `/tts_to_audio`. On a shared server, anyone who can reach KoboldCpp can use it. See [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/).
## Advanced options
| Launcher field | Flag | What it does |
| ------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **TTS Use GPU** | `--ttsgpu` | Runs OuteTTS and Qwen3TTS on the GPU. Kokoro, Parler and Dia always run on the CPU. |
| **TTS Threads:** | `--ttsthreads` | CPU threads for TTS. `0` uses the text model's thread count. |
| **TTS Max Tokens:** | `--ttsmaxlen` | For OuteTTS, the maximum audio tokens. For Kokoro, Parler and Dia, the maximum number of input words. Default and maximum `4096`. |
| **TTS Voices Dir:** | `--ttsdir` | Folder with voice recordings for cloning. |
## Related
* [Speech-to-text](https://koboldcpp.net/docs/features/speech-to-text/)
* [Music](https://koboldcpp.net/docs/features/music/)
* [API endpoints](https://koboldcpp.net/docs/api/endpoints/)
# Vision and audio input
> Let the text model see images and hear audio with a matching mmproj file. Where to get it, how to load it, and how to send images from Lite and the API.
A vision model can describe and answer questions about images. Some models can also listen to audio. For this, the text model needs its matching projector file, called an **mmproj**.
## Quick start
Started with a `Chatbot` newbie template? It already loads a vision model and its mmproj. Skip to step 5.
1. Use a text model that supports vision, for example [Qwen3-VL-8B](https://huggingface.co/unsloth/Qwen3-VL-8B-Instruct-GGUF/resolve/main/Qwen3-VL-8B-Instruct-Q4_K_S.gguf).
2. Download its mmproj. For Qwen3-VL-8B, that is [mmproj-BF16.gguf](https://huggingface.co/unsloth/Qwen3-VL-8B-Instruct-GGUF/resolve/main/mmproj-BF16.gguf).
3. In the launcher, open the **Loaded Files** tab and select the file in **Mmproj File:**.
4. Click **Launch**.
5. In KoboldAI Lite, click **Add File** > **Upload a File (Image / Audio)** and ask about the image.
On the command line:
Terminal
```sh
koboldcpp --model Qwen3-VL-8B-Instruct-Q4_K_S.gguf --mmproj mmproj-BF16.gguf
```
## Getting the right mmproj
An mmproj only works with the exact model it was made for, including its size: a Gemma3 12B model needs the Gemma3 12B mmproj, and a Qwen mmproj does not work with a Gemma model. The mismatch shows as `failed to load mmproj model!` or a crash while loading.
* Look on the model's Hugging Face page for a file with `mmproj` in its name.
* [huggingface.co/koboldcpp/mmproj](https://huggingface.co/koboldcpp/mmproj) collects mmproj files for many models.
The mmproj works only with GGUF text models.
## Audio input
Some mmproj files handle audio. The launcher field accepts both ("Audio or Vision mmproj"). With an audio mmproj, you can send audio clips to the model the same way as images.
If no Whisper model is loaded, KoboldCpp uses the audio mmproj for [speech-to-text](https://koboldcpp.net/docs/features/speech-to-text/) as well.
## Sending images and audio
* **KoboldAI Lite:** **Add File** offers **Upload a File (Image / Audio)**, **Camera** and **Drag Drop / Paste from Clipboard**. Images appear in the chat where you added them. From another device, **Camera** works only over HTTPS; see [Remote access](https://koboldcpp.net/docs/api/remote-access/#same-network).
* **OpenAI API** (`/v1/chat/completions`): send images as multimodal message content, as with OpenAI vision models.
* **KoboldAI API** (`/api/v1/generate`): send them in the `images` and `audio` arrays.
* **A1111 API:** `POST /sdapi/v1/interrogate` describes an image. It is not protected by `--password`.
Each request can carry up to 64 images and 64 audio clips. If you send more, only the last 64 of each are used.
To check what a running server supports, `GET /props` shows `modalities.vision` and `modalities.audio`.
## Advanced options
All on the **Loaded Files** tab:
| Launcher field | Flag | What it does |
| ------------------ | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| **Vision MaxRes:** | `--visionmaxres` | Largest image size in pixels. `512` to `2048`, default `1024`. |
| **V.Min/Max Tok:** | `--visionmintokens`, `--visionmaxtokens` | Tokens per image, for models with variable image sizes. `-1` uses the model's default. Setting only one of them sets both to that value. |
| **V.Force CPU** | `--mmprojcpu` | Runs the mmproj on the CPU instead of the GPU. |
KoboldCpp prints a warning when you combine an mmproj with a draft model or MTP.
The mmproj needs VRAM on top of the model. For Qwen3-VL-8B's `mmproj-F16.gguf`, autofit estimates it at startup: `MMProj Autofit Usage: 1105 MB`. **V.Force CPU** moves it to system RAM, and images are then processed more slowly. On a Radeon RX 7600 XT, the first reply to a 1920-pixel-wide screenshot took 16.1 s with the mmproj on the GPU and 22.9 s on the CPU.
## Related
* [Image generation](https://koboldcpp.net/docs/features/image-generation/): create images instead of reading them.
* [Speech-to-text](https://koboldcpp.net/docs/features/speech-to-text/)
# Web search and MCP tools
> Let the model search the web, and connect MCP servers so it can call tools. Setup in the launcher and in KoboldAI Lite, the mcp.json format and safety.
Two features give the model information and abilities beyond its own knowledge:
* **Web search:** KoboldCpp searches the web, and KoboldAI Lite adds the results to the prompt.
* **MCP tools:** KoboldCpp connects to MCP servers, which offer tools the model can call, such as reading files or querying services.
## Web search
1. In the launcher, open the **Network** tab and tick **Enable WebSearch** (`--websearch`).
2. Click **Launch**.
3. In KoboldAI Lite, open **Settings** > **Tools** and tick **Enable Websearch** under **KoboldCpp Classic Websearch**.
Lite then searches the web for relevant information in instruct mode. A search button above the input box turns it on and off.
How it works:
* KoboldCpp searches DuckDuckGo and uses the top 3 results.
* Queries are cut to 500 bytes.
Apps can use the endpoint directly: `POST /api/extra/websearch` with `{"q": "your query"}`. It needs the password when one is set. Without `--websearch`, it returns an empty list.
## MCP tools
MCP (Model Context Protocol) servers are small programs or web services that offer tools. KoboldCpp connects to them and offers their tools to KoboldAI Lite and other clients, which let the model call them.
Danger
A `command` MCP server is a program that runs on your computer with the same access as KoboldCpp. Only add servers you trust.
1. Write an `mcp.json` file (see below).
2. In the launcher, open the **Loaded Files** tab and select it in **MCP JSON:** (`--mcpfile`).
3. Click **Launch**.
4. In KoboldAI Lite, open **Settings** > **Tools** and tick **Enable Toolcalling** and **Include KoboldCpp MCP Bridge** under **MCP Tool Calling**.
Lite calls tools only in **Instruct Mode**. It works without **Use Jinja** (`--jinja`); KoboldCpp then uses its own universal tool calling. With **Jinja for Tools** (`--jinjatools`), the model's chat template handles tool calls instead.
Use a model that is good at tool calling, for example [Qwen3-VL-8B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct-GGUF).
### The mcp.json format
KoboldCpp reads the format from Claude Desktop (`mcpServers`) and from VS Code (`servers`). Each server is either a command that KoboldCpp starts, or a URL.
In this example, `files` gives the model read and write access to a folder named `sandbox` next to `mcp.json` (create it first). It needs [Node.js](https://nodejs.org) for `npx`. `my-web-tool` shows the URL form; replace it with a real server or remove it.
mcp.json
```json
{
"mcpServers": {
"files": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "sandbox"],
"env": {}
},
"my-web-tool": {
"url": "https://example.com/mcp",
"headers": {}
}
}
}
```
* `command` servers start in the folder that contains `mcp.json`.
* If one server fails to connect, the others still load.
* `--mcpfile` also accepts a URL to a JSON file.
### Where the tools are available
KoboldCpp serves all connected tools at `POST /mcp` (JSON-RPC: `initialize`, `tools/list`, `tools/call`). With `--password` set, `/mcp` needs the password.
* **KoboldAI Lite** uses them through **Include KoboldCpp MCP Bridge**. Lite can also connect to other MCP servers itself under **MCP Server URLs**.
* The [KoboldCpp Agent](https://koboldcpp.net/docs/features/agent/) adds them to its own tools.
* The llama.cpp web UI at `/lcpp/` has its own MCP support.
## Advanced
* `--nocertify` turns off certificate checks for all outgoing connections, not only web search. This is insecure: others can intercept or change the traffic. Use it only as a last resort if searches fail with certificate errors.
* `--mcpfile` alone counts as a model, so KoboldCpp can start with only MCP tools and no text model.
* In Lite, **Automatically Execute Tools** runs tool calls without asking first.
## Related
* [KoboldCpp Agent](https://koboldcpp.net/docs/features/agent/)
* [KoboldAI Lite](https://koboldcpp.net/docs/features/lite/)
* [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/)
# Apple Silicon
> How KoboldCpp uses Metal on M-series Macs, what GPU layers mean on macOS, and the CPU-only failsafe mode.
The Mac build, `koboldcpp-mac-arm64`, is for Apple Silicon (M-series) Macs. It uses the GPU through **Metal** automatically; there is no backend to choose. For download and first start, see [macOS](https://koboldcpp.net/docs/install/macos/).
Intel Macs have no ready-made file and must [build from source](https://koboldcpp.net/docs/install/from-source/#macos).
## GPU layers on macOS
On macOS, **GPU Layers:** `-1` (the default) puts **all** layers on the GPU. The console prints:
```text
MacOS detected: Auto GPU layers set to maximum
```
* Autofit does not switch on by itself on macOS. KoboldCpp does not check whether the model fits; pick a model and context that fit your Mac's memory. See [How much memory a model needs](https://koboldcpp.net/docs/models/memory/).
* To keep part of the model off the GPU, set **GPU Layers:** to a lower number.
* `Unable to determine GPU Memory` and `Unable to determine available RAM` in the console are expected on a Mac. When the launcher opens, it can also print `Unable to detect VRAM.`.
* On macOS, **Use CPU** (`--usecpu`) still puts all layers on the GPU. To run on the CPU only, set **GPU Layers:** to `0` (`--gpulayers 0`), or use `--failsafe`.
## Failsafe mode (CPU only)
`--failsafe` switches to a CPU-only library that uses Apple's Accelerate framework instead of Metal:
Terminal
```sh
./koboldcpp-mac-arm64 --failsafe
```
## Vision models
With Metal, the vision projectors of Qwen2-VL and Gemma 3 always run on the CPU, whatever **V.Force CPU** (`--mmprojcpu`) is set to. See [Vision](https://koboldcpp.net/docs/features/vision/).
## Related
* [macOS](https://koboldcpp.net/docs/install/macos/)
* [GPU layers](https://koboldcpp.net/docs/hardware/gpu-layers/)
* [Saving VRAM](https://koboldcpp.net/docs/hardware/saving-vram/)
# GPU backends: CUDA, Vulkan, ROCm, Metal, CPU
> CUDA, Vulkan, ROCm, Metal and CPU in KoboldCpp, which release file contains which, and how KoboldCpp picks a backend automatically.
The backend decides where the model runs: on an NVIDIA, AMD, Intel or Apple GPU, or on the processor alone. You choose it with **Backend:** on the **Quick Launch** tab, or with a flag. If you don't choose, KoboldCpp picks one for you.
| Backend | Launcher | Flag | For |
| -------------- | ---------------------- | ------------- | ---------------------------------------------------- |
| CUDA | **Use CUDA** | `--usecuda` | NVIDIA graphics cards |
| Vulkan | **Use Vulkan** | `--usevulkan` | Any graphics card with Vulkan: NVIDIA, AMD, Intel |
| ROCm (hipBLAS) | **Use hipBLAS (ROCm)** | `--usecuda` | AMD graphics cards, only in the ROCm build for Linux |
| Metal | automatic | none | Apple Silicon Macs |
| CPU | **Use CPU** | `--usecpu` | No graphics card, or to leave it unused |
The launcher's tooltip sums it up: "CUDA runs on Nvidia GPUs, and is much faster. Vulkan works on all GPUs but is somewhat slower."
On an RTX 3090 with Qwen3-VL-8B and a prompt of about 1,000 tokens, CUDA processed the prompt about 16 times as fast as Vulkan (6603 vs 414 tokens per second). Generation was closer: 82.0 vs 71.5 tokens per second.
Old-processor variants (**Use CPU (Old CPU)**, **Use Vulkan (Old CPU)**, **Use Vulkan (Older CPU)**, **Failsafe Mode (Older CPU)**) are covered in [Old PCs and CPU-only](https://koboldcpp.net/docs/hardware/old-and-cpu-only/).
## Which file has which backend
The launcher only lists the backends your file contains.
| File | CUDA | Vulkan | ROCm | Metal | CPU |
| ---------------------------------------------------- | ------- | ------ | ---- | ----- | --- |
| `koboldcpp.exe`, `koboldcpp-linux-x64` | CUDA 12 | yes | | | yes |
| `koboldcpp-nocuda.exe`, `koboldcpp-linux-x64-nocuda` | | yes | | | yes |
| `koboldcpp-oldpc.exe`, `koboldcpp-linux-x64-oldpc` | CUDA 11 | yes | | | yes |
| `koboldcpp-linux-x64-rocm` (rocm-rolling) | | yes | yes | | yes |
| `koboldcpp-mac-arm64` | | | | yes | yes |
* **NVIDIA:** the main file, with **Use CUDA**.
* **AMD:** start with **Use Vulkan** in the nocuda file. The ROCm build for Linux is very experimental.
* **Intel:** **Use Vulkan** in the nocuda file.
See [Release files and system requirements](https://koboldcpp.net/docs/install/releases/) for all files and their CPU requirements.
## Automatic selection
If you set no backend, KoboldCpp picks one at startup and prints which:
```text
Auto Selected CUDA Backend (flag=0)
```
It checks in this order:
1. **CUDA or ROCm**, if all of these are true:
* the file contains CUDA or hipBLAS;
* `nvidia-smi` (or, for AMD, `rocminfo`) finds a GPU;
* the detected VRAM is more than 3.5 GB (3,500,000,000 bytes);
* the processor has AVX2 (AVX is enough in the oldpc builds).
2. **Vulkan**, if `vulkaninfo` reports a **discrete** graphics card and the file contains Vulkan.
3. **CPU** otherwise ("Auto Selected Default Backend").
Consequences:
* **Vulkan is picked automatically only for a discrete graphics card.** To use an integrated GPU, choose **Use Vulkan** yourself.
* **NVIDIA cards with 3.5 GB of VRAM or less** are not auto-selected for CUDA; KoboldCpp falls through to Vulkan or the CPU. Choose **Use CUDA** yourself if you want it.
* **AMD on Linux:** with `vulkaninfo` installed and no `rocminfo`, the nocuda file picks Vulkan. Without `vulkaninfo`, it does not find the card and runs on the CPU (both checked with a Radeon RX 7600 XT).
* If `nvidia-smi`, `rocminfo` and `vulkaninfo` are all missing or fail, KoboldCpp prints "Unable to detect VRAM." and uses the CPU. Install your GPU driver's tools, or choose the backend yourself.
* If the processor lacks AVX2 or AVX, KoboldCpp switches to the matching old-CPU mode. See [Old PCs and CPU-only](https://koboldcpp.net/docs/hardware/old-and-cpu-only/).
* Automatic selection is skipped when you set **GPU Layers:** to `0` (`--gpulayers 0`). KoboldCpp then runs on the CPU, even with a GPU present.
* On macOS, Metal is used without this check.
The launcher makes the same choice when it opens, as long as you haven't changed **Backend:** yourself. A template (`.kcppt`) also lets KoboldCpp choose, unless you pass `--usecuda` or `--usevulkan`.
## Choosing a GPU
**GPU ID:** next to the backend selects one GPU or **All**. The name of the selected GPU is shown in yellow. IDs start at 0. On the command line, add the ID after the backend flag (`koboldcpp` stands for your KoboldCpp file; see [Command line](https://koboldcpp.net/docs/settings/command-line/)):
Terminal
```sh
koboldcpp --usecuda 0 --model mymodel.gguf
koboldcpp --usevulkan 1 --model mymodel.gguf
```
Without a number, all GPUs are used. For several GPUs, see [Multiple GPUs](https://koboldcpp.net/docs/hardware/multi-gpu/).
## CUDA
* `--usecuda` accepts a GPU ID from 0 to 3.
* **Use MMQ** (on by default) uses dedicated kernels for prompt processing instead of cuBLAS. Turn it off with `--nommq`. It only affects CUDA and ROCm.
* The first start on a new card can take a few minutes: "Initializing CUDA/HIP, please wait, the following step may take a few minutes (only for first launch)". Later starts are faster.
* The oldpc builds use CUDA 11 for older NVIDIA cards. See [Release files: CUDA versions](https://koboldcpp.net/docs/install/releases/#advanced-cuda-versions-and-nvidia-cards).
## Vulkan
* `--usevulkan` takes one or more device IDs, for example `--usevulkan 0 1`. Without IDs, it uses all devices.
* If the environment variable `GGML_VK_VISIBLE_DEVICES` is set, it wins over the IDs given to `--usevulkan`.
## ROCm
An official ROCm build for AMD cards on Linux is published under the [rocm-rolling](https://github.com/LostRuins/koboldcpp/releases/tag/rocm-rolling) tag. See [Release files: ROCm build](https://koboldcpp.net/docs/install/releases/#advanced-rocm-build-for-amd-on-linux). In it, **Use hipBLAS (ROCm)** and `--usecuda` select ROCm. KoboldCpp picks ROCm by itself only when `rocminfo` finds the card, so without ROCm installed, select it yourself.
If generation is slow with Vulkan on Linux, try the ROCm build. On a Radeon RX 7600 XT with a prompt of about 1,000 tokens, it generated more than three times as fast as Vulkan (Qwen3-VL-8B: 36.7 vs 10.3 tokens per second).
There is no official ROCm build for Windows. Use Vulkan there.
## Metal
The Mac build uses Metal automatically. See [Apple Silicon](https://koboldcpp.net/docs/hardware/apple-silicon/).
## Advanced: removed backends
* **CLBlast** was removed in favor of Vulkan. Use **Use Vulkan** instead.
* **OpenBLAS** was removed. The CPU backend no longer needs it.
* `--noblas` still works and means the same as `--usecpu`.
## Advanced: selecting devices by name
`--device` (**Device Override** on the **Hardware** tab) takes a comma-separated list of llama.cpp device names, for example `Vulkan0,Vulkan1`, and overrides the normal device choice for the text model, TTS and embeddings. CPU names and unknown names are rejected, and then the whole override is ignored. The load log shows the device names, for example `CUDA0` and `CUDA1` for the first two CUDA GPUs, `Vulkan0` for the first Vulkan GPU and `ROCm0` for the first GPU in the ROCm build. Buffers named `CUDA_Host` in the log are in system RAM.
## Related
* [GPU layers](https://koboldcpp.net/docs/hardware/gpu-layers/)
* [Multiple GPUs](https://koboldcpp.net/docs/hardware/multi-gpu/)
* [Download KoboldCpp](https://koboldcpp.net/download/)
# GPU layers: how many to offload
> How KoboldCpp decides how much of a model goes on the GPU, what autofit does, and when to set GPU layers yourself.
A model is made of layers. **GPU Layers:** sets how many of them run on the graphics card. The rest runs on the processor from system memory, which is slower.
**GPU Layers:** is on the **Quick Launch** and **Hardware** tabs. It appears only when **Backend:** is a GPU backend (**Use CUDA**, **Use Vulkan** or **Use hipBLAS (ROCm)**), and always on macOS. With **Use CPU** it is hidden. See [GPU backends](https://koboldcpp.net/docs/hardware/backends/).
| Setting | Launcher | Flag |
| ------------------- | ----------------------------- | ---------------- |
| Automatic (default) | **GPU Layers:** `-1` or empty | `--gpulayers -1` |
| A fixed number | **GPU Layers:** `N` | `--gpulayers N` |
| No GPU | **GPU Layers:** `0` | `--gpulayers 0` |
`--gpu-layers`, `--n-gpu-layers` and `-ngl` are other names for `--gpulayers`.
Next to the field, the launcher shows the model's layer count in yellow, for example "(Auto) (N Total Layers)".
## Automatic: autofit
Leave **GPU Layers:** at `-1` unless you have a reason to change it. With a GPU backend, KoboldCpp then uses llama.cpp's **autofit**: it calculates what fits in your VRAM and puts as much of the model on the GPU as possible. The console shows:
```text
Auto Recommended GPU Layers:
GPU layers is default: Will enable AutoFit for increased estimation accuracy.
Autofit Success: 1, Autofit Result: -c -ngl
```
Examples at the default context:
| Model | GPU | Autofit Result | VRAM used |
| ----------------------------------- | ------------------------ | ------------------ | ----------------- |
| Qwen3-VL-8B Q4\_K\_S (4.80 GB file) | Radeon RX 7600 XT, 16 GB | `-c 16512 -ngl -1` | 6813 MiB |
| Qwen3-VL-8B Q4\_K\_S | RTX 3090, 24 GB | `-c 16512 -ngl -1` | 7192 MiB |
| Qwen3-32B Q4\_K\_M (19.8 GB file) | RTX 3090, 24 GB | `-c 16512 -ngl 64` | 22842 MiB |
| Qwen3-32B Q4\_K\_M | 2x RTX 3090 | `-c 16512 -ngl -1` | 11828 + 11888 MiB |
Qwen3-32B has 65 layers (64 plus the output layer), so `-ngl 64` on one RTX 3090 leaves one layer on the CPU.
* The number after `-ngl` is the number of GPU layers autofit chose; `-1` means all layers. The number after `-c` is the context size plus 128 tokens of headroom. With several GPUs, `-ts` shows the split autofit chose. If the model fits without changes, as in the 2x RTX 3090 example, the line has no `-ts`.
* "Auto Recommended GPU Layers" is KoboldCpp's own rough estimate, printed before autofit runs. It is used only if autofit fails (`Autofit Success: 0`).
* Autofit takes the context size, other loaded models, the vision projector and a draft model into account.
* It keeps 1024 MB of VRAM free on each GPU as a safety margin.
`-1` means something different in two cases:
* **No GPU backend** (CPU selected, or no GPU found): `-1` becomes `0`. The console prints "No GPU backend found, or could not automatically determine GPU layers. You may prefer to set layers manually."
* **macOS:** `-1` puts all layers on the GPU. See [Apple Silicon](https://koboldcpp.net/docs/hardware/apple-silicon/).
Autofit does not switch on by itself when you also set **Tensor Split:** (`--tensor_split`), **Override Tensors:** (`--overridetensors`), **MoE CPU Layers:** (`--moecpu`) or **FFN CPU Layers:** (`--ffncpu`). Then only the rough estimate is used, so set **GPU Layers:** yourself.
## Setting layers yourself
A number other than `-1` turns autofit off and puts exactly that many layers on the GPU.
1. Start with the automatic setting and note the number after `-ngl` in the "Autofit Result" line.
2. Set **GPU Layers:** to a number. A number at least as high as the model's layer count puts the whole model on the GPU.
3. If loading fails with an out-of-memory error, reduce the number by a few layers and try again.
The launcher's tooltip warns: "The auto estimation is often inaccurate! Please set layers yourself for best results!"
* `0` runs everything on the CPU. If you set no backend, it also skips automatic backend selection, so the CPU backend loads even when a GPU is present.
* `--gpulayers` without a number means **1** layer, not automatic.
* With **Use CPU** (`--usecpu`), a layer count is ignored (except on macOS and in [RPC](https://koboldcpp.net/docs/hardware/rpc/) connect mode) and KoboldCpp prints "WARNING: GPU layers is set, but a GPU backend was not selected! GPU will not be used!".
## Force AutoFit
**Force AutoFit** on the **Quick Launch** and **Hardware** tabs (`--autofit`) runs autofit no matter what else is set. It hides the **GPU Layers:** field.
* It overrides your layer count and tensor split.
* It ignores **MoE CPU Layers:**, **FFN CPU Layers:** and **Override Tensors:**, and says so in the console.
* The launcher marks it as experimental and "Not recommended for multi model setups".
## Advanced: autofit padding
**Autofit Padding (MB):** on the **Hardware** tab (`--autofitpadding`) sets how much VRAM autofit keeps free on the first GPU. The default is 1024.
Only works with Force AutoFit
The padding is only used when **Force AutoFit** (`--autofit`) is on. When autofit switches on automatically because **GPU Layers:** is `-1`, the padding is reset to 1024 MB.
For example (`koboldcpp` stands for your KoboldCpp file; see [Command line](https://koboldcpp.net/docs/settings/command-line/)):
Terminal
```sh
koboldcpp --model mymodel.gguf --autofit --autofitpadding 2048
```
The console then shows the reserved amount: "Autofit Reserve Space: N MB". It includes other loaded models on top of the padding.
## Advanced: the rough estimate
The fallback estimate is a simple formula based on the file size, the context size, the batch size and the model's layer and head counts.
* It keeps at least 1.25 GiB of VRAM free, or 0.5 GiB plus what other programs use, whichever is more.
* It warns when other programs use more than 2.5 GiB of VRAM.
* With several GPUs, it uses the VRAM of the **smallest** one.
* For split GGUF files it is less accurate and says so.
* An estimate of 2 layers or fewer becomes 0.
## Related
* [How much memory a model needs](https://koboldcpp.net/docs/models/memory/)
* [Saving VRAM](https://koboldcpp.net/docs/hardware/saving-vram/)
* [Multiple GPUs](https://koboldcpp.net/docs/hardware/multi-gpu/)
# Multiple GPUs
> Run one model across several graphics cards in KoboldCpp with CUDA or Vulkan, and control the split, the main GPU and the split mode.
KoboldCpp can spread one model over several graphics cards. This works with CUDA and with Vulkan.
## Use all GPUs
In the launcher, set **GPU ID:** to **All**: by default the launcher picks one card (with CUDA the first, `0`). On the command line, give the backend flag without a number (`koboldcpp` stands for your KoboldCpp file; see [Command line](https://koboldcpp.net/docs/settings/command-line/)):
Terminal
```sh
koboldcpp --usecuda --model mymodel.gguf
koboldcpp --usevulkan --model mymodel.gguf
```
Leave **GPU Layers:** at `-1`. Autofit then distributes the model over the GPUs by itself. The "Autofit Result" line in the console shows the GPU layers after `-ngl` (`-1` means all) and, if autofit changed the split, the split after `-ts`. See [GPU layers](https://koboldcpp.net/docs/hardware/gpu-layers/).
Qwen3-32B Q4\_K\_M at the default context, prompt of about 1,000 tokens:
| GPUs | Autofit Result | VRAM used | Generation (tokens/s) |
| ------------ | ------------------------------------ | ----------------- | --------------------- |
| One RTX 3090 | `-c 16512 -ngl 64` (64 of 65 layers) | 22842 MiB | 18.9 |
| Two RTX 3090 | `-c 16512 -ngl -1` | 11828 + 11888 MiB | 33.5 |
## Use some of the GPUs
| Goal | Flag |
| ----------------- | ----------------- |
| One CUDA GPU only | `--usecuda 1` |
| Some Vulkan GPUs | `--usevulkan 0 2` |
* `--usecuda` accepts one ID from 0 to 3. Without **Tensor Split:**, KoboldCpp hides all other GPUs from CUDA, so the chosen GPU becomes the only one. The load log then calls it `CUDA0`.
* `--usevulkan` accepts several IDs.
* The launcher's **GPU ID:** picks one GPU or **All**.
* CUDA GPUs are numbered in PCI bus order. On a PC with two RTX 3090, this was the same order `nvidia-smi` shows.
## Tensor split
**Tensor Split:** on the **Hardware** tab (`--tensor_split`, `-ts`) sets how much of the model each GPU gets, as proportions in GPU order.
Terminal
```sh
koboldcpp --usecuda --tensor_split 3 2 --gpulayers 99 --model mymodel.gguf
```
`3 2` gives 60% to GPU 0 and 40% to GPU 1. In the launcher, separate the values with commas or spaces.
* With a tensor split, autofit does not switch on by itself. Set **GPU Layers:** yourself.
* **Force AutoFit** ignores the tensor split.
* With a tensor split, `--usecuda N` does not hide the other GPUs; all of them stay in use.
## Main GPU
**Main GPU:** on the **Hardware** tab (`--maingpu`, `-mg`) sets which GPU is the main one (`-1` means default). It has no effect on GGUF models in this version. Use **Tensor Split:** to control how much each GPU gets.
## Split mode
**SplitMode:** on the **Hardware** tab (`--splitmode`) sets how the model is divided.
| Mode | What it does |
| ----------------- | ------------------------------------------------------------------------------------------------------ |
| `layer` (default) | Each GPU gets whole layers. |
| `tensor` | Tensors are split across the GPUs. Experimental. |
| `row` | Removed. KoboldCpp prints "split mode row was removed! Using tensor split instead!" and uses `tensor`. |
The old `--usecuda rowsplit` also ends up as `tensor`.
Qwen3-32B Q4\_K\_M on two RTX 3090, prompt of about 1,000 tokens:
| Split mode | VRAM used | Prompt (tokens/s) | Generation (tokens/s) |
| ------------------------ | ----------------- | ----------------- | --------------------- |
| `layer` | 11828 + 11888 MiB | 1694 | 33.5 |
| `tensor` | 11944 + 11944 MiB | 1313 | 39.4 |
| `row` (runs as `tensor`) | 11944 + 11944 MiB | 879 | 40.0 |
`tensor` generated faster but processed the prompt slower. With `tensor`, the load log shows both cards as one device: `using device Meta() (Meta()) (unknown id) - 47746 MiB free`.
## Advanced: pipeline parallelism
With more than one GPU, KoboldCpp turns on pipeline parallelism automatically when the physical batch size is smaller than the batch size: **Physical Batch Size:** (`--ubatchsize`) below **Batch Size:** (`--batchsize`, default 512). By default both are equal, so it is off. It also needs all layers on the GPUs, the `layer` split mode, the KV cache on the GPUs (no `--lowvram`) and no tensor overrides.
Terminal
```sh
koboldcpp --usecuda --batchsize 512 --ubatchsize 256 --model mymodel.gguf
```
The old `--pipelineparallel` and `--nopipelineparallel` flags have no effect.
With Qwen3-32B Q4\_K\_M on two RTX 3090, `--batchsize 512 --ubatchsize 256` processed 1833 instead of 1694 prompt tokens per second and generated 33.7 instead of 33.5 tokens per second (single runs).
## Advanced: GPUs on other computers
To use GPUs in other computers over the network, see [RPC](https://koboldcpp.net/docs/hardware/rpc/).
## Related
* [GPU backends](https://koboldcpp.net/docs/hardware/backends/)
* [GPU layers](https://koboldcpp.net/docs/hardware/gpu-layers/)
* [Saving VRAM](https://koboldcpp.net/docs/hardware/saving-vram/)
# Old PCs and CPU-only
> Run KoboldCpp on the processor alone or on older PCs without AVX2 or AVX, and set threads and batch size for CPU use.
KoboldCpp runs without a graphics card. Every release file can run on the processor (CPU) alone. It is slower than a GPU, so smaller models and quants work best. See [GGUF and quantization](https://koboldcpp.net/docs/models/gguf-and-quantization/).
## Run on the CPU only
Choose **Use CPU** under **Backend:**, or pass `--usecpu` (`koboldcpp` stands for your KoboldCpp file; see [Command line](https://koboldcpp.net/docs/settings/command-line/)):
Terminal
```sh
koboldcpp --usecpu --model mymodel.gguf
```
On a PC without a supported GPU, KoboldCpp picks the CPU by itself ("Auto Selected Default Backend") and sets **GPU Layers:** to `0`.
## Older processors
The main and nocuda builds run at full speed on processors with **AVX2**. For older processors, KoboldCpp has slower compatibility modes:
| Launcher backend | Flag | CPU needs |
| ----------------------------- | ------------------------ | ---------------------------------- |
| **Use CPU** | `--usecpu` | AVX2 |
| **Use CPU (Old CPU)** | `--usecpu --noavx2` | AVX |
| **Use Vulkan (Old CPU)** | `--usevulkan --noavx2` | AVX |
| **Use Vulkan (Older CPU)** | `--usevulkan --failsafe` | SSE3 and SSSE3 (oldpc builds only) |
| **Failsafe Mode (Older CPU)** | `--usecpu --failsafe` | Any x86-64 CPU |
* `--noavx2` is a slower compatibility mode for processors without AVX2.
* `--failsafe` is an "extremely old CPU compatibility mode that should work on all devices". It is much slower and implies `--noavx2`.
* `--noavx2` and `--failsafe` take priority over `--usecuda`: with them, CUDA is not loaded. Without a backend flag, KoboldCpp can still pick Vulkan for a discrete GPU; add `--usecpu` to stay on the CPU.
* In the launcher, **Failsafe Mode (Older CPU)** also turns off **Use MMAP** and **Direct I/O**. The `--failsafe` flag does not.
If KoboldCpp crashes at startup, try `--usecpu --noavx2`, then `--usecpu --failsafe`.
### Automatic detection
When you set no backend, KoboldCpp checks your processor and switches to the matching mode by itself: `--noavx2` without AVX2, `--noavx2 --failsafe` without AVX. It reads `/proc/cpuinfo` on Linux and uses a bundled helper on Windows. On other systems (for example ARM) it does not check.
In Docker, this detection can be wrong and load the failsafe mode on a capable CPU. Set the backend yourself there.
### oldpc builds
The oldpc files (`koboldcpp-oldpc.exe`, `koboldcpp-linux-x64-oldpc`) are built for AVX instead of AVX2 and use CUDA 11. Use them for an older processor, an older NVIDIA card, or when the main build crashes. They are also the only builds with **Use Vulkan (Older CPU)**, for GPU use on processors without AVX. See [Release files and system requirements](https://koboldcpp.net/docs/install/releases/#processor-avx2-avx-no-avx).
## Threads
**Threads:** on the **Hardware** tab (`--threads`, `-t`) sets how many CPU threads generate text. Empty or `0` means automatic. The launcher fills in the automatic value for your PC; clear the field to keep it automatic in a config you use on another PC. The automatic value is:
* Half of the logical processors, minus one, but at least 3. With 7 or fewer logical processors, exactly half (rounded down).
* At most 8 on Windows with an Intel processor, to avoid its efficiency cores. Linux and macOS do not report the processor maker the way KoboldCpp checks it, so the cap does not apply there.
* At most 64.
For example, a 16-thread processor gets 7 threads. The console shows the result:
```text
Threadpool set to 7 threads and 7 blasthreads...
```
**Batch Threads:** (`--blasthreads`) sets the threads for processing the prompt. By default it is the same as **Threads:**.
## Batch size
**Batch Size:** on the **Hardware** tab (`--batchsize`) sets how many prompt tokens are processed at once. The default is 512; allowed values are 16 to 4096 in powers of two, or `-1`.
* `-1` ("Don't Batch") turns batched processing off but keeps GPU offload.
* **Physical Batch Size:** (`--ubatchsize`) defaults to the batch size.
## Measure speed
**Run Benchmark** on the **Hardware** tab (`--benchmark`) fills the context with a test prompt, generates text and prints the processing and generation speed, without starting the server. `--benchmark results.csv` also appends the result to a CSV file.
Terminal
```sh
koboldcpp --model mymodel.gguf --benchmark
```
## Related
* [Release files and system requirements](https://koboldcpp.net/docs/install/releases/)
* [GPU backends](https://koboldcpp.net/docs/hardware/backends/)
* [How much memory a model needs](https://koboldcpp.net/docs/models/memory/)
# RPC (GPUs over the network)
> Share a GPU from one computer and use it from KoboldCpp on another with RPC host and connect mode, and keep the RPC port off the internet.
RPC lets KoboldCpp use GPUs in other computers over the network. One computer shares its devices (**host**); the computer that loads the model uses them (**connect**).
Keep RPC on a trusted network
The RPC server does not ask for a password. By default it listens on all network interfaces (`0.0.0.0`). Don't expose the RPC port to the internet. Run hosts only on a network you trust, and set `--rpchost` to a specific address where you can.
## Settings
The settings are on the **Network** tab, under **RPC Mode:**.
| Setting | Launcher | Flag | Default |
| ------------------------------------- | ------------------ | -------------- | -------------------------- |
| Mode: `disabled`, `connect` or `host` | **RPC Mode:** | `--rpcmode` | `disabled` |
| Host: listen address | **RPC Host IP:** | `--rpchost` | `0.0.0.0` (all interfaces) |
| Host: port | **RPC Host Port:** | `--rpcport` | `5551` |
| Host: devices to share | **RPC Devices:** | `--rpcdevice` | automatic |
| Connect: hosts to use | **RPC Endpoints:** | `--rpctargets` | none |
## Share a GPU (host)
On the computer with the GPU to share (`koboldcpp` stands for your KoboldCpp file; see [Command line](https://koboldcpp.net/docs/settings/command-line/)):
Terminal
```sh
koboldcpp --rpcmode host --rpchost 192.168.1.20 --rpcport 5551
```
Use the computer's own network address for `--rpchost`, or `127.0.0.1` to test on one machine.
* Host mode needs no model and starts no web interface or API. It only runs the RPC server and prints "Starting RPC server on …".
* It shares all discrete GPUs by default. Without one, it shares other accelerators such as integrated graphics, and without those, the CPU.
* `--rpcdevice` shares specific devices by name, for example `Vulkan0`. CPU names are rejected; KoboldCpp then falls back to the automatic choice.
* The host prints "Note: It's not advised to expose RPC server to the open internet."
## Use a remote GPU (connect)
On the computer that loads the model, list the hosts in `--rpctargets`, separated by commas:
Terminal
```sh
koboldcpp --rpcmode connect --rpctargets 192.168.1.20:5551,192.168.1.21:5551 --model mymodel.gguf --gpulayers 99
```
* `--rpctargets` only works with `--rpcmode connect`. Otherwise KoboldCpp exits with "Error: rpctargets can only be used in connect mode".
* `--rpctargets` and `--rpcport` can't be used together.
* In connect mode, **GPU Layers:** is kept even with **Use CPU** (`--usecpu`).
* The connection is made when the text model loads. Other models that use the GPU, such as embedding models, can then use the remote devices too.
When it works, the host prints `Accepted client connection`, and the connecting KoboldCpp lists the remote device as `RPC0` with its address:
```text
llama_prepare_model_devices: using device RPC0 (192.168.1.20:5551) (unknown id) - 23873 MiB free
load_tensors: offloaded 37/37 layers to GPU
```
In a test with an RTX 3090 shared over `127.0.0.1` and a connecting KoboldCpp without its own GPU (`--usecpu`), all layers of Qwen3-VL-8B went to `RPC0`, with or without `--gpulayers 99`.
## Compatibility
KoboldCpp's RPC is compatible with llama.cpp's: a llama.cpp `rpc-server` can serve KoboldCpp, and a KoboldCpp host can serve llama.cpp. This compatibility was a breaking change at the time, so older KoboldCpp versions don't work with newer ones. Use the same KoboldCpp release on all computers.
## Related
* [Multiple GPUs](https://koboldcpp.net/docs/hardware/multi-gpu/)
* [GPU layers](https://koboldcpp.net/docs/hardware/gpu-layers/)
* [Remote access](https://koboldcpp.net/docs/api/remote-access/)
# Saving VRAM
> Fit bigger models or longer contexts in KoboldCpp with KV cache quantization, flash attention, SWA, MoE CPU offload and other memory options.
When a model does not fit on your graphics card, these options reduce how much VRAM it needs.
| Option | Launcher | Flag | Cost |
| --------------------------- | ------------------------------------ | --------------- | ----------------------------------------------- |
| Smaller context | **Context Size:** | `--contextsize` | The model keeps less text in mind |
| Quantized KV cache | **Quantize KV Cache:** (Context tab) | `--quantkv` | Works best with flash attention (on by default) |
| Smaller quant | pick another file | | Some quality |
| MoE experts on the CPU | **MoE CPU Layers:** (Context tab) | `--moecpu` | Slower, only for MoE models |
| Vision projector on the CPU | **V.Force CPU** (Loaded Files tab) | `--mmprojcpu` | Images are processed on the CPU |
| Fewer GPU layers | **GPU Layers:** | `--gpulayers` | Slower; autofit does this for you |
| Smaller batch size | **Batch Size:** (Hardware tab) | `--batchsize` | Slower prompt processing |
| KV cache in RAM | **No KV offload** (Hardware tab) | `--lowvram` | Much slower |
Measured with Qwen3-VL-8B Q4\_K\_S at the default context (16384) on an RTX 3090 (CUDA, KoboldCpp 1.122.1), with a prompt of about 1,000 tokens. VRAM is what `nvidia-smi` showed for the card:
| Setting | VRAM | Prompt (tokens/s) | Generation (tokens/s) |
| -------------------------------------------------------- | -------- | ----------------- | --------------------- |
| Default (all 37 layers, `f16` KV cache, flash attention) | 7192 MiB | 6789 | 86.9 |
| `--quantkv q8_0` | 6096 MiB | 5842 | 84.9 |
| `--quantkv q4_0` | 5512 MiB | 5807 | 84.0 |
| `--gpulayers 30` | 5988 MiB | 3235 | 45.2 |
| `--batchsize 256` | 7038 MiB | 4247 | 86.7 |
| `--lowvram` | 4860 MiB | 3324 | 38.3 |
| `--noflashattention` | 8064 MiB | 5074 | 51.5 |
A quantized KV cache saved 1.1 to 1.7 GB here; generation was 2–3% slower and prompt processing about 15% slower. On a Radeon RX 7600 XT (Vulkan) the VRAM savings were similar.
See [How much memory a model needs](https://koboldcpp.net/docs/models/memory/) for where the memory goes.
## Quantize the KV cache
The KV cache holds the context. **Quantize KV Cache:** on the **Context** tab (`--quantkv`) stores it in a smaller format.
The last column is the KV cache of Qwen3-VL-8B at the default context, measured on a Radeon RX 7600 XT.
| Value | Size compared with `f16` | Qwen3-VL-8B |
| --------------- | ------------------------ | ------------ |
| `f16` (default) | 100% | 2340 MiB |
| `bf16` | 100% | not measured |
| `q8_0` | about 53% | 1243 MiB |
| `q5_1` | about 38% | 877.5 MiB |
| `q4_0` | about 28% | 658.1 MiB |
For example (`koboldcpp` stands for your KoboldCpp file; see [Command line](https://koboldcpp.net/docs/settings/command-line/)):
Terminal
```sh
koboldcpp --model mymodel.gguf --quantkv q8_0
```
* It needs flash attention for full effect. Without flash attention, only the K half of the cache is quantized (except `bf16`), and KoboldCpp warns: "Quantized KV was used without flash attention! This is NOT RECOMMENDED! … In some cases, it might even use more VRAM when doing a full offload."
* With Qwen3-VL-8B on a Radeon RX 7600 XT, `q8_0` without flash attention used 7947 MiB of VRAM, more than the default `f16` cache with flash attention (6813 MiB), because the compute buffer grew from 337 to 2156.6 MiB.
* It works together with [ContextShift](https://koboldcpp.net/docs/settings/context-size/#reusing-context-between-requests).
* Old numeric values still work: `0` = `f16`, `1` = `q8_0`, `2` = `q4_0`, `3` = `bf16`.
KV cache of Gemma 3 4B at the default context, measured on KoboldCpp 1.122.1 with a Radeon RX 7600 XT. Gemma 3 uses SWA: 5 of its 34 layers keep the whole context, the other 29 keep only 1664 tokens.
| `--quantkv` | 5 full-context layers | 29 SWA layers |
| --------------- | --------------------- | ------------- |
| `f16` (default) | 325 MiB | 188.5 MiB |
| `q8_0` | 172.7 MiB | 100.1 MiB |
| `q4_0` | 91.4 MiB | 53.0 MiB |
## Flash attention
Flash attention is **on by default**. **Use FlashAttention** on the **Quick Launch** and **Hardware** tabs turns it off when unchecked (`--noflashattention`, `-nofa`). Leave it on, especially with a quantized KV cache.
With Gemma 3 4B on a Radeon RX 7600 XT, turning flash attention off left the `f16` KV cache the same size and made generation slower.
The old `--flashattention` flag has no effect. An old `.kcpps` file with `"flashattention": false` turns flash attention **off**, and one with `"useswa": false` turns SWA off; check these settings when you reuse old config files.
## SWA
Some models, such as the Gemma 3 family, use sliding window attention (SWA). KoboldCpp uses it by default, which makes their KV cache much smaller.
* **Allow SWA** on the **Context** tab controls it. Uncheck it or pass `--noswa` for a full-size cache.
* With SWA on, ContextShift cannot be used. The console says "Note that using SWA Mode cannot be used with Context Shifting!".
* **SWA Padding Tokens:** (`--swapadding`) adds room to the SWA cache. More padding lets KoboldCpp rewind further before it has to reprocess the prompt, at the cost of some memory.
## MoE models
Mixture-of-Experts (MoE) models have many "expert" weights, of which only a few are used per token. Keeping the experts in system RAM and the rest on the GPU often lets a large MoE model run on a small GPU.
Autofit does this by itself when the model does not fit: it keeps all layers on the GPU and moves the expert weights of the last layers to the CPU. For example, Qwen3-30B-A3B at 16k context on a 16 GB Radeon RX 7600 XT (Vulkan, shortened):
```text
Autofit Success: 1, Autofit Result: -c 16512 -ngl 49 -ot blk\.25\.ffn_(gate|gate_up|down).*=CPU,blk\.26\.ffn_(up|down|gate_up|gate)_(ch|)exps=CPU,...
```
`-ngl 49` means all layers. The `-ot …=CPU` patterns move the expert weights from layer 25 on to the CPU.
**MoE CPU Layers:** on the **Context** tab (`--moecpu N`) keeps the expert weights of the first N layers on the CPU. `--moecpu` without a number keeps all of them there.
Terminal
```sh
koboldcpp --model my-moe-model.gguf --usecuda --moecpu --gpulayers 99
```
* With `--moecpu`, autofit does not switch on by itself. Set **GPU Layers:** yourself; a number at least as high as the layer count puts everything that is not an expert on the GPU.
* **Force AutoFit** ignores `--moecpu`.
* It only takes effect when KoboldCpp uses a GPU besides the CPU.
* The value is capped at 200.
With Qwen3-30B-A3B Q4\_K\_M at 16k context on a Radeon RX 7600 XT (Vulkan), `--moecpu --gpulayers 99` used 2724 MiB of VRAM instead of 11472 MiB with autofit, and generated 15.1 instead of 17.2 tokens per second.
**FFN CPU Layers:** (`--ffncpu N`) does the same for the feed-forward weights of normal (dense) models.
**MoE Experts:** (`--moeexperts N`) changes how many experts are used per token. The default follows the model file. This changes the model's output quality and speed.
## KV cache in system RAM
**No KV offload** on the **Hardware** tab (`--lowvram`, `-nkvo`) keeps the KV cache in system RAM while the layers run on the GPU. More layers fit, but it is much slower. It works with CUDA and Vulkan. Use it as a last resort.
## Advanced: override tensors
**Override Tensors:** on the **Context** tab (`--overridetensors`, `-ot`) places tensors whose names match a pattern on a chosen device, as in llama.cpp: `regex=buffer type`, separated by commas. `--moecpu` and `--ffncpu` are shortcuts that add such patterns. Like them, it stops autofit from switching on by itself, and **Force AutoFit** ignores it.
The buffer type is a device name: `CUDA0` or `CPU` with CUDA, `Vulkan0` or `CPU` with Vulkan, `ROCm0` or `CPU` with ROCm. The console lists the accepted names after `Handling Override Tensors for backends:`. An unknown name prints `Unknown Buffer Type: `, and that pattern is ignored.
## Advanced: loading options (mmap, mlock, direct I/O)
These change how the model file is read into memory, not how much VRAM it uses.
| Option | Launcher | Flag | Effect |
| ---------- | ----------------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| mmap | **Use MMAP** | `--usemmap` | Maps the file into memory instead of reading it. Off by default. The launcher notes that the model "will not be unloadable". |
| mlock | **Use mlock** (Hardware tab) | `--usemlock` | Keeps the model's RAM from being paged out. "Not usually recommended." |
| Direct I/O | **Direct I/O** (Hardware tab) | `--usedirectio` | Reads the file with direct I/O on Linux, which may load faster from some drives. Ignored on other systems. |
* mmap and direct I/O can't be combined. Direct I/O wins over mlock.
* With mmap or direct I/O, the CPU backend does not repack the weights.
* The old `--nommap` flag has no effect, since mmap is off by default.
With Qwen3-VL-8B and all layers on a Radeon RX 7600 XT, the 334 MiB of weights that stay in RAM were mapped from the file with mmap (`CPU_Mapped` in the log). The process used 504 MB of RAM with mmap and 187 MB with direct I/O.
## Related
* [How much memory a model needs](https://koboldcpp.net/docs/models/memory/)
* [GPU layers](https://koboldcpp.net/docs/hardware/gpu-layers/)
* [Out of memory](https://koboldcpp.net/docs/troubleshooting/out-of-memory/)
# Install on Android with Termux
> Build and run KoboldCpp on an Android phone or tablet with Termux and the official quick setup script.
On Android, KoboldCpp runs inside the Termux terminal app and is compiled on the device. An official script does the setup for you.
1. Install [Termux from F-Droid](https://f-droid.org/en/packages/com.termux/).
2. Open Termux and run the setup script:
Termux
```sh
curl -sSL https://raw.githubusercontent.com/LostRuins/koboldcpp/concedo/android_install.sh | sh
```
Run this way, the script installs KoboldCpp and starts it with a small Gemma3-1B model.
3. When it has loaded, open `http://localhost:5001` in your phone's browser.
## Choosing a different model
Download the script and run it yourself to get a menu:
Termux
```sh
curl -sSLO https://raw.githubusercontent.com/LostRuins/koboldcpp/concedo/android_install.sh
chmod +x android_install.sh
./android_install.sh
```
| Option | What it does |
| ------ | ----------------------------------------------- |
| 1 | Install and launch with Gemma3-1B |
| 2 | Install without a model |
| 3 | Download a GGUF model from a URL |
| 4 | Load a GGUF model that is already on the device |
| 5 | Exit |
Options 3 and 4 need an existing install. Run them from the `koboldcpp` folder, which has its own copy of the script. Option 4 only lists `.gguf` files in that folder.
Termux
```sh
cd koboldcpp
bash android_install.sh
```
Use a small model. See [Choose a model](https://koboldcpp.net/getting-started/model/).
## What the script does
1. Stops if it is not running on Android.
2. If `wget`, `git` or `python` is missing, runs `apt update`, installs `openssl`, `wget`, `git` and `python`, and runs `pkg upgrade`.
3. Clones the KoboldCpp repository, unless it finds an existing copy.
4. Compiles it with `make -j 2`, unless a build already exists.
5. Starts it with `python koboldcpp.py --model `.
## Updating
Running the script again does **not** rebuild KoboldCpp: it skips compiling when a build already exists. To update, pull the new source and compile it again:
Termux
```sh
cd koboldcpp
git pull
make
```
## Advanced: manual setup
Termux
```sh
pkg update
pkg upgrade
pkg install openssl wget git python clang make
git clone https://github.com/LostRuins/koboldcpp.git
cd koboldcpp
make
python koboldcpp.py --model mymodel.gguf
```
Download a small GGUF model into the folder first, or pass a model URL to `--model`. Then open `http://localhost:5001`.
* **Packages fail to install:** run `termux-change-repo` and pick another mirror.
* **`Illegal instruction` on your device:** rebuild with `make clean`, then `make LLAMA_PORTABLE=1`, which turns off tuning for your specific processor.
* **GPU:** these instructions cover CPU builds. GPU acceleration depends on the device and its drivers.
More: [OS-specific problems](https://koboldcpp.net/docs/troubleshooting/os-specific/#android-illegal-instruction).
## Related
* [Build from source](https://koboldcpp.net/docs/install/from-source/)
* [Updating](https://koboldcpp.net/docs/install/updating/)
# Run on Google Colab or Docker
> Run KoboldCpp in the cloud with the official Google Colab notebook or the official Docker image, and its environment variables.
Two official ways run KoboldCpp without installing it on your own computer: a Google Colab notebook for trying it in the browser, and a Docker image for cloud GPU servers.
## Google Colab
The [official Colab notebook](https://colab.research.google.com/github/LostRuins/koboldcpp/blob/concedo/colab.ipynb) runs KoboldCpp on a cloud GPU from Google. The short link is `https://koboldai.org/colabcpp`.
1. Open the notebook and pick a model: choose a template from the dropdown, or tick the model options yourself.
2. Press the two **Play** buttons.
3. Open the Cloudflare URL shown at the end. KoboldAI Lite runs there.
* Keep the notebook page open, and check it now and then for captchas.
* On a phone, also run the silent-audio cell so the session stays alive.
* If Colab gives you no GPU, the notebook stops with "Colab did not give you a GPU due to usage limits".
* The notebook always downloads the latest release.
* You are responsible for following Google Colab's terms of use.
### Colab options
| Option | What it does |
| ------------------------------- | ---------------------------------------------------- |
| Google Drive save storage | Keeps your saves in your Google Drive. |
| LocalTunnel | A fallback when the Cloudflare tunnel does not work. |
| Delete cached models on restart | On by default. |
## Docker (experts)
The official image is [`koboldai/koboldcpp`](https://hub.docker.com/r/koboldai/koboldcpp) on Docker Hub. It is intended for experts, mainly for people who rent cloud GPUs. For KoboldCpp on your own computer, use the [normal downloads](https://koboldcpp.net/download/) instead.
* It runs x86-64 Ubuntu inside and expects an NVIDIA or AMD GPU.
* It may perform poorly on some Windows and macOS machines, and may fail outright on ARM.
* Its AVX detection is crude. It can fall back to the failsafe libraries, which are extremely slow.
* By default it downloads the latest KoboldCpp for your GPU when it starts; for AMD GPUs that is the experimental ROCm build. The image itself only changes when its Docker setup changes.
### Environment variables
| Variable | Value |
| --------------- | ---------------------------------------------------------------------------------------------------- |
| `KCPP_MODEL` | Download URL of the text model. For a model split into several files, separate the URLs with commas. |
| `KCPP_IMGMODEL` | Download URL of the image generation model. |
| `KCPP_MMPROJ` | Download URL of the vision projector (mmproj). |
| `KCPP_ARGS` | Extra KoboldCpp flags, for example `--lora` with a mounted file. |
### Minimal example
The image prints this example:
Terminal
```sh
docker run --rm -e KCPP_DONT_TUNNEL=true -p 5001:5001 -it koboldai/koboldcpp
```
* `-p 5001:5001` makes KoboldCpp reachable on port 5001.
* `KCPP_DONT_TUNNEL=true` turns off the public Cloudflare tunnel. The image opens it by default on purpose, because it is made for cloud GPU rentals.
* If you set neither a model variable nor `KCPP_ARGS`, it loads a tiny demo model after one minute.
* For an NVIDIA GPU, add `--gpus all`. This needs the NVIDIA Container Toolkit on the host.
### Compose example
The image prints its official Docker Compose example:
Terminal
```sh
docker run --rm -it koboldai/koboldcpp compose-example
```
It turns the tunnel off, and shows how to pass an NVIDIA GPU, or an AMD or Intel GPU through `/dev/dri`. It also turns on admin mode with the password `ChangeMe`; change it before use.
## Hosted GPU services
KoboldCpp has official short links for two GPU rental services:
* RunPod: `https://koboldai.org/runpodcpp`
* SimplePod: `https://koboldai.org/simplepod`
## Advanced: unofficial Docker images
Community Docker images by korewaChino and noneabove1182 exist. They are unofficial and get no official support.
## Related
* [Updating Colab and Docker](https://koboldcpp.net/docs/install/updating/#colab-and-docker)
* [Staying safe](https://koboldcpp.net/docs/install/staying-safe/)
* [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/)
# Build from source
> Compile KoboldCpp yourself on Linux, macOS or Windows, with make flags, koboldcpp.sh and the KCPP_PORTABLE=1 change.
Most people don't need to build KoboldCpp: the [release files](https://koboldcpp.net/docs/install/releases/) are ready to run. Build it yourself for an Intel Mac, ARM Linux, Android, or to change how it is compiled.
There is no `pip install koboldcpp`; KoboldCpp is not on PyPI.
## Linux
Terminal
```sh
git clone https://github.com/LostRuins/koboldcpp.git
cd koboldcpp
make
python3 koboldcpp.py --model /path/to/model.gguf
```
### `make` flags
| Flag | Effect |
| ------------------ | ------------------------------------------------------------------------------- |
| `LLAMA_VULKAN=1` | Build the Vulkan backend. |
| `LLAMA_CUBLAS=1` | Build the CUDA backend (NVIDIA). |
| `LLAMA_HIPBLAS=1` | Build the ROCm backend (AMD). |
| `LLAMA_PORTABLE=1` | Build for other machines, not only your own. |
| `LLAMA_NOAVX2=1` | Together with `LLAMA_PORTABLE=1`: build without AVX2, as the oldpc releases do. |
Without `LLAMA_PORTABLE=1`, the build is optimized for your own processor (`-march=native` on x86, `-mcpu=native` on ARM) and may not run on other machines. On ARM, `LLAMA_PORTABLE=1` turns off `-mcpu=native`, so the compiler targets its default architecture.
If you start `koboldcpp.py` before running `make`, it stops with `No Backends Available!`.
### Python packages
`requirements.txt` lists the Python packages KoboldCpp uses. Install them with `python -m pip install -r requirements.txt`. Optional packages include `customtkinter` and Tk for the launcher, `jinja2` for chat templates and `psutil` for system information. Tk may need a separate package from your operating system. Without the launcher packages, run KoboldCpp from the command line. `koboldcpp.sh` manages its own dependencies.
## macOS
Terminal
```sh
git clone https://github.com/LostRuins/koboldcpp.git
cd koboldcpp
make LLAMA_METAL=1
python3 koboldcpp.py --model /path/to/model.gguf
```
Plain `make` also works. This is the way to run KoboldCpp on an Intel Mac.
## Windows
1. Install [w64devkit](https://github.com/skeeto/w64devkit/releases), the 64-bit version: `w64devkit-x64-….7z.exe` in current releases, or `w64devkit-1.22.0.zip`, which the official builds use. The 32-bit versions (x86, i686) conflict with the bundled libraries.
2. Clone the repository (`git clone https://github.com/LostRuins/koboldcpp.git`). In the w64devkit shell, go to the `koboldcpp` folder and run `make`, or `make LLAMA_VULKAN=1` for Vulkan.
3. To package an exe, build with `make LLAMA_VULKAN=1 LLAMA_PORTABLE=1` (the script bundles all of those libraries), install PyInstaller and the packages in `requirements.txt` with `pip`, then run `make_pyinstaller.bat`.
### CUDA on Windows
CUDA builds on Windows need Visual Studio with its C++ and CMake tools, and the CUDA Toolkit. The official builds use Visual Studio 2019 and CUDA 12.1. In the `koboldcpp` folder, run:
Command Prompt
```sh
mkdir build
cd build
cmake .. -DLLAMA_CUBLAS=ON
cmake --build . --config Release
```
The build copies `koboldcpp_cublas.dll` into the `koboldcpp` folder, next to `koboldcpp.py`. To package an exe with CUDA, also copy the matching `cublas`, `cublasLt` and `cudart` libraries from the CUDA Toolkit used for the build there (for CUDA 12: `cublas64_12.dll`, `cublasLt64_12.dll` and `cudart64_12.dll` from its `bin` folder), then run `make_pyinstaller_cuda.bat`.
## `koboldcpp.sh` (Linux)
`koboldcpp.sh` fetches all build dependencies into a local micromamba/conda environment, builds KoboldCpp and runs it. It works on x86\_64 and aarch64 and needs `curl` and `bzip2`.
| Command | What it does |
| ------------------------ | ----------------------------------------------------------------------------------------------- |
| `./koboldcpp.sh` | Opens the launcher (needs X11). |
| `./koboldcpp.sh --help` | Lists the flags. Any argument other than `rebuild` or `dist` is passed to `koboldcpp.py`. |
| `./koboldcpp.sh rebuild` | Recreates the environment and recompiles. Run it after updating. |
| `./koboldcpp.sh dist` | Builds your own single-file binary. It only runs on distributions equal to or newer than yours. |
The script picks the backend itself: with an NVIDIA GPU it uses CUDA 11.4 or 12.1 depending on what `nvidia-smi` reports, and ROCm when it finds ROCm on the system. Override this with `KCPP_CUDA=` or `KCPP_CUDA=rocm`.
### `KCPP_PORTABLE=1` (changed in v1.122)
Since v1.122, `koboldcpp.sh` optimizes for the machine it runs on. To build binaries that run on other systems, set `KCPP_PORTABLE=1`:
Terminal
```sh
KCPP_PORTABLE=1 ./koboldcpp.sh dist
```
Without it, `dist` warns "THIS BINARY WILL ONLY RUN ON YOUR SYSTEM!!". Portable mode is forced when no NVIDIA GPU is visible (except for ROCm builds), and for x64 builds with `NOAVX1` or `NOAVX2`.
The script also reads `NOAVX2`, `NOAVX1`, `ARCHES_CU11`, `ARCHES_CU12`, `ARCHES_CU13` and `KCPP_APPEND`; see the top of `koboldcpp.sh`.
## Other systems
* **Android:** see [Android (Termux)](https://koboldcpp.net/docs/install/android/).
* **OpenBSD:** build with `gmake`. The [README](https://github.com/LostRuins/koboldcpp) has OpenBSD notes on Vulkan and `ulimit -d`.
## Related
* [Release files and system requirements](https://koboldcpp.net/docs/install/releases/)
* [Updating](https://koboldcpp.net/docs/install/updating/)
# Install on Linux, desktop or headless
> Download KoboldCpp on Linux, make it executable and run it, with notes on the launcher, file pickers and headless servers.
KoboldCpp for Linux is a single file. There is no installer and no package to add.
1. Pick your file. See [Download KoboldCpp](https://koboldcpp.net/download/) if you are unsure.
| Your PC | File |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
| NVIDIA graphics card | [`koboldcpp-linux-x64`](https://github.com/LostRuins/koboldcpp/releases/latest/download/koboldcpp-linux-x64) |
| AMD, Intel or no graphics card | [`koboldcpp-linux-x64-nocuda`](https://github.com/LostRuins/koboldcpp/releases/latest/download/koboldcpp-linux-x64-nocuda) |
| Older processor or older NVIDIA card | [`koboldcpp-linux-x64-oldpc`](https://github.com/LostRuins/koboldcpp/releases/latest/download/koboldcpp-linux-x64-oldpc) |
2. Download it with your browser. It usually lands in `~/Downloads`.
3. In a terminal, go to the folder with the file, make it executable and run it. This example uses the NVIDIA file; replace the name with yours:
Terminal
```sh
cd ~/Downloads
chmod +x koboldcpp-linux-x64
./koboldcpp-linux-x64
```
The launcher opens.
Continue with [Choose a model](https://koboldcpp.net/getting-started/model/).
To download from the terminal instead, for example on a server:
Terminal
```sh
curl -fLO https://github.com/LostRuins/koboldcpp/releases/latest/download/koboldcpp-linux-x64
```
"Permission denied" means the file is not executable yet; run `chmod +x` on it. If the main build fails on an older system, try `koboldcpp-linux-x64-oldpc`, the build with the greatest compatibility.
## Programs the launcher uses
| Program | Needed for |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `yad` or `zenity` | A better file picker. `yad` is used if both are installed; without either, the launcher uses its built-in picker. |
| `vulkan-tools` | Detecting your graphics card and its memory with `vulkaninfo`. NVIDIA cards are also detected with `nvidia-smi`, and AMD cards with `rocminfo` if ROCm is installed. If none of these works, you see "Unable to detect VRAM." |
| `xdg-open` | Opening the browser after the model has loaded. |
## Launcher problems
* **The file picker does nothing (often on Wayland).** Install `yad`, or turn on **Use Classic FilePicker** on the launcher's **Extra** tab. The console may show `Zenity/YAD sanity check failed`.
* **"Warning, GUI failed to start".** The launcher could not open a window, for example because there is no display. KoboldCpp then tells you to use the command line. See [Headless use](#headless-use).
* **You want to see the console output.** **Spawn Terminal** on the **Extra** tab opens an `xterm` window that mirrors it.
More: [OS-specific problems](https://koboldcpp.net/docs/troubleshooting/os-specific/#linux-the-file-picker-does-nothing).
## AMD graphics cards
Start with the **Vulkan** backend in `koboldcpp-linux-x64-nocuda`. Install `vulkan-tools` first, so the launcher can detect your card and select **Use Vulkan** by itself. Without it, KoboldCpp does not find the card and runs on the CPU.
If generation is slow with Vulkan, try the experimental official ROCm build. It does not need ROCm installed. See [ROCm build for AMD on Linux](https://koboldcpp.net/docs/install/releases/#advanced-rocm-build-for-amd-on-linux) and [GPU backends: ROCm](https://koboldcpp.net/docs/hardware/backends/#rocm).
## Headless use
With a model on the command line, KoboldCpp skips the launcher and needs no display:
Terminal
```sh
./koboldcpp-linux-x64 --model mymodel.gguf
```
* `./koboldcpp-linux-x64 --help` lists all flags.
* `--config mysettings.kcpps` starts with a saved configuration. A config that contains a model also skips the launcher.
* `--skiplauncher` overrides `--showgui`, including a `showgui` saved in a config. It does not pick a model: without a model from the command line or a config, KoboldCpp exits with an error.
* By default KoboldCpp listens on all network interfaces, so other devices on your network can reach it. Add `--host 127.0.0.1` to allow connections from this machine only.
More: [Command line](https://koboldcpp.net/docs/settings/command-line/), [Remote access](https://koboldcpp.net/docs/api/remote-access/), [Passwords and security](https://koboldcpp.net/docs/api/passwords-and-security/).
## Advanced: ARM and other systems
There is no ready-made file for ARM Linux. [Build from source](https://koboldcpp.net/docs/install/from-source/); `koboldcpp.sh` supports aarch64.
The x64 files need glibc 2.29 or newer, for example Ubuntu 20.04 or newer. `ldd --version` shows your glibc version.
## Advanced: unofficial packages
The community maintains packages that are unofficial and get no official support: `koboldcpp-cuda` and `koboldcpp-hipblas` in the AUR, and `koboldcpp` in Nixpkgs.
## Related
* [Release files and system requirements](https://koboldcpp.net/docs/install/releases/)
* [Updating](https://koboldcpp.net/docs/install/updating/)
* [Build from source](https://koboldcpp.net/docs/install/from-source/)
# Install on macOS (Apple Silicon)
> Run KoboldCpp on an Apple Silicon Mac, allow it in Privacy & Security, and what to do on an Intel Mac.
KoboldCpp has a ready-made file for Macs with Apple Silicon (M-series) and macOS 14 (Sonoma) or newer. It is a single file that you run from Terminal.
1. Download [`koboldcpp-mac-arm64`](https://github.com/LostRuins/koboldcpp/releases/latest/download/koboldcpp-mac-arm64).
2. In Terminal, go to the folder with the file, make it executable and run it:
Terminal
```sh
cd ~/Downloads
chmod +x koboldcpp-mac-arm64
./koboldcpp-mac-arm64
```
3. The first time, macOS shows "Apple could not verify “koboldcpp-mac-arm64” is free of malware…". Click **Done**, not **Move to Trash**. Open **System Settings → Privacy & Security**, scroll down to **Security** and click **Open Anyway** next to the message about `koboldcpp-mac-arm64`. Run the file again and confirm. After that, it starts without asking.
To skip the prompt, remove the download mark in Terminal before the first start:
Terminal
```sh
xattr -d com.apple.quarantine koboldcpp-mac-arm64
```
The launcher opens. Continue with [Choose a model](https://koboldcpp.net/getting-started/model/).
[Apple's guide](https://support.apple.com/en-us/102445) and a [video guide](https://youtube.com/watch?v=NOW5dyA_JgY) show how to allow the file.
## GPU (Metal)
The Mac build uses Metal on the GPU automatically.
* With **GPU Layers** at -1 (the default), all layers go to the GPU. The console prints:
```text
MacOS detected: Auto GPU layers set to maximum
```
* `Unable to determine GPU Memory` and `Unable to determine available RAM` in the console are expected on Apple Silicon and not a problem. When the launcher opens, it can also print `Unable to detect VRAM.`.
More: [Apple Silicon](https://koboldcpp.net/docs/hardware/apple-silicon/).
## Advanced: failsafe mode (no Metal)
`--failsafe` switches to a CPU-only library that uses Apple's Accelerate framework instead of Metal:
Terminal
```sh
./koboldcpp-mac-arm64 --failsafe
```
## Intel Macs
There is no ready-made file for Intel (x86) Macs. Clone the repository and compile it yourself; see [Build from source](https://koboldcpp.net/docs/install/from-source/#macos). Intel Macs are poorly supported.
## Related
* [Release files and system requirements](https://koboldcpp.net/docs/install/releases/)
* [Updating](https://koboldcpp.net/docs/install/updating/)
# Release files and system requirements
> Every file in a KoboldCpp release, which system and GPU it is for, and the CPU and CUDA requirements of each build.
Each release on GitHub contains one ready-to-run file per system and GPU type. You need **one** of them. For a quick pick, see [Download KoboldCpp](https://koboldcpp.net/download/).
All files come from the [latest release](https://github.com/LostRuins/koboldcpp/releases/latest). The **Source code** archives that GitHub adds to every release are not programs; don't download them to run KoboldCpp.
## The files
| File | System | GPU backends | CPU |
| ---------------------------- | -------------------- | --------------- | ----------------------------- |
| `koboldcpp.exe` | Windows x64 | CUDA 12, Vulkan | AVX2 (old-CPU modes included) |
| `koboldcpp-nocuda.exe` | Windows x64 | Vulkan | AVX2 (old-CPU modes included) |
| `koboldcpp-oldpc.exe` | Windows x64 | CUDA 11, Vulkan | AVX1 (no-AVX modes included) |
| `koboldcpp-linux-x64` | Linux x64 | CUDA 12, Vulkan | AVX2 (old-CPU modes included) |
| `koboldcpp-linux-x64-nocuda` | Linux x64 | Vulkan | AVX2 (old-CPU modes included) |
| `koboldcpp-linux-x64-oldpc` | Linux x64 | CUDA 11, Vulkan | AVX1 (no-AVX modes included) |
| `koboldcpp-mac-arm64` | macOS, Apple Silicon | Metal | not applicable |
Every file can also run on the CPU alone.
* **Main builds** (`koboldcpp.exe`, `koboldcpp-linux-x64`): for NVIDIA graphics cards on newer PCs.
* **nocuda builds**: the same without CUDA, and much smaller. For AMD or Intel graphics, no graphics card, or when you don't need CUDA. AMD users should try the **Vulkan** backend in this build first.
* **oldpc builds**: CUDA 11 and AVX1, for older processors and older NVIDIA cards, or when the main build crashes. They are also the only builds with GPU support (Vulkan) on processors without AVX.
* **Mac build**: for Apple Silicon (M-series) Macs. Intel Macs have no ready-made file; see [macOS](https://koboldcpp.net/docs/install/macos/).
There are no ready-made files for Windows on ARM or Linux on ARM. On ARM Linux, [build from source](https://koboldcpp.net/docs/install/from-source/).
## System requirements
KoboldCpp has no fixed RAM or VRAM minimum; what you need depends on the model. The launcher's newbie templates give a rough guide: LowSpec recommends 6 GB VRAM, MidSpec 12 GB, HighSpec 24 GB. See [Choose a model](https://koboldcpp.net/getting-started/model/).
More: [How much memory a model needs](https://koboldcpp.net/docs/models/memory/).
### Processor
The main and nocuda builds run at full speed on processors with **AVX2**. For older processors, every x64 build includes slower compatibility modes, and KoboldCpp usually switches to them automatically when it detects that your CPU lacks AVX2 or AVX.
See [Advanced: processor modes](#processor-avx2-avx-no-avx).
### Operating system
* **Windows:** x64. Windows 7 is not recommended; see [Windows 7](https://koboldcpp.net/docs/install/windows/#advanced-windows-7).
* **Linux:** x64 with glibc 2.29 or newer, for example Ubuntu 20.04 or newer. `ldd --version` shows your glibc version.
* **macOS:** Apple Silicon only, macOS 14 (Sonoma) or newer.
## Advanced: processor modes
You can pick a mode yourself, in the launcher's backend list or with a flag:
| Launcher backend | Flag | CPU needs | In builds |
| ----------------------------- | ------------------------ | ------------------------- | -------------- |
| **Use CUDA** | `--usecuda` | AVX2 (main), AVX1 (oldpc) | main, oldpc |
| **Use Vulkan** | `--usevulkan` | AVX2 | main, nocuda |
| **Use CPU** | `--usecpu` | AVX2 | main, nocuda |
| **Use CPU (Old CPU)** | `--noavx2` | AVX1 | all x64 builds |
| **Use Vulkan (Old CPU)** | `--usevulkan --noavx2` | AVX1 | all x64 builds |
| **Use Vulkan (Older CPU)** | `--usevulkan --failsafe` | SSE3 and SSSE3 | oldpc only |
| **Failsafe Mode (Older CPU)** | `--failsafe` | any x86-64 CPU | all x64 builds |
The launcher only lists backends that your build contains.
* `--noavx2` is a slower compatibility mode for processors without AVX2.
* `--failsafe` is an extremely slow mode that runs on any x86-64 processor. It implies `--noavx2`. Without `--usevulkan` it uses no GPU.
* On a processor with no AVX at all that should still use a graphics card, use an oldpc build and select **Use Vulkan (Older CPU)** yourself. The launcher may pick **Use Vulkan (Old CPU)**, which needs AVX.
More: [Old PCs and CPU-only](https://koboldcpp.net/docs/hardware/old-and-cpu-only/).
## Advanced: CUDA versions and NVIDIA cards
| Build | CUDA toolkit | Minimum NVIDIA driver | Compute capability compiled |
| ---------------------------------------------------------- | ------------ | ----------------------------------- | --------------------------- |
| Main (`koboldcpp.exe`, `koboldcpp-linux-x64`) | 12.1 | 531.14 (Windows), 530.30.02 (Linux) | 5.0, 6.1, 7.5, 8.0 |
| oldpc (`koboldcpp-oldpc.exe`, `koboldcpp-linux-x64-oldpc`) | 11.4 | 472.50 (Windows), 470.42.01 (Linux) | 3.5, 5.0, 6.1, 7.5 |
* The code is compiled as PTX, so newer cards compile it on first launch. That first start prints "Initializing CUDA/HIP, please wait, the following step may take a few minutes (only for first launch)".
* Kepler cards with compute capability 3.5 or higher (for example K40 and K80) are only covered by the oldpc builds. Compute capability 3.0 cards are not covered by any build; try Vulkan instead.
* If `nvidia-smi` reports "CUDA Version: 11.x" or "12.0", use the oldpc build, or update the driver.
## Advanced: the Mac build
`koboldcpp-mac-arm64` uses Metal. It also contains a CPU-only fallback that uses Accelerate without Metal; turn it on with `--failsafe`. See [macOS](https://koboldcpp.net/docs/install/macos/).
## Advanced: rolling builds
[Rolling builds](https://github.com/LostRuins/koboldcpp/releases/tag/rolling) are experimental pre-release builds that are updated automatically. They use the same file names as a normal release.
* They may be unstable, and sometimes don't start at all.
* They can support a new model architecture before the next release does.
* For stability and proper support, use the official releases.
## Advanced: ROCm build for AMD on Linux
An official ROCm build for AMD graphics cards on Linux, `koboldcpp-linux-x64-rocm`, is published under the [rocm-rolling](https://github.com/LostRuins/koboldcpp/releases/tag/rocm-rolling) tag. The official short link is `https://koboldai.org/cpplinuxrocm`.
* It is very experimental.
* It needs x64 Linux with glibc from Ubuntu 22.04 or newer.
* It brings its own ROCm 7 libraries. You don't need to install ROCm; the normal `amdgpu` kernel driver is enough.
* It is updated separately from the releases and can lag behind them: the file tested for these docs reported version 1.121 while the latest release was 1.122.1.
* Support is limited, because the maintainers don't have AMD devices themselves.
* There is no official ROCm build for Windows.
It is built for the Radeon RX 9000 series (gfx1200, gfx1201), RX 7000 series (gfx1100 to gfx1102), RX 6600 to RX 6950 XT (gfx1030 to gfx1032) and RX 5600/5700 (gfx1010), for older cards (RX 400/500 series: gfx803, Vega: gfx900, Radeon VII: gfx906) and for Instinct datacenter cards (gfx906, gfx908, gfx90a, gfx942).
To use ROCm, set **Backend:** to **Use hipBLAS (ROCm)**, or pass `--usecuda`.
For most AMD users, the **Vulkan** backend in the nocuda build is the recommended start. If generation is slow with Vulkan, try the ROCm build; see [GPU backends: ROCm](https://koboldcpp.net/docs/hardware/backends/#rocm).
## Advanced: old file names
Scripts that download older file names no longer work. The files were renamed and the old names were removed in v1.94:
| Old name | Current name |
| ------------------------------ | --------------------------- |
| `koboldcpp_cu12.exe` | `koboldcpp.exe` |
| `koboldcpp_nocuda.exe` | `koboldcpp-nocuda.exe` |
| `koboldcpp_oldcpu.exe` | `koboldcpp-oldpc.exe` |
| `koboldcpp-linux-x64-cuda1210` | `koboldcpp-linux-x64` |
| `koboldcpp-linux-x64-cuda1150` | `koboldcpp-linux-x64-oldpc` |
To always get the newest file, download from this address, with the file name at the end:
```text
https://github.com/LostRuins/koboldcpp/releases/latest/download/
```
## Other tools
The release notes link [conversion and quantization tools](https://kcpptools.concedo.workers.dev/) for making GGUF files.
## Related
* [Windows](https://koboldcpp.net/docs/install/windows/), [Linux](https://koboldcpp.net/docs/install/linux/), [macOS](https://koboldcpp.net/docs/install/macos/)
* [Updating](https://koboldcpp.net/docs/install/updating/)
* [Staying safe](https://koboldcpp.net/docs/install/staying-safe/)
# Staying safe: where to download KoboldCpp, and known fake sites
> Where to get KoboldCpp safely, how to check a downloaded file, and why antivirus may flag the Windows exe.
Download KoboldCpp only from legitimate sources. The recommended is the official GitHub releases: [github.com/LostRuins/koboldcpp/releases/latest](https://github.com/LostRuins/koboldcpp/releases/latest).
Beware of fake sites
You should **ONLY** trust official downloads from the release binaries linked here and the official KoboldCpp Github at
## Official sources
| What | Where |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Project | [github.com/LostRuins/koboldcpp](https://github.com/LostRuins/koboldcpp) |
| Downloads | [Latest stable release](https://github.com/LostRuins/koboldcpp/releases/latest), experimental builds at [rolling](https://github.com/LostRuins/koboldcpp/releases/tag/rolling) and [rocm-rolling](https://github.com/LostRuins/koboldcpp/releases/tag/rocm-rolling) tags on GitHub |
| Colab notebook | [Official KoboldCpp Colab Notebook](https://colab.research.google.com/github/LostRuins/koboldcpp/blob/concedo/colab.ipynb) |
| Docker image | [hub.docker.com/r/koboldai/koboldcpp](https://hub.docker.com/r/koboldai/koboldcpp) |
| Website | |
| Short links | Anything starting with `koboldai.org`, e.g. `koboldai.org/cpplinuxrocm`, `koboldai.org/colabcpp`, `koboldai.org/runpodcpp`, `koboldai.org/discord` |
| Official resources | [Official links and mirrors](https://koboldcpp.net/links/) |
The official downloads are on the [KoboldCpp Github releases](https://github.com/LostRuins/koboldcpp/releases/latest) page, koboldcpp.net links directly to them. Files from any other site are not official and may contain malware.
## Known fake sites
Here is an incomplete list of fake websites we know about. **Do not visit or download KoboldCpp from any of these sites**:
* koboldcpp\[.]com : Fake site that actively serves malicious downloads through javascript pop-ups.
* koboldcpp\[.]cc : Fake site that actively serves malicious downloads through javascript pop-ups. Same owner as the above.
* kobold-ai\[.]com : Fake site that redirects to a fake chatbot site called CrushOn.
* koboldcpp\[.]store : Fake site filled with AI generated misinformation, harvests emails and directs to fake downloads.
* koboldcpp\[.]org : Fake site filled with AI generated misinformation.
## Why antivirus may flag KoboldCpp
Some antivirus programs report KoboldCpp's Windows exe as a trojan or "suspicious". For a file from the official releases, this is a false positive:
* The exe is a self-extracting bundle that unpacks libraries into a temporary folder when it starts, which heuristic and machine-learning scanners can flag.
* The files are not code-signed. The maintainers don't buy signing certificates.
What to do:
1. Check that the file came from the [official releases](https://github.com/LostRuins/koboldcpp/releases/latest), for example by [comparing its checksum](#check-a-downloaded-file).
2. Add it to your antivirus exceptions, and report the false positive to your antivirus vendor.
3. If the file was quarantined or damaged, download it again.
On Windows, SmartScreen can show "Windows protected your PC"; see [Windows](https://koboldcpp.net/docs/install/windows/#smartscreen-and-antivirus-warnings). On macOS, Gatekeeper blocks unsigned files until you allow them; see [macOS](https://koboldcpp.net/docs/install/macos/).
## Check a downloaded file
The release page shows a SHA-256 checksum (`sha256:…`) next to each file. In a terminal, in the folder with your file, compute its checksum (use your file name) and compare the two:
| System | Command |
| -------------------- | ----------------------------------- |
| Windows (PowerShell) | `Get-FileHash koboldcpp.exe` |
| Linux | `sha256sum koboldcpp-linux-x64` |
| macOS | `shasum -a 256 koboldcpp-mac-arm64` |
Letter case doesn't matter. If the checksums differ, the file is damaged or not the official one; delete it and download it again from the [official releases](https://github.com/LostRuins/koboldcpp/releases/latest).
## Related
* [Release files and system requirements](https://koboldcpp.net/docs/install/releases/)
* [Download KoboldCpp](https://koboldcpp.net/download/)
# Update to a new version
> Update KoboldCpp by downloading the new release file. Your saved .kcpps configs and your models carry over.
KoboldCpp has no automatic updater. To update, download the new file and use it instead of the old one.
1. If you haven't yet, save your settings: click **Save Config** in the launcher. It writes a `.kcpps` file.
2. Click **Update** in the launcher, or go to the [latest release](https://github.com/LostRuins/koboldcpp/releases/latest). **Update** only opens that page in your browser.
3. Download the same file you use now, for example `koboldcpp.exe`. See [Release files](https://koboldcpp.net/docs/install/releases/) if you are unsure.
4. Replace the old file with the new one. On Linux and macOS, run `chmod +x` on the new file.
5. Start it and load your settings with **Load Config**.
Your models are separate files and stay where they are.
## Which version you have
* The launcher's window title shows it: `KoboldCpp v…`.
* `--version` on its own prints the version and exits:
Terminal
```sh
./koboldcpp --version
```
## Why update
New model architectures need a newer KoboldCpp. If a model fails with `unknown model architecture`, update first.
## Your settings
A `.kcpps` config holds your launch settings. You can load it three ways:
* **Load Config** in the launcher
* drag the `.kcpps` file onto the exe (Windows)
* `--config mysettings.kcpps` on the command line
Configs saved by older versions can keep old settings; see [Config files (.kcpps)](https://koboldcpp.net/docs/settings/config-files/#old-config-files).
## Old file names
The file names changed in the past, and the old names no longer exist. If a script downloads `koboldcpp_cu12.exe` or a similar name, update it; see [old file names](https://koboldcpp.net/docs/install/releases/#advanced-old-file-names).
## Colab and Docker
* **Colab:** the notebook downloads the latest release every time it runs.
* **Docker:** the image downloads the latest KoboldCpp when the container starts, unless `KCPP_DONT_UPDATE=true` is set. The image itself only changes when its Docker setup changes; when it does, get it with `docker pull koboldai/koboldcpp`.
## Advanced: rolling builds
[Rolling builds](https://koboldcpp.net/docs/install/releases/#advanced-rolling-builds) are updated automatically and may be unstable. For stability and proper support, use the official releases.
## Advanced: source builds and Termux
* **`koboldcpp.sh`:** after pulling the new source, run `./koboldcpp.sh rebuild`. See [Build from source](https://koboldcpp.net/docs/install/from-source/#koboldcppsh-linux).
* **Android (Termux):** re-running the setup script does not rebuild an existing install. See [Android](https://koboldcpp.net/docs/install/android/#updating).
## Related
* [Release files and system requirements](https://koboldcpp.net/docs/install/releases/)
* [Staying safe](https://koboldcpp.net/docs/install/staying-safe/)
# Install on Windows (SmartScreen, antivirus)
> Download and run KoboldCpp on Windows, get past SmartScreen and antivirus warnings, and use it from the command line.
KoboldCpp for Windows is a single `.exe` file. There is no installer.
1. Pick your file. Most NVIDIA users need `koboldcpp.exe`; see [Download KoboldCpp](https://koboldcpp.net/download/) for the others.
| Your PC | File |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------- |
| NVIDIA graphics card | [`koboldcpp.exe`](https://github.com/LostRuins/koboldcpp/releases/latest/download/koboldcpp.exe) |
| AMD, Intel or no graphics card | [`koboldcpp-nocuda.exe`](https://github.com/LostRuins/koboldcpp/releases/latest/download/koboldcpp-nocuda.exe) |
| Older processor or older NVIDIA card | [`koboldcpp-oldpc.exe`](https://github.com/LostRuins/koboldcpp/releases/latest/download/koboldcpp-oldpc.exe) |
2. Put the file in a folder of its own, for example `C:\mystuff`. When you start it by double-clicking, models that KoboldCpp downloads for you are saved in this folder. **Download Dir:** on the **Loaded Files** tab changes that. Use a path with plain ASCII characters (no umlauts or other accented letters).
3. Double-click the file. A console window opens, then the launcher.
If Windows shows "Windows protected your PC", click **More info**, then **Run anyway**. This is expected: the file is not signed.
Continue with [Choose a model](https://koboldcpp.net/getting-started/model/).
## SmartScreen and antivirus warnings
KoboldCpp's exe files are not code-signed, and they unpack their libraries into a temporary folder when they start. Some antivirus programs flag this as suspicious. These are false positives, as long as the file came from the [official GitHub releases](https://github.com/LostRuins/koboldcpp/releases/latest). See [Staying safe](https://koboldcpp.net/docs/install/staying-safe/).
| What you see | What to do |
| ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| "Windows protected your PC" (SmartScreen) | Click **More info**, then **Run anyway**. |
| Microsoft Defender or another antivirus reports a trojan or "suspicious" file, or deletes it | Restore or re-download the file, add it to your antivirus exceptions, and report the false positive to your antivirus vendor. |
| The exe shrinks to 0 bytes, or "Failed to extract … decompression resulted in return code -3!" | The file is damaged, often by your antivirus. Download it again; if it happens again, add an exception. |
| Smart App Control blocks it | Smart App Control has no exception list. It blocks KoboldCpp for as long as it is turned on. |
## If the window closes straight away
When KoboldCpp crashes, the console window can close before you can read the error. Run it from Command Prompt instead, so the message stays on screen:
1. Press the Windows key, type `cmd` and press Enter.
2. Type `cd` followed by the folder with your file and press Enter. Then type your file's name and press Enter:
Command Prompt
```sh
cd C:\mystuff
koboldcpp.exe
```
KoboldCpp writes no log file by itself. Errors from the launcher appear in a message box.
Common causes:
* **Your processor lacks AVX2, or your NVIDIA card or driver is old.** Errors like `WinError 1114` or `0xc000001d` often mean this. Use `koboldcpp-oldpc.exe`, or update your NVIDIA driver. See [System requirements](https://koboldcpp.net/docs/install/releases/#system-requirements).
* **The console stays blank and the launcher never appears.** KoboldCpp could not unpack itself. It needs about 1 GB of free space for temporary files on the system drive, and antivirus software can block the unpacking. Free up space, or try the smaller `koboldcpp-nocuda.exe`.
* **Antivirus removed part of the file.** See the table above.
More: [KoboldCpp won't start](https://koboldcpp.net/docs/troubleshooting/wont-start/).
## Using the command line
Pass flags after the file name. With a model, KoboldCpp skips the launcher and starts straight away:
Command Prompt
```sh
C:\mystuff\koboldcpp.exe --model C:\models\mymodel.gguf --contextsize 8192
```
* `koboldcpp.exe --help` lists all flags. They are also in the [flag reference](https://koboldcpp.net/docs/reference/flags/).
* `--config mysettings.kcpps` starts with a saved configuration.
* The launcher opens a browser after loading; on the command line, add `--launch` for the same.
* The launcher is not accessible to screen readers. Screen reader users can run KoboldCpp entirely from the command line.
More: [Command line](https://koboldcpp.net/docs/settings/command-line/).
## Advanced: unpack for faster startup
The exe unpacks itself every time it starts. To skip that, unpack it once into an empty folder, then start `koboldcpp-launcher.exe` in that folder. It needs no Python installation.
Command Prompt
```sh
koboldcpp.exe --unpack C:\kobold-unpacked
```
In the launcher, the same is on the **Extra** tab: **Unpack KoboldCpp To Folder**. The target folder must be empty.
## Advanced: open files with KoboldCpp
On the **Extra** tab, **Register** makes KoboldCpp the program that opens `.gguf`, `.ggml`, `.kcpps` and `.kcppt` files for your user account. **Unregister** removes this. It only works with the standalone exe.
## Advanced: Windows 7
Windows 7 is not recommended. The main builds use functions that only exist in Windows 8 and newer.
* Use `koboldcpp-oldpc.exe`. Its libraries skip the Windows 8 functions.
* If it still fails with an error about `msvcp140.dll` or `GetSystemTimePreciseAsFileTime`, one user fixed it by [unpacking KoboldCpp](#advanced-unpack-for-faster-startup) and replacing the `msvcp140.dll` in the unpacked folder with an older version. Don't replace the one in Windows itself.
* `DLL load failed while importing pyexpat` was fixed by installing the Windows update KB3063858.
* The third-party VxKex compatibility layer can make the main builds run.
* CUDA on Windows 7 is untested.
## Related
* [Release files and system requirements](https://koboldcpp.net/docs/install/releases/)
* [Updating](https://koboldcpp.net/docs/install/updating/)
* [Build from source on Windows](https://koboldcpp.net/docs/install/from-source/#windows)
# GGUF and quantization
> What GGUF files are, which older formats KoboldCpp still loads, what quant names like Q4_K_M mean, and how to pick one.
KoboldCpp runs models in the **GGUF** format (files ending in `.gguf`). A GGUF file contains the model's weights and its metadata in one file. Most GGUF models work in KoboldCpp. A model with a new architecture needs a KoboldCpp version that supports it.
Most models come in several versions of different sizes, called **quants**. The quant is part of the file name, for example `Q4_K_M` in `gemma-3-4b-it-Q4_K_M.gguf`.
## Choosing a quant
* Start with **Q4\_K\_M** or **Q4\_K\_S**. The beginner models recommended by KoboldCpp use these.
* Within the K-quants (`Q2_K` up to `Q6_K`) of the same model, a bigger file means better quality and more memory. Pick the biggest one that fits your memory together with your context. See [How much memory a model needs](https://koboldcpp.net/docs/models/memory/).
* Compare file sizes only within one quant family. `Q4_1` is bigger than `Q4_K_M` but has lower quality, and `Q5_1` is bigger than `Q5_K_M` but has lower quality.
* Below Q4, quality drops quickly (see the table below).
## Quant names
| Family | Names | Notes |
| ------------- | ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| K-quants | `Q2_K`, `Q3_K_S`, `Q3_K_M`, `Q3_K_L`, `Q4_K_S`, `Q4_K_M`, `Q5_K_S`, `Q5_K_M`, `Q6_K` | The usual choice. The number is the approximate bits per weight. |
| Legacy quants | `Q4_0`, `Q4_1`, `Q5_0`, `Q5_1`, `Q8_0` | Older types. `Q8_0` is the largest quant and the closest to the original. |
| I-quants | `IQ1_S`, `IQ1_M`, `IQ2_XXS`, `IQ2_XS`, `IQ2_S`, `IQ2_M`, `IQ3_XXS`, `IQ3_XS`, `IQ3_S`, `IQ3_M`, `IQ4_XS`, `IQ4_NL` | The number is the approximate bits per weight. For the same number, the suffix gives the size: `XXS` is the smallest, then `XS`, `S` and `M`. |
| Unquantized | `F16`, `BF16` | 16 bits per weight, about twice the size of `Q8_0`. |
`Q3_K`, `Q4_K` and `Q5_K` without a suffix are other names for `Q3_K_M`, `Q4_K_M` and `Q5_K_M`.
`_S`, `_M` and `_L` (small, medium, large) mix quant types inside one file: some tensors get a larger type. That is why `Q4_K_S` and `Q4_K_M` differ in size although both are "Q4\_K".
### Size and quality loss per quant
llama.cpp's quantize tool lists these reference values for Llama-3-8B. "Quality loss" is the increase in perplexity compared with the original model; lower is better.
| Quant | File size | Quality loss |
| -------- | --------- | ------------ |
| `Q2_K` | 2.96 GB | +3.5199 |
| `Q3_K_S` | 3.41 GB | +1.6321 |
| `Q3_K_M` | 3.74 GB | +0.6569 |
| `Q3_K_L` | 4.03 GB | +0.5562 |
| `Q4_0` | 4.34 GB | +0.4685 |
| `Q4_K_S` | 4.37 GB | +0.2689 |
| `Q4_K_M` | 4.58 GB | +0.1754 |
| `Q4_1` | 4.78 GB | +0.4511 |
| `Q5_0` | 5.21 GB | +0.1316 |
| `Q5_K_S` | 5.21 GB | +0.1049 |
| `Q5_K_M` | 5.33 GB | +0.0569 |
| `Q5_1` | 5.65 GB | +0.1062 |
| `Q6_K` | 6.14 GB | +0.0217 |
| `Q8_0` | 7.96 GB | +0.0026 |
Other models have other file sizes; the table shows how the quants compare with each other.
## Inspect a model file
On the **Extra** tab, **Analyze Model** reads the metadata, weight types and tensor names of a GGUF or safetensors file. On the command line (`koboldcpp` stands for your KoboldCpp file; see [Command line](https://koboldcpp.net/docs/settings/command-line/)):
Terminal
```sh
koboldcpp --analyze mymodel.gguf
```
## Other formats
KoboldCpp does not load text models in safetensors or PyTorch `.bin` format directly. For most models, someone has already published GGUF files; see [Where to get models](https://koboldcpp.net/docs/models/where-to-get-models/).
To convert a model yourself:
1. Download the [conversion and quantization tools](https://kcpptools.concedo.workers.dev/).
2. Run `convert_hf_to_gguf.py` on the model to get a GGUF file. It needs Python 3 with the packages from KoboldCpp's `requirements.txt`, including PyTorch and `transformers`.
3. Run `quantize_gguf.exe` on that file to make a smaller quant. The tools contain only the Windows exe; on Linux and macOS, build `quantize_gguf` from the [KoboldCpp source](https://koboldcpp.net/docs/install/from-source/) with `make quantize_gguf`.
For example, to make a `Q4_K_M` quant of a model downloaded into the folder `mymodel`:
Terminal
```sh
python convert_hf_to_gguf.py mymodel --outfile mymodel-16bit.gguf
quantize_gguf.exe mymodel-16bit.gguf mymodel-Q4_K_M.gguf Q4_K_M
```
* `convert_hf_to_gguf.py ` writes a 16-bit GGUF by default. `--outtype` picks another type: `f32`, `f16`, `bf16` or `q8_0`. For vision models, a second run with `--mmproj` writes the projector file; this works only for some models.
* `quantize_gguf