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
How we test
On this page
  1. Pick your path
  2. Your KoboldCpp API URL
  3. Do you need an API key?
  4. Which API should I use?
  5. Check your server
  6. Every endpoint
  7. Streaming
  8. Gotchas we found
  9. Common URL mistakes
  10. One request at a time: the queue
  11. The built-in API docs

Pick your path

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 (default 5001) F05. Lite opens at that address in a browser F31.

Base URL by kind of client
KoboldAIhttp://localhost:5001KoboldAI Lite, SillyTavern (KoboldCpp or Text Completion)
OpenAIhttp://localhost:5001/v1OpenAI SDKs, Open WebUI, coding tools
Ollamahttp://localhost:5001Apps 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 . 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:

What a password protects, tested on KoboldCpp 1.124.2
POST /api/v1/generate401401200
POST /v1/chat/completions401not testednot tested
GET /api/v1/model200not testednot tested
GET / (the web page)200not testednot 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?

The API families
KoboldAILite, SillyTavern, KoboldAI-era tools/api/v1, /api/extraKoboldAI API
OpenAISDKs, Open WebUI, Janitor AI, coding tools/v1/*OpenAI API
AnthropicApps that speak the Anthropic Messages API (basic since 1.111, full since 1.115, per release notes; we have not tested it)/v1/messagesAnthropic
OllamaApps that offer an Ollama server/api/chat, /api/generate, /api/tagsOllama
A1111, ComfyUI, OpenAI imagesImage generation clients/sdapi/v1/*, /v1/images/*Image API
Whisper and TTSSpeech to text and text to speech/v1/audio/*Voice API
Embeddings, MCPVector search, tool servers/v1/embeddings, /mcpEmbeddings
AdminSwitching 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:

Terminal
$ curl http://localhost:5001/api/extra/version
$ curl http://localhost:5001/api/v1/model
$ curl http://localhost:5001/v1/models

If 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.

Every KoboldCpp API route
Main parameters
GET/UI pagesServes the bundled KoboldAI Lite web UI (gzip when supported).–noworks F23
GET/noscriptUI pagesServer-rendered UI that works without JavaScript (chat and image gen).–nountested
GET/lcpp/UI pagesBundled llama.cpp web UI; /lcpp redirects to /lcpp/ and /lcpp/* paths are mapped to root API paths.–nountested
GET/sduiUI pagesStableUI image/video generation front end.–nountested
GET/musicuiUI pagesMusic generation UI (ACE-Step/YuE2), also with a transcription tab.–nountested
GET/api
also /docs
UI pagesInteractive Swagger API documentation page (title 'KoboldCpp API').–nountested
GET/manifest.jsonUI pagesPWA manifest so Kobold Lite can be installed as an app.–nountested
POST/api/v1/generate
also /api/latest/generate
KoboldAIClassic KoboldAI text generation: prompt plus sampler settings, returns the full result.max_context_length max_length prompt rep_pen rep_pen_range sampler_orderyesworks F23
GET/api/v1/model
also /api/latest/model
KoboldAIName of the loaded text model (masked when a password is set and not supplied).–yesworks F23
GET/api/v1/config/max_length
also /api/latest/config/max_length
KoboldAIDefault generation length the server advertises.–yesworks F23
GET/api/v1/config/max_context_length
also /api/latest/config/max_context_length
KoboldAIContext length the server advertises to clients.–yesworks F23
GET/api/v1/config/soft_prompt
also /api/latest/config/soft_prompt
KoboldAIStub kept for KoboldAI client compatibility (soft prompts not supported).–nountested
GET/api/v1/config/soft_prompts_list
also /api/latest/config/soft_prompts_list
KoboldAIStub returning an empty soft-prompt list for compatibility.–nountested
GET/api/v1/info/version
also /api/latest/info/version
KoboldAIKoboldAI United API version that KoboldCpp emulates.–yesworks F23
GET/api/v1KoboldAIBare API root; redirects (302) to the /api docs page.–nountested
POST/api/extra/generate/streamExtraSame as /api/v1/generate but streams tokens as Server-Sent Events.max_context_length max_length prompt rep_pen rep_pen_range sampler_orderyesworks F23
GET/api/extra/generate/checkExtraReturns the partial text of the generation in progress.–yesuntested
POST/api/extra/generate/checkExtraPartial text of an in-progress generation identified by genkey (multi-user safe).genkeyyesuntested
POST/api/extra/abortExtraStops the current generation (optionally only for a given genkey).genkeyyesuntested
GET/api/extra/versionExtraKoboldCpp version and a feature/capability list (vision, audio, image gen, TTS, etc.).–yesworks F23
GET/api/extra/true_max_context_lengthExtraThe real --contextsize loaded at launch (not advertised to Horde).–yesworks F23
GET/api/extra/perfExtraTiming and usage statistics of recent generations, queue state, uptime.–yesworks F23
GET/api/extra/last_logprobsExtraToken log-probabilities of the latest request.–yesuntested
POST/api/extra/last_logprobsExtraToken log-probabilities for the request with a given genkey.genkeyyesuntested
POST/api/extra/tokencount
also /api/extra/tokenize
ExtraTokenizes text and returns the token count and ids.promptyesworks F23
POST/api/extra/detokenizeExtraTurns a list of token ids back into text.idsyesuntested
POST/api/extra/json_to_grammarExtraConverts a JSON schema into a GBNF grammar for constrained sampling.schemayesuntested
GET/api/extra/preloadstoryExtraReturns the story preloaded with --preloadstory.–yesuntested
POST/api/extra/websearchExtraRuns a DuckDuckGo web search through the server (needs --websearch) and returns top results.qyesuntested
POST/api/extra/data/listExtraLists save slots in the server-side save database (--savedatafile).–yesuntested
POST/api/extra/data/loadExtraLoads a save slot from the server-side database.slotyesuntested
POST/api/extra/data/saveExtraWrites data to a server-side save slot.slot format title datayesuntested
POST/api/extra/multiplayer/statusExtraMultiplayer session turn info (--multiplayer).senderbusy senderyesuntested
POST/api/extra/multiplayer/getstoryExtraFetches the shared multiplayer story (compressed).–yesuntested
POST/api/extra/multiplayer/setstoryExtraUpdates the shared multiplayer story and advances the turn.full_update sender data_format datayesuntested
POST/api/extra/shutdownAdminShuts the server down (only allowed in specific setups; password-protected).–yesuntested
GET/v1/models
also /models
OpenAIOpenAI-style model list: the loaded model, plus admin-dir configs in router mode.–yesworks F23
POST/v1/completions
also /v1/completion, /completions
OpenAIOpenAI text completions (supports streaming and KoboldCpp sampler extras).model prompt max_tokens max_completion_tokens temperature top_pyesworks F23
POST/v1/chat/completions
also /chat/completions
OpenAIOpenAI chat completions with streaming, tools/function calling, vision/audio content and JSON/structured output.model messages max_tokens max_completion_tokens temperature top_pyesworks F23
POST/v1/responses
also /responses
OpenAIExperimental emulation of the OpenAI Responses API.model input instructions max_tokens temperature top_pyesworks F72
POST/v1/embeddingsOpenAIOpenAI-style embedding vectors (needs --embeddingsmodel).model input encoding_format truncateyesworks F23
POST/v1/images/generations
also /images/generations
OpenAIOpenAI-style image generation (needs --sdmodel).model prompt size response_format nyesuntested
POST/v1/images/edits
also /images/edits
OpenAIOpenAI-style multipart image edit with optional mask.image mask prompt model size response_formatyesuntested
POST/v1/audio/transcriptions
also /audio/transcriptions
WhisperOpenAI-style speech-to-text upload (needs --whispermodel); the wiki notes WAV input is safest.file model prompt languageyesuntested
POST/v1/audio/speech
also /audio/speech
TTSOpenAI-style text-to-speech (needs --ttsmodel); wav or mp3 output.model input voice speaker_wav speaker_json response_formatyesuntested
GET/v1/audio/voices
also /audio/voices
TTSLists voices available for the speech endpoint.–yesuntested
GET/v1OpenAIBare /v1 root; returns a short pointer response.–nountested
POST/v1/messages
also /messages
AnthropicAnthropic Messages API emulation (system, tools, streaming, thinking).model messages system max_tokens temperature top_pyesworks F72
POST/api/generateOllamaOllama-style generate endpoint.model prompt system context stream stopyesworks F23
POST/api/chatOllamaOllama-style chat endpoint with streaming and tools.model messages tools streamyesworks F23
POST/api/embedOllamaOllama-style embeddings.–nountested
GET/api/tags
also /api/ps
OllamaOllama-style list of models (the loaded one).–yesworks F23
GET/api/versionOllamaOllama-style version reply (a fake Ollama version, not the KoboldCpp version).–noworks F72
POST/api/showOllamaOllama-style model details.–noworks F72
POST/sdapi/v1/txt2imgA1111A1111/Forge-compatible text-to-image (also video for video models).prompt negative_prompt cfg_scale steps width heightyesuntested
POST/sdapi/v1/img2imgA1111A1111-compatible image-to-image and inpainting.prompt negative_prompt cfg_scale steps width heightyesuntested
POST/sdapi/v1/interrogateA1111Captions an image using the loaded vision model.image modelyesuntested
POST/sdapi/v1/upscale
also /sdapi/v1/extra-single-image
A1111Upscales an image with the ESRGAN model (--sdupscaler).image upscaling_resizeyesuntested
GET/sdapi/v1/sd-modelsA1111Lists the loaded image model.–yesworks F23
GET/sdapi/v1/optionsA1111Image-generation config info.–yesuntested
GET/sdapi/v1/samplersA1111Supported samplers.–yesuntested
GET/sdapi/v1/schedulersA1111Supported schedulers.–yesuntested
GET/sdapi/v1/lorasA1111Available image LoRAs.–yesuntested
GET/sdapi/v1/upscalersA1111Available upscalers (ESRGAN if loaded).–yesuntested
GET/sdapi/v1/latent-upscale-modesA1111Latent upscale modes (compatibility list).–yesuntested
GET/sdapi/v1/progressA1111Progress of the running image generation.genkey skip_current_imageyesuntested
GET/sdapi/v1/get_last.jsonA1111Cached result of a previous image generation by genkey.genkeyyesuntested
POST/promptComfyUIComfyUI-style workflow submission, mapped onto the internal image generator.–nountested
GET/history
also /api/history
ComfyUIComfyUI-style history of generated images (also /history/<id>).–nountested
GET/view
also /view.png, /api/view
ComfyUIComfyUI-style image download (also /view_image...).–nountested
POST/api/upload/image
also /upload/image
ComfyUIComfyUI-style input image upload.–nountested
GET/system_statsComfyUIComfyUI-style system stats stub.–nountested
GET/object_infoComfyUIComfyUI-style node info stub.–nountested
GET/api/models/checkpoints
also /models/checkpoints
ComfyUIComfyUI-style checkpoint list.–nountested
GET/api/models/loras
also /models/loras
ComfyUIComfyUI-style LoRA list.–nountested
GET/wsComfyUIWebSocket upgrade used by ComfyUI clients for progress events.–nountested
POST/api/extra/transcribeWhisperNative speech-to-text (base64 audio or file).audio_data prompt langcode language suppress_non_speech fileyesuntested
POST/api/extra/music/transcribeWhisperTranscribes music/audio to text and ABC notation (SheetSage2 model).audio_data prompt langcode language suppress_non_speech fileyesuntested
POST/api/extra/tts
also /tts_to_audio
TTSNative TTS; /tts_to_audio is the XTTS-compatible alias.input voice speaker_wav speaker_json instructions languageyesuntested
GET/api/extra/speakers_list
also /speakers_list
TTSList of TTS speakers (XTTS-compatible).–yesuntested
GET/speakersTTSXTTS-compatible speaker list.–nountested
GET/get_tts_settingsTTSXTTS-compatible settings stub.–nountested
POST/set_tts_settingsTTSXTTS-compatible settings stub (accepts and ignores).–nountested
GET/voice/check
also /voice/speakers, /voice/vits
TTSAllTalk/VITS-style voice compatibility stubs (unverified exact client).–nountested
POST/api/extra/embeddingsExtraNative embeddings endpoint.model input truncateyesuntested
POST/api/extra/music/prepareMusicPrepares song parameters (caption, lyrics, BPM, duration, key) before generation.caption lyrics bpm duration keyscale timesignatureyesuntested
POST/api/extra/music/generateMusicGenerates music from captions/lyrics and settings (ACE-Step or YuE2).caption lyrics bpm duration keyscale timesignatureyesuntested
GET/api/admin/list_optionsAdminLists .kcpps/.kcppt/.gguf choices in --admindir.–yesuntested
POST/api/admin/reload_configAdminSwitches to another config/model in --admindir (or unloads); restarts the backend.filename baseconfigyesuntested
POST/api/admin/check_stateAdminSize of existing KV save states and the prediction for a new one.–yesuntested
POST/api/admin/save_stateAdminSaves the current KV cache to a memory slot.slotyesuntested
POST/api/admin/load_stateAdminRestores a saved KV cache slot.slotyesuntested
POST/api/admin/clear_stateAdminFrees all KV save states.–yesuntested
POST/mcpMCPJSON-RPC proxy to the MCP tool servers configured with --mcpfile (GET returns 405).jsonrpc id method paramsyesuntested
GET/propsllama.cppllama.cpp-server-style properties: chat template, context size, modalities; 'router' role in router mode.–yesuntested
GET/slotsllama.cppllama.cpp-server compatibility; always returns 501 (not supported).–nountested
GET/.well-known/serviceinfoExtraService identity document listing which APIs this server provides.–yesuntested
GET/pingExtraHealth check for serverless hosts (added v1.97).–nountested
OPTIONS*ExtraCORS preflight / header-only responses for any path.–nountested
HEAD*ExtraCORS preflight / header-only responses for any path.–nountested

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:

KoboldAI stream: /api/extra/generate/stream, 12 eventsR-run1-lnx-nocuda-api-all · lab-lnx · KoboldCpp 1.124.2 (F23)
data: {"token": " three, four, five,", "finish_reason": null}1data: {"token": "", "finish_reason": "length"}2
  1. data: {"token": " three, four, five,", "finish_reason": null}: The first event: a piece of text.
  2. data: {"token": "", "finish_reason": "length"}: The last event: the reply hit its length limit.
OpenAI stream: /v1/chat/completions with stream: true, 18 eventsR-run1-lnx-nocuda-api-all · lab-lnx · KoboldCpp 1.124.2 (F23)
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
  1. data: {"id": "chatcmpl-A3023341", "object": "chat.completion.chunk", ": The first chunk, shortened.
  2. data: [DONE]: The stream ends with this line.

Lite has its own streaming toggle: Lite settings.

Gotchas we found

  1. Two version numbers. /api/v1/info/version answers 1.2.5, the version of the KoboldAI API KoboldCpp emulates. KoboldCpp’s own version is at /api/extra/version: 1.124.2 F24.
  2. /api/extra/version lists 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

Common URL mistakes
A KoboldAI app is given an address ending in /v1Give 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 /v1Add /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 serverUse http://, or start KoboldCpp with --ssl: HTTPS.users report
<code>localhost</code> typed on a phoneIt 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 404The spec is at /api?json=1, the page at /api.tested, F23
Connection refusedWrong 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. 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.

Two simultaneous requests on a CI runner: no gaingha-u24 (Ubuntu 24.04, 4 vCPU, no GPU), 0.5B model, KoboldCpp 1.124.2, 13 Nov 2026CPU lab, 0.5B model: relative differences only
  • Default: first request1.7 s
  • Default: second request3.1 s
  • --parallelrequests 2: first3.3 s
  • --parallelrequests 2: second3.3 s
Data
ItemValue (s)
Default: first request1.7
Default: second request3.1
--parallelrequests 2: first3.3
--parallelrequests 2: second3.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 (), a request times out after 600 seconds (), and a request body can be up to 32 MB (). 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.

The built-in API documentation at /api: OpenAI-compatible endpoints listed first.lab-lnx-api-swagger-01 · lab-lnx · KoboldCpp 1.124.2 · 13 Nov 2026
KoboldCpp API Swagger page listing /v1/completions, /v1/chat/completions and other endpoints

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.