ollama/ollama
Configuration
All daemon and CLI configuration is read through envconfig/config.go (environment variables) and ~/.ollama/server.json (a small persistent config). The full source of truth is envconfig.AsMap().
Daemon
| Variable | Default | Effect |
|---|---|---|
OLLAMA_HOST |
127.0.0.1:11434 |
Bind address (and where the CLI looks for the daemon). |
OLLAMA_ORIGINS |
localhost / loopback / app://* / file://* / tauri://* / vscode-webview://* / vscode-file://* |
CORS allow-list. |
OLLAMA_MODELS |
~/.ollama/models |
Where models live on disk. |
OLLAMA_KEEP_ALIVE |
5m |
How long the scheduler keeps a runner loaded after the last request. Negative means infinite; zero means evict immediately. |
OLLAMA_LOAD_TIMEOUT |
5m |
How long the scheduler waits for a stalled load before giving up. Zero or negative means infinite. |
OLLAMA_MAX_LOADED_MODELS |
0 (auto: 3 × #GPUs, capped) |
Maximum runners loaded at once. |
OLLAMA_MAX_QUEUE |
512 |
Pending request queue depth before the scheduler returns 503. |
OLLAMA_NUM_PARALLEL |
1 |
Concurrent requests per loaded runner. |
OLLAMA_GPU_OVERHEAD |
0 |
Reserve VRAM headroom (bytes) per GPU. |
OLLAMA_FLASH_ATTENTION |
false |
Enable flash attention. |
OLLAMA_KV_CACHE_TYPE |
(model-specific) | KV cache quantization (e.g., f16, q8_0). |
OLLAMA_NEW_ENGINE |
false |
Prefer the ollamarunner Go-native engine. |
OLLAMA_LLM_LIBRARY |
autodetect | Force a specific GPU library (cuda_v12, rocm, cpu). |
OLLAMA_SCHED_SPREAD |
false |
Always schedule a model across all GPUs. |
OLLAMA_MULTIUSER_CACHE |
false |
Optimize prompt caching for multi-user scenarios. |
OLLAMA_NO_CLOUD |
false |
Disable cloud features (remote inference + web search). |
OLLAMA_REMOTES |
ollama.com |
Allowed cloud hosts. |
OLLAMA_AUTH |
false |
Enable client/server auth. |
OLLAMA_VULKAN |
false (Linux/Windows only) |
Experimental Vulkan support. |
OLLAMA_CONTEXT_LENGTH |
0 (auto) |
Default context length. |
OLLAMA_DEBUG |
0 |
Log level (1/true = DEBUG, 2 = TRACE). |
OLLAMA_DEBUG_LOG_REQUESTS |
false |
Log inference request bodies + replay curl commands to a temp directory. |
OLLAMA_NOPRUNE |
false |
Skip orphan-blob garbage collection on startup. |
OLLAMA_NOHISTORY |
false |
Disable readline history in ollama run. |
OLLAMA_EDITOR |
$EDITOR fallback |
Editor invoked by Ctrl+G in interactive mode. |
GPU library selection
| Variable | Effect |
|---|---|
CUDA_VISIBLE_DEVICES |
NVIDIA visible devices. |
HIP_VISIBLE_DEVICES |
AMD by numeric ID. |
ROCR_VISIBLE_DEVICES |
AMD by UUID or numeric ID. |
GGML_VK_VISIBLE_DEVICES |
Vulkan visible devices. |
GPU_DEVICE_ORDINAL |
AMD by numeric ID. |
HSA_OVERRIDE_GFX_VERSION |
Override the gfx for AMD GPUs. |
These are passed straight through to the runner subprocess by filteredEnv in llm/server.go.
Proxies
HTTP_PROXY, HTTPS_PROXY, NO_PROXY (plus their lowercase variants on non-Windows) are honored by every outbound HTTP call (registry, cloud).
Server config file
~/.ollama/server.json is a small JSON document loaded by envconfig.loadServerConfig (envconfig/config.go). Current fields:
| Field | Type | Effect |
|---|---|---|
disable_ollama_cloud |
bool | Same as OLLAMA_NO_CLOUD=1. |
envconfig.NoCloudSource() returns "none" / "env" / "config" / "both" so callers can explain why cloud is disabled.
Ollama Cloud experiments
OLLAMA_EXPERIMENT (read directly in server/routes.go) is a comma-separated list of experiment names. Currently recognized: client2. Used by handlers that gate behavior behind feature flags.
Runner-side knobs
GGML_* variables are forwarded to the runner subprocess where llama.cpp respects them (e.g., GGML_VK_VISIBLE_DEVICES, GGML_METAL_*).
Where to add a new variable
- Add a typed accessor in
envconfig/config.go(Bool,Uint,Uint64, orString). - Add it to
envconfig.AsMap()so it shows up in diagnostics and the FAQ scrape. - Document it in
docs/faq.mdx. - Read it via the accessor — never
os.Getenvdirectly elsewhere.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.