The KoboldCpp API: one server, many compatible endpoints
KoboldCpp's API runs on the same address as its web page, http://localhost:5001 by default, and it starts automatically with the model: there is nothing to enable. KoboldAI-style apps use that address as is, OpenAI-style apps add /v1, and Ollama-style apps use it as an Ollama server. There is no API key unless you start KoboldCpp with --password; then that password is the key. We tested the main routes on KoboldCpp 1.124.2.
Checked against KoboldCpp 1.124.2 · updated 13 Nov 2026
- lab-lnx: Linux test VM · 4 vCPU · 15 GB · no GPU
- gha-w25: Windows Server 2025 test machine · 4 vCPU · 16 GB · no GPU
- gha-w22: Windows Server 2022 test machine · 4 vCPU · 16 GB · no GPU
- gha-u24: Ubuntu 24.04 test machine · 4 vCPU · 16 GB · no GPU
On this page
Pick your path
- Connect SillyTavernThe most common question: the URL, the API type and what to select.
- Use an OpenAI SDK or an OpenAI-style appBase URL, chat, streaming and what is supported.
- The KoboldAI native APIGenerate, stream, count tokens, check the model.
- Janitor AI, Open WebUI, VS Code, n8nOther apps and how to point them at KoboldCpp.
- Use it from a phone or the internetLAN address, tunnels, HTTPS and passwords.
- Share it with othersAI Horde, parallel requests and admin mode.
Your KoboldCpp API URL
The API and the web page share one address. By default that is http://localhost:5001: the host is your own PC and the port is set by TCP port for the web UI and all APIs. Default 5001.Default 5001Launcher Network tab: Host / PortSince v1.0.8betaAll details (default 5001) F05. Lite opens at that address in a browser F31.
| KoboldAI | http://localhost:5001 | KoboldAI Lite, SillyTavern (KoboldCpp or Text Completion) |
| OpenAI | http://localhost:5001/v1 | OpenAI SDKs, Open WebUI, coding tools |
| Ollama | http://localhost:5001 | Apps that offer an Ollama server option |
The address changes when you change the port, when the app runs on another device (use the PC’s LAN address instead of localhost, see remote access), when you use a tunnel (an https:// address with no port, see tunnels), and on Colab or a cloud GPU, which give you their own address.
Do you need an API key?
No, unless you started KoboldCpp with API key that clients must send to use text endpoints (image endpoints are not protected). Also settable via KCPP_PASSWORD.Default noneLauncher Network tab: PasswordSince v1.61All details. Then the password is the key, and clients send it as Authorization: Bearer <key>. You can also set it with the KCPP_PASSWORD environment variable. --adminpassword is a different password, for admin functions such as model switching. We tested a server started with a password F25:
| POST /api/v1/generate | 401 | 401 | 200 |
| POST /v1/chat/completions | 401 | not tested | not tested |
| GET /api/v1/model | 200 | not tested | not tested |
| GET / (the web page) | 200 | not tested | not tested |
The password protects generation, not discovery: the web page and /api/v1/model stay reachable without the key, and /api/v1/model then hides the model name (koboldcpp/protected-model). /v1/models still shows the real name, even for a wrong key F72. KoboldCpp’s help says image endpoints are not protected; we have not tested that. If an app insists on a key and you set no password, users report that any text works; we have not tested it.
Which API should I use?
| KoboldAI | Lite, SillyTavern, KoboldAI-era tools | /api/v1, /api/extra | KoboldAI API |
| OpenAI | SDKs, Open WebUI, Janitor AI, coding tools | /v1/* | OpenAI API |
| Anthropic | Apps that speak the Anthropic Messages API (basic since 1.111, full since 1.115, per release notes; we have not tested it) | /v1/messages | Anthropic |
| Ollama | Apps that offer an Ollama server | /api/chat, /api/generate, /api/tags | Ollama |
| A1111, ComfyUI, OpenAI images | Image generation clients | /sdapi/v1/*, /v1/images/* | Image API |
| Whisper and TTS | Speech to text and text to speech | /v1/audio/* | Voice API |
| Embeddings, MCP | Vector search, tool servers | /v1/embeddings, /mcp | Embeddings |
| Admin | Switching models, saving config | /api/admin/* | Admin |
Check your server
With the model loaded, open the address in a browser on the same PC: the Lite page should appear. Then ask for the version and the model from a terminal:
$ curl http://localhost:5001/api/extra/version
$ curl http://localhost:5001/api/v1/model
$ curl http://localhost:5001/v1/modelsIf those answer, the server is up and any failure is in the app’s settings. Or check from the browser:
Requests go from your browser straight to the address you typed. Nothing is sent to koboldcpp.dev, and the password is never put in a share link.
The full tester also builds requests and lists the settings for the clients we connected.
Every endpoint
All 100 routes from KoboldCpp’s own code, with our status. “Works” means we called it and got a 200 on 1.124.2 (F23); everything else is untested by us. Filter by family or search.
| Main parameters | ||||||
|---|---|---|---|---|---|---|
| GET | / | UI pages | Serves the bundled KoboldAI Lite web UI (gzip when supported). | no | works F23 | |
| GET | /noscript | UI pages | Server-rendered UI that works without JavaScript (chat and image gen). | no | untested | |
| GET | /lcpp/ | UI pages | Bundled llama.cpp web UI; /lcpp redirects to /lcpp/ and /lcpp/* paths are mapped to root API paths. | no | untested | |
| GET | /sdui | UI pages | StableUI image/video generation front end. | no | untested | |
| GET | /musicui | UI pages | Music generation UI (ACE-Step/YuE2), also with a transcription tab. | no | untested | |
| GET | /api | UI pages | Interactive Swagger API documentation page (title 'KoboldCpp API'). | no | untested | |
| GET | /manifest.json | UI pages | PWA manifest so Kobold Lite can be installed as an app. | no | untested | |
| POST | /api/v1/generate | KoboldAI | Classic KoboldAI text generation: prompt plus sampler settings, returns the full result. | max_context_length max_length prompt rep_pen rep_pen_range sampler_order | yes | works F23 |
| GET | /api/v1/model | KoboldAI | Name of the loaded text model (masked when a password is set and not supplied). | yes | works F23 | |
| GET | /api/v1/config/max_length | KoboldAI | Default generation length the server advertises. | yes | works F23 | |
| GET | /api/v1/config/max_context_length | KoboldAI | Context length the server advertises to clients. | yes | works F23 | |
| GET | /api/v1/config/soft_prompt | KoboldAI | Stub kept for KoboldAI client compatibility (soft prompts not supported). | no | untested | |
| GET | /api/v1/config/soft_prompts_list | KoboldAI | Stub returning an empty soft-prompt list for compatibility. | no | untested | |
| GET | /api/v1/info/version | KoboldAI | KoboldAI United API version that KoboldCpp emulates. | yes | works F23 | |
| GET | /api/v1 | KoboldAI | Bare API root; redirects (302) to the /api docs page. | no | untested | |
| POST | /api/extra/generate/stream | Extra | Same as /api/v1/generate but streams tokens as Server-Sent Events. | max_context_length max_length prompt rep_pen rep_pen_range sampler_order | yes | works F23 |
| GET | /api/extra/generate/check | Extra | Returns the partial text of the generation in progress. | yes | untested | |
| POST | /api/extra/generate/check | Extra | Partial text of an in-progress generation identified by genkey (multi-user safe). | genkey | yes | untested |
| POST | /api/extra/abort | Extra | Stops the current generation (optionally only for a given genkey). | genkey | yes | untested |
| GET | /api/extra/version | Extra | KoboldCpp version and a feature/capability list (vision, audio, image gen, TTS, etc.). | yes | works F23 | |
| GET | /api/extra/true_max_context_length | Extra | The real --contextsize loaded at launch (not advertised to Horde). | yes | works F23 | |
| GET | /api/extra/perf | Extra | Timing and usage statistics of recent generations, queue state, uptime. | yes | works F23 | |
| GET | /api/extra/last_logprobs | Extra | Token log-probabilities of the latest request. | yes | untested | |
| POST | /api/extra/last_logprobs | Extra | Token log-probabilities for the request with a given genkey. | genkey | yes | untested |
| POST | /api/extra/tokencount | Extra | Tokenizes text and returns the token count and ids. | prompt | yes | works F23 |
| POST | /api/extra/detokenize | Extra | Turns a list of token ids back into text. | ids | yes | untested |
| POST | /api/extra/json_to_grammar | Extra | Converts a JSON schema into a GBNF grammar for constrained sampling. | schema | yes | untested |
| GET | /api/extra/preloadstory | Extra | Returns the story preloaded with --preloadstory. | yes | untested | |
| POST | /api/extra/websearch | Extra | Runs a DuckDuckGo web search through the server (needs --websearch) and returns top results. | q | yes | untested |
| POST | /api/extra/data/list | Extra | Lists save slots in the server-side save database (--savedatafile). | yes | untested | |
| POST | /api/extra/data/load | Extra | Loads a save slot from the server-side database. | slot | yes | untested |
| POST | /api/extra/data/save | Extra | Writes data to a server-side save slot. | slot format title data | yes | untested |
| POST | /api/extra/multiplayer/status | Extra | Multiplayer session turn info (--multiplayer). | senderbusy sender | yes | untested |
| POST | /api/extra/multiplayer/getstory | Extra | Fetches the shared multiplayer story (compressed). | yes | untested | |
| POST | /api/extra/multiplayer/setstory | Extra | Updates the shared multiplayer story and advances the turn. | full_update sender data_format data | yes | untested |
| POST | /api/extra/shutdown | Admin | Shuts the server down (only allowed in specific setups; password-protected). | yes | untested | |
| GET | /v1/models | OpenAI | OpenAI-style model list: the loaded model, plus admin-dir configs in router mode. | yes | works F23 | |
| POST | /v1/completions | OpenAI | OpenAI text completions (supports streaming and KoboldCpp sampler extras). | model prompt max_tokens max_completion_tokens temperature top_p | yes | works F23 |
| POST | /v1/chat/completions | OpenAI | OpenAI chat completions with streaming, tools/function calling, vision/audio content and JSON/structured output. | model messages max_tokens max_completion_tokens temperature top_p | yes | works F23 |
| POST | /v1/responses | OpenAI | Experimental emulation of the OpenAI Responses API. | model input instructions max_tokens temperature top_p | yes | works F72 |
| POST | /v1/embeddings | OpenAI | OpenAI-style embedding vectors (needs --embeddingsmodel). | model input encoding_format truncate | yes | works F23 |
| POST | /v1/images/generations | OpenAI | OpenAI-style image generation (needs --sdmodel). | model prompt size response_format n | yes | untested |
| POST | /v1/images/edits | OpenAI | OpenAI-style multipart image edit with optional mask. | image mask prompt model size response_format | yes | untested |
| POST | /v1/audio/transcriptions | Whisper | OpenAI-style speech-to-text upload (needs --whispermodel); the wiki notes WAV input is safest. | file model prompt language | yes | untested |
| POST | /v1/audio/speech | TTS | OpenAI-style text-to-speech (needs --ttsmodel); wav or mp3 output. | model input voice speaker_wav speaker_json response_format | yes | untested |
| GET | /v1/audio/voices | TTS | Lists voices available for the speech endpoint. | yes | untested | |
| GET | /v1 | OpenAI | Bare /v1 root; returns a short pointer response. | no | untested | |
| POST | /v1/messages | Anthropic | Anthropic Messages API emulation (system, tools, streaming, thinking). | model messages system max_tokens temperature top_p | yes | works F72 |
| POST | /api/generate | Ollama | Ollama-style generate endpoint. | model prompt system context stream stop | yes | works F23 |
| POST | /api/chat | Ollama | Ollama-style chat endpoint with streaming and tools. | model messages tools stream | yes | works F23 |
| POST | /api/embed | Ollama | Ollama-style embeddings. | no | untested | |
| GET | /api/tags | Ollama | Ollama-style list of models (the loaded one). | yes | works F23 | |
| GET | /api/version | Ollama | Ollama-style version reply (a fake Ollama version, not the KoboldCpp version). | no | works F72 | |
| POST | /api/show | Ollama | Ollama-style model details. | no | works F72 | |
| POST | /sdapi/v1/txt2img | A1111 | A1111/Forge-compatible text-to-image (also video for video models). | prompt negative_prompt cfg_scale steps width height | yes | untested |
| POST | /sdapi/v1/img2img | A1111 | A1111-compatible image-to-image and inpainting. | prompt negative_prompt cfg_scale steps width height | yes | untested |
| POST | /sdapi/v1/interrogate | A1111 | Captions an image using the loaded vision model. | image model | yes | untested |
| POST | /sdapi/v1/upscale | A1111 | Upscales an image with the ESRGAN model (--sdupscaler). | image upscaling_resize | yes | untested |
| GET | /sdapi/v1/sd-models | A1111 | Lists the loaded image model. | yes | works F23 | |
| GET | /sdapi/v1/options | A1111 | Image-generation config info. | yes | untested | |
| GET | /sdapi/v1/samplers | A1111 | Supported samplers. | yes | untested | |
| GET | /sdapi/v1/schedulers | A1111 | Supported schedulers. | yes | untested | |
| GET | /sdapi/v1/loras | A1111 | Available image LoRAs. | yes | untested | |
| GET | /sdapi/v1/upscalers | A1111 | Available upscalers (ESRGAN if loaded). | yes | untested | |
| GET | /sdapi/v1/latent-upscale-modes | A1111 | Latent upscale modes (compatibility list). | yes | untested | |
| GET | /sdapi/v1/progress | A1111 | Progress of the running image generation. | genkey skip_current_image | yes | untested |
| GET | /sdapi/v1/get_last.json | A1111 | Cached result of a previous image generation by genkey. | genkey | yes | untested |
| POST | /prompt | ComfyUI | ComfyUI-style workflow submission, mapped onto the internal image generator. | no | untested | |
| GET | /history | ComfyUI | ComfyUI-style history of generated images (also /history/<id>). | no | untested | |
| GET | /view | ComfyUI | ComfyUI-style image download (also /view_image...). | no | untested | |
| POST | /api/upload/image | ComfyUI | ComfyUI-style input image upload. | no | untested | |
| GET | /system_stats | ComfyUI | ComfyUI-style system stats stub. | no | untested | |
| GET | /object_info | ComfyUI | ComfyUI-style node info stub. | no | untested | |
| GET | /api/models/checkpoints | ComfyUI | ComfyUI-style checkpoint list. | no | untested | |
| GET | /api/models/loras | ComfyUI | ComfyUI-style LoRA list. | no | untested | |
| GET | /ws | ComfyUI | WebSocket upgrade used by ComfyUI clients for progress events. | no | untested | |
| POST | /api/extra/transcribe | Whisper | Native speech-to-text (base64 audio or file). | audio_data prompt langcode language suppress_non_speech file | yes | untested |
| POST | /api/extra/music/transcribe | Whisper | Transcribes music/audio to text and ABC notation (SheetSage2 model). | audio_data prompt langcode language suppress_non_speech file | yes | untested |
| POST | /api/extra/tts | TTS | Native TTS; /tts_to_audio is the XTTS-compatible alias. | input voice speaker_wav speaker_json instructions language | yes | untested |
| GET | /api/extra/speakers_list | TTS | List of TTS speakers (XTTS-compatible). | yes | untested | |
| GET | /speakers | TTS | XTTS-compatible speaker list. | no | untested | |
| GET | /get_tts_settings | TTS | XTTS-compatible settings stub. | no | untested | |
| POST | /set_tts_settings | TTS | XTTS-compatible settings stub (accepts and ignores). | no | untested | |
| GET | /voice/check | TTS | AllTalk/VITS-style voice compatibility stubs (unverified exact client). | no | untested | |
| POST | /api/extra/embeddings | Extra | Native embeddings endpoint. | model input truncate | yes | untested |
| POST | /api/extra/music/prepare | Music | Prepares song parameters (caption, lyrics, BPM, duration, key) before generation. | caption lyrics bpm duration keyscale timesignature | yes | untested |
| POST | /api/extra/music/generate | Music | Generates music from captions/lyrics and settings (ACE-Step or YuE2). | caption lyrics bpm duration keyscale timesignature | yes | untested |
| GET | /api/admin/list_options | Admin | Lists .kcpps/.kcppt/.gguf choices in --admindir. | yes | untested | |
| POST | /api/admin/reload_config | Admin | Switches to another config/model in --admindir (or unloads); restarts the backend. | filename baseconfig | yes | untested |
| POST | /api/admin/check_state | Admin | Size of existing KV save states and the prediction for a new one. | yes | untested | |
| POST | /api/admin/save_state | Admin | Saves the current KV cache to a memory slot. | slot | yes | untested |
| POST | /api/admin/load_state | Admin | Restores a saved KV cache slot. | slot | yes | untested |
| POST | /api/admin/clear_state | Admin | Frees all KV save states. | yes | untested | |
| POST | /mcp | MCP | JSON-RPC proxy to the MCP tool servers configured with --mcpfile (GET returns 405). | jsonrpc id method params | yes | untested |
| GET | /props | llama.cpp | llama.cpp-server-style properties: chat template, context size, modalities; 'router' role in router mode. | yes | untested | |
| GET | /slots | llama.cpp | llama.cpp-server compatibility; always returns 501 (not supported). | no | untested | |
| GET | /.well-known/serviceinfo | Extra | Service identity document listing which APIs this server provides. | yes | untested | |
| GET | /ping | Extra | Health check for serverless hosts (added v1.97). | no | untested | |
| OPTIONS | * | Extra | CORS preflight / header-only responses for any path. | no | untested | |
| HEAD | * | Extra | CORS preflight / header-only responses for any path. | no | untested |
Notes from the source: OpenAI-style paths are also served without the /v1 prefix (for example /chat/completions); most handlers match on the end of the path, so /lcpp/... reaches the same handlers; and in router mode (--routermode) a proxy sits in front.
Streaming
There is no server switch for streaming: the client asks for it with each request. KoboldCpp streams as server-sent events in two shapes F23:
data: {"token": " three, four, five,", "finish_reason": null}1data: {"token": "", "finish_reason": "length"}2- data: {"token": " three, four, five,", "finish_reason": null}: The first event: a piece of text.
- data: {"token": "", "finish_reason": "length"}: The last event: the reply hit its length limit.
data: {"id": "chatcmpl-A3023341", "object": "chat.completion.chunk", "created": 1794574088, "model": "koboldcpp/qwen2.5-0.5b-instruct-q4_k_m", "choices": [{"ind…1data: [DONE]2- data: {"id": "chatcmpl-A3023341", "object": "chat.completion.chunk", ": The first chunk, shortened.
- data: [DONE]: The stream ends with this line.
Lite has its own streaming toggle: Lite settings.
Gotchas we found
- Two version numbers.
/api/v1/info/versionanswers1.2.5, the version of the KoboldAI API KoboldCpp emulates. KoboldCpp’s own version is at/api/extra/version:1.124.2F24. /api/extra/versionlists what is loaded. It reports which features are available, as captured on a text-only server F24:
- version
- 1.124.2
- protected
- false
- llm
- true
- txt2img
- false
- vision
- false
- transcribe
- false
- tts
- false
- embeddings
- false
- jinja
- false
- mcp
- false
- parallelrequests
- 1
With a vision, Whisper and embeddings model loaded, the same call reported vision, transcribe and embeddings as true F27.
3. Embeddings without a model succeed with nothing. /v1/embeddings returned 200 with an empty vector and "model": "inactive": check the vector length F24.
4. There is no /swagger.json. It returns 404. The spec is at /api?json=1 F23.
5. A password hides the model name on one route only. With --password, /api/v1/model shows koboldcpp/protected-model F25, but /v1/models still lists the real model F72.
6. Ollama’s version call is documented in the source as returning an emulated Ollama version, and /slots as always answering 501. We have not tested either.
Common URL mistakes
| A KoboldAI app is given an address ending in /v1 | Give it the bare address, http://localhost:5001. Some apps tolerate the suffix: SillyTavern 1.19.0 connected in KoboldCpp mode with it. Others may not. | tested for SillyTavern, F43 |
| An OpenAI app is given the address without /v1 | Add /v1. KoboldCpp also answers OpenAI paths without it, so some apps work either way, but SDKs expect it. | users report; paths from the source |
| https:// typed for a plain server | Use http://, or start KoboldCpp with --ssl: HTTPS. | users report |
| <code>localhost</code> typed on a phone | It means the phone itself. Use the PC's address: LAN access. | users report |
| <code>Error: KoboldCpp HTTP Server is running, but this endpoint does not exist. Please check the URL and METHOD.</code> | The path or method is wrong for that API. Check the table above, and the error list. | tested, F23 |
| /swagger.json returns 404 | The spec is at /api?json=1, the page at /api. | tested, F23 |
| Connection refused | Wrong port, or KoboldCpp is not running. See Will not start. | users report |
One request at a time: the queue
By default KoboldCpp answers one request at a time and queues the rest F26. Number of generation slots that can run at once (experimental continuous batching). Default 1.Default 1Launcher Network tab: Parallel Requests / Parallel Total ContextSince v1.113All details 2 lets two run together. On the CI runner that gave no gain: two simultaneous requests took 1.69 s and 3.15 s by default, and 3.28 s each with two slots. On our Linux test machine it did help: one request took 3.4 s and four simultaneous requests all finished in 6.2 s F75. Test it on your own setup before relying on it.
Data
| Item | Value (s) |
|---|---|
| Default: first request | 1.7 |
| Default: second request | 3.1 |
| --parallelrequests 2: first | 3.3 |
| --parallelrequests 2: second | 3.3 |
Download CSV · Results: R-ci1-u24-nocuda-api-multiuser-1, R-ci1-u24-nocuda-api-parallel-2
The queue holds 10 waiting requests by default (Maximum number of requests allowed to wait in the queue (default 10).Default 10Launcher Network tab: Queue LimitSince v1.123All details), a request times out after 600 seconds (HTTP request timeout in seconds (default 600; 0 = library default).Default 600Launcher Network tab: Request Timeout (s)Since v1.113All details), and a request body can be up to 32 MB (Largest HTTP request body accepted, in MB (default 32); bigger requests are dropped.Default 32Launcher Network tab: Max Req. Size (MB)Since v1.88All details). We have not measured a GPU.
The built-in API docs
KoboldCpp serves its own interactive documentation at /api on your server, an interactive Swagger page titled “KoboldCpp API” that groups the OpenAI-compatible and Anthropic endpoints as the recommended ones for beginners F32.
This page adds what the Swagger page lacks: tested responses, how the password behaves, the common mistakes and the status of each route.
Frequently asked questions
Does KoboldCpp have an API key?
No, unless you set one. By default anyone who can reach the address can use it. If you start KoboldCpp with --password, that password is the key: clients send it as a Bearer token. We tested this on 1.124.2: without the key, generation returned 401.
What is the KoboldCpp API URL?
http://localhost:5001 for KoboldAI-style apps and Ollama-style apps. OpenAI-style apps use http://localhost:5001/v1. If the app runs on another device, replace localhost with the PC's address.
What port does KoboldCpp use?
5001. Change it with --port. The web page and every API share the one port.
How do I enable the API or streaming?
You do not: the API is always on, together with the model. Streaming is chosen by the client for each request. KoboldCpp streams as server-sent events in two shapes, the KoboldAI one and the OpenAI one.
Is KoboldCpp OpenAI-compatible?
Yes. It answers /v1/models, /v1/completions, /v1/chat/completions and /v1/embeddings, and OpenAI-style paths also work without the /v1 prefix. We tested the chat, completion and models routes on 1.124.2.
Where are the API docs?
On your own server at /api, an interactive page titled KoboldCpp API. The machine-readable spec is at /api?json=1. This page adds tested responses, the login behaviour and the common mistakes.
Why does my app say "endpoint does not exist"?
The path or the method does not match any route of that API. KoboldCpp answers with: Error: KoboldCpp HTTP Server is running, but this endpoint does not exist. Please check the URL and METHOD. Check the base URL against the table on this page: KoboldAI apps want the bare address, OpenAI apps want it with /v1.