Skip to content
KoboldCpp
GitHub

Command line

Everything in the launcher is also a command-line flag. Use the command line to start KoboldCpp from a script, on a server without a screen, or with a screen reader (the launcher is not accessible to screen readers).

When you pass a model, KoboldCpp skips the launcher and starts right away.

Command Prompt
cd C:\mystuff
koboldcpp.exe --model C:\models\mymodel.gguf --contextsize 16384

Use the name of the file you downloaded, for example koboldcpp-nocuda.exe or ./koboldcpp-linux-x64-nocuda. Examples on other pages write koboldcpp for it.

When the model is loaded, the terminal shows Please connect to custom endpoint at http://localhost:5001. Open that address in your browser, or add --launch to open it automatically.

Other ways to start without the launcher:

  • --config mysettings.kcpps starts with a saved config. See Config files.
  • --model also accepts a web address; KoboldCpp downloads the file first.
  • The model file and port also work without flag names: koboldcpp.exe mymodel.gguf 5002.
CommandWhat it does
--helpLists all flags with a short description.
--versionPrints the version and exits. It only works on its own; with other flags it is ignored.

The flag reference explains every flag in detail.

FlagLauncherWhat it does
--modelGGUF Text Model:The model file or web address.
--configLoad ConfigLoads a .kcpps config or .kcppt template.
--contextsizeContext Size:Context size in tokens. Default 16384.
--usecudaBackend: Use CUDARuns on an NVIDIA card.
--usevulkanBackend: Use VulkanRuns on most graphics cards.
--usecpuBackend: Use CPURuns without a graphics card. On macOS, also set --gpulayers 0.
--gpulayersGPU Layers:Layers on the graphics card. -1 (default) fits automatically.
--threadsThreads:CPU threads. Automatic by default.
--portPort:Default 5001.
--hostHost:Address to listen on. Default: all addresses. 127.0.0.1 allows only this computer.
--launchLaunch BrowserOpens the browser after loading. Off on the command line, on in the launcher.
--passwordPassword:API key for the text endpoints.
--quantkvQuantize KV Cache:Stores the context in a smaller format.
--mmprojMmproj File:Vision projector for image input.
--quietQuiet ModeHides generation output.
--debugmodeDebug ModePrints extra details for troubleshooting.

Without --usecuda, --usevulkan or --usecpu, KoboldCpp chooses a backend for your hardware.

Passwords can also be set as environment variables instead of flags:

VariableSame as
KCPP_PASSWORD--password
KCPP_ADMINPASSWORD--adminpassword
FlagWhat it does
--cliChat with the model in the terminal. Type /quit or /exit to end. With --agent, it runs the KoboldCpp Agent in the terminal instead, and the web server starts as usual. Cannot be combined with --launch, --nomodel, --admin or --benchmark.
--prompt "text"Generates one reply to the text, prints it and exits. With --cli, the text becomes the system prompt instead.
--benchmarkMeasures prompt processing and generation speed instead of starting the server. --benchmark results.csv appends the results to a file.

The opposite also exists: --nomodel starts the web server and KoboldAI Lite without a local model, for use with online services.

  • --showgui opens the launcher filled in with the flags and config you passed, instead of starting right away.
  • --skiplauncher cancels a showgui setting saved in a config. It does not replace a model: without one, KoboldCpp still asks for a file. On a system without a screen, it prints Note: In order to use --skiplauncher, you need to specify a model with --model and exits.

If you pass flags but no model, KoboldCpp shows a file picker for a model or .kcpps file instead of the full launcher.

CodeWhen
0--version printed the version.
1The port is already in use (no socket could bind). This happens after the model has loaded.
2A flag or value is invalid, for example a context size outside 256 to 524288.
2The model file does not exist (Cannot find text model file).
2--skiplauncher without a model, on a system without a screen.