Model management 16
Model names follow the model:tag format. The tag is optional; when it is left out, latest is used.
| Command | What it does |
|---|---|
ollama pull MODEL | Download modelFetches the model from a registry so it can be run locally. |
ollama pull gemma4:e2b | Pull specific versionThe part after the colon is the tag; without one, the tag named latest is pulled. |
ollama list | List local modelsShows every model already downloaded to this machine. |
ollama ls | List models (short form)Alias of ollama list that prints the same local models. |
ollama show MODEL | Model infoPrints a summary of one model; add a flag to print a single section instead. |
ollama show MODEL --modelfile | Print the ModelfileOutputs the model's Modelfile, a starting point for building a variant of it. |
ollama show MODEL --parameters | Print model parameters |
ollama show MODEL --template | Print prompt template |
ollama show MODEL --system | Print system message |
ollama show MODEL --license | Print model license |
ollama show MODEL -v | Show detailed model infoVerbose form that prints more than the default summary; --verbose is the long spelling. |
ollama cp SOURCE DESTINATION | Copy modelDuplicate a model under a new name. |
ollama rm MODEL | Remove modelDeletes the downloaded model; several names can be given in one command. |
ollama push MODEL | Publish modelUploads a local model to a registry. |
ollama signin | Sign in to ollama.comConnects this machine to your account, which pushing models and pulling private ones require. |
ollama signout | Sign out of ollama.com |
Running models 13
| Command | What it does |
|---|---|
ollama run MODEL | Run interactiveDownloads the model if needed, then opens a chat in the terminal. |
ollama run MODEL PROMPT | Single promptAnswers the prompt given on the command line and exits instead of opening a chat. |
echo "Hello world" | ollama run nomic-embed-text | Pipe inputText piped on standard input becomes the prompt; an embedding model prints its vector as JSON. |
ollama run embeddinggemma "Hello world" | Generate embeddingsWith an embedding model the text is turned into a vector instead of a chat reply. |
ollama run MODEL "" | Preload a modelAn empty prompt loads the model into memory so the next request starts faster. |
ollama run MODEL --verbose | Show response timingsPrints timing statistics after each answer. |
ollama run MODEL --format json | Request JSON outputSets the response format for the whole session, like /set format json at the prompt. |
ollama run MODEL --keepalive 5m | Set keep-alive timeKeeps the model in memory for the given duration after the last request. |
ollama run MODEL --think | Enable thinking modeFor models that support it; --think=false turns it off and --think=high, medium or low sets a level. |
ollama run MODEL --hidethinking | Hide thinking outputLeaves the reasoning text out and prints only the final answer. |
ollama run MODEL --nowordwrap | Turn off word wrapStops long lines from being broken onto the following line. |
ollama ps | List running modelsShows which models are in memory and whether each sits on the GPU, the CPU or both. |
ollama stop MODEL | Stop a running modelUnloads the model right away instead of waiting for the keep-alive time to pass. |
Launching integrations 6
| Command | What it does |
|---|---|
ollama launch | Open the integration menuLets you pick a supported coding tool and sets it up to use Ollama models. |
ollama launch claude | Launch Claude CodeStarts the named integration directly; opencode, codex, droid and vscode work the same way. |
ollama launch claude --model MODEL | Launch with a chosen modelSkips the interactive model picker and uses the model named here. |
ollama launch droid --config | Configure without launchingWrites the integration's settings but does not start the app. |
ollama launch codex --restore | Restore default profile |
ollama launch codex -- --sandbox workspace-write | Pass extra argumentsEverything after the double dash is handed to the integration itself. |
Interactive session 13
| Command | What it does |
|---|---|
| /? | Show session helpLists the slash commands of the session; /help does the same. |
/? shortcuts | List keyboard shortcutsPrints the line-editing keys that work at the prompt. |
/show info | Model detailsShows details of the model loaded in this session. |
/show modelfile | Show ModelfilePrints the Modelfile of the model you are chatting with. |
/show parameters | Show parameters |
/show system | Show system message |
/show template | Show prompt template |
/show license | Show model license |
/load MODEL | Switch to another modelSwitches the session to another model, or to one saved earlier with /save. |
/save MODEL | Save session as a modelCreates a new model under the given name from the session as it stands. |
/clear | Clear historyEmpties the conversation context; a system message that was set stays in place. |
/bye | Exit chatEnds the session and returns to the shell; /exit works too. |
""" | Start a multi-line messageOpen and close the text with triple quotes to type a prompt over several lines. |
Session settings 22
| Command | What it does |
|---|---|
/set system STRING | Set system promptReplaces the system message used for the rest of the session. |
/set parameter num_ctx INT | Set context sizeChanges the context window, in tokens, for this session. |
/set parameter temperature FLOAT | Set temperatureHigher values make the answers more creative. |
/set parameter seed INT | Set random seedA fixed seed makes the model give the same text for the same prompt. |
/set parameter num_predict INT | Limit generated tokensCaps how many tokens one answer may contain. |
/set parameter top_k INT | Set top-k samplingRestricts sampling to the k most likely tokens. |
/set parameter top_p FLOAT | Set top-p samplingChooses tokens by cumulative probability; lower values give more focused text. |
/set parameter min_p FLOAT | Set min-p thresholdDrops tokens whose probability falls below this fraction of the most likely token's. |
/set parameter repeat_penalty FLOAT | Set repetition penaltyHigher values discourage repeated text more firmly. |
/set parameter repeat_last_n INT | Set repetition lookbackSets how many recent tokens are checked for repeats. |
/set parameter num_gpu INT | Set GPU layer countChooses how many model layers are offloaded to the graphics card. |
/set parameter stop STRING ... | Set stop sequencesGeneration ends as soon as the model produces one of these strings. |
/set format json | Enable JSON modeAsks for JSON answers until /set noformat is entered. |
/set noformat | Turn off output format |
/set verbose | Show response statisticsPrints response statistics after every answer, like the --verbose flag of ollama run. |
/set quiet | Hide response statistics |
/set think | Enable thinking |
/set nothink | Disable thinking |
/set wordwrap | Enable word wrap |
/set nowordwrap | Disable word wrap |
/set history | Enable prompt history |
/set nohistory | Disable prompt historyTyped prompts are no longer added to the recall history. |
Prompt editing keys 11
| Command | What it does |
|---|---|
| Ctrl+A | Move to line start |
| Ctrl+E | Move to line end |
| Alt+B | Move back one word |
| Alt+F | Move forward one word |
| Ctrl+K | Delete text after cursor |
| Ctrl+U | Delete text before cursor |
| Ctrl+W | Delete previous word |
| Ctrl+L | Clear the screen |
| Ctrl+G | Compose prompt in editorOpens the default editor, or the one named in OLLAMA_EDITOR, for writing a long prompt. |
| Ctrl+C | Stop the responseInterrupts the model while it is still generating an answer. |
| Ctrl+D | Exit the sessionLeaves ollama run, the same as typing /bye. |
Server and setup 10
| Command | What it does |
|---|---|
ollama serve | Start serverStarts the API server, bound to 127.0.0.1 port 11434 unless OLLAMA_HOST is set. |
ollama serve --help | List server variablesPrints the environment variables the server reads, each with a short description. |
ollama -v | Show versionPrints the installed version; --version is the long spelling. |
ollama COMMAND --help | Help for a commandAdd --help after any subcommand to see its flags and variables. |
OLLAMA_CONTEXT_LENGTH=8192 ollama serve | Start with a larger contextStarts the server with an 8K default context window for this run only. |
launchctl setenv OLLAMA_HOST "0.0.0.0:11434" | Set a variable on macOSFor the macOS app: sets the variable through launchctl; restart Ollama to apply it. |
systemctl edit ollama.service | Edit the Linux serviceOpens an override file where Environment lines for the systemd service are added. |
Environment="OLLAMA_HOST=0.0.0.0:11434" | Expose server (systemd line)Placed under [Service], it makes the server listen on every network interface. |
systemctl restart ollama | Restart the Linux serviceRun systemctl daemon-reload first so the edited unit is picked up. |
curl -fsSL https://ollama.com/install.sh | sh | Install or update on LinuxRunning the script again upgrades an existing Linux installation. |
Environment variables 22
Where to set them depends on the install: launchctl setenv for the macOS app, an Environment line in the systemd service on Linux, user environment variables on Windows. Restart Ollama afterwards.
| Command | What it does |
|---|---|
OLLAMA_HOST | Server addressAddress and port the server binds to and the client connects to; 127.0.0.1:11434 by default. |
OLLAMA_MODELS | Custom model dirStores model files in this directory instead of the default location. |
OLLAMA_CONTEXT_LENGTH | Default context lengthUsed for any request that does not set a context length of its own. |
OLLAMA_KEEP_ALIVE | Default keep-alive timeHow long a model stays in memory after a request; 5 minutes unless changed. |
OLLAMA_NUM_PARALLEL | Parallel requestsMost requests one model handles at the same time; memory use grows with the value. |
OLLAMA_MAX_LOADED_MODELS | Max loaded modelsLimits how many models stay loaded at once, counted per GPU. |
OLLAMA_MAX_QUEUE | Request queue limitRequests beyond this number are rejected with a 503 while the server is busy. |
OLLAMA_ORIGINS | Allowed web originsComma-separated origins that may call the API from a browser. |
OLLAMA_DEBUG | Debug loggingSet it to 1 for more detailed log output. |
OLLAMA_NO_CLOUD | Disable cloud featuresSet it to 1 to turn off cloud models and web search. |
OLLAMA_FLASH_ATTENTION | Flash Attention switchSet 1 to force Flash Attention on or 0 to turn it off. |
OLLAMA_KV_CACHE_TYPE | K/V cache quantizationAccepts f16, q8_0 or q4_0; lower precision uses less memory. |
OLLAMA_NOPRUNE | Keep unused blobsSkips the cleanup of model blobs that normally runs when the server starts. |
OLLAMA_SCHED_SPREAD | Spread across all GPUsSplits a model over every GPU even when it would fit on a single one. |
OLLAMA_GPU_OVERHEAD | Reserve VRAM per GPUAmount of video memory, in bytes, left unused on each graphics card. |
OLLAMA_IGPU_ENABLE | Use integrated GPUs |
OLLAMA_LLM_LIBRARY | Force an LLM libraryNames the library to load instead of letting Ollama detect one. |
OLLAMA_LOAD_TIMEOUT | Model load timeoutA load that stalls longer than this is abandoned; 5 minutes unless changed. |
OLLAMA_MAX_TRANSFER_STREAMS | Parallel transfer streamsApplies to pulling and pushing safetensors models; 4 streams unless changed. |
OLLAMA_EDITOR | Prompt editor pathRead by ollama run: the editor that Ctrl + G opens in an interactive session. |
OLLAMA_NOHISTORY | No saved prompt historyRead by ollama run: typed prompts are not kept between sessions. |
HTTPS_PROXY | Proxy for model downloadsRoutes model pulls through a proxy; leave HTTP_PROXY unset, since it can break client connections. |
Modelfile 16
Instruction names are not case sensitive and can come in any order; capitals and FROM-first are conventions of the examples.
PARAMETER also takes seed, top_k, top_p, min_p, num_predict, repeat_penalty and repeat_last_n, the same names /set parameter uses in a session.
| Command | What it does |
|---|---|
FROM MODEL | Base modelRequired instruction naming the existing model to build on. |
FROM ./ollama-model.gguf | Build from a GGUF fileThe path is absolute or relative to the Modelfile's location. |
FROM DIRECTORY | Build from Safetensors weightsPoints at a folder holding Safetensors weights for a supported architecture. |
SYSTEM """You are a happy cat.""" | System promptSets the system message the model starts every conversation with. |
PARAMETER temperature 1 | TemperatureHigher values give more creative answers, lower ones more coherent; the default is 0.8. |
PARAMETER num_ctx 4096 | Context lengthSets how many tokens the model can use as context when generating. |
PARAMETER stop "<|eot_id|>" | Stop sequenceGeneration stops when this text appears; repeat the line to set several. |
TEMPLATE | Prompt templateFollowed by the full prompt in Go template syntax, usually inside triple quotes. |
{{ .System }} | System message variableTemplate placeholder that is replaced by the system message. |
{{ .Prompt }} | User prompt variableTemplate placeholder that is replaced by the user's message. |
{{ .Response }} | Model response variableMarks where the answer goes; text after it is left out while generating. |
MESSAGE user Is Toronto in Canada? | Add an example user turnBuilds a message history; the role can be system, user or assistant. |
MESSAGE assistant yes | Add an example replyPaired with a user line, it shows the model how to answer similar questions. |
REQUIRES VERSION | Minimum Ollama versionStates the oldest Ollama release the model works with, for example 0.14.0. |
ollama create MODEL -f Modelfile | Build modelCreates a named local model from the instructions in that file. |
ollama create MODEL | Build from the default fileWithout -f, the file named Modelfile in the current directory is used. |
API endpoints 12
| Command | What it does |
|---|---|
POST /api/generate | Generate APIReturns a completion for one prompt as a stream of JSON objects. |
POST /api/chat | Chat APITakes the message history and returns the next message, streamed unless stream is false. |
POST /api/embed | Embeddings APIReturns embedding vectors for the input text. |
POST /api/show | Model details APIReturns a model's Modelfile, template, parameters, license and system prompt. |
POST /api/pull | Pull model APIDownloads a model; a cancelled pull continues from where it stopped. |
DELETE /api/delete | Delete model APIRemoves a model together with its data from the server. |
curl http://localhost:11434/api/tags | List models APIReturns the locally available models as JSON. |
curl http://localhost:11434/api/ps | Running models APIReturns the models that are in memory right now. |
curl http://localhost:11434/api/version | Version APIReturns the version number of the running server. |
curl http://localhost:11434/api/generate -d '{"model": "mistral"}' | Preload a model via APIA request without a prompt only loads the model into memory. |
curl http://localhost:11434/api/generate -d '{"model": "llama3.2", "keep_alive": -1}' | Keep a model loadedA negative keep_alive value leaves the model in memory indefinitely. |
curl http://localhost:11434/api/generate -d '{"model": "llama3.2", "keep_alive": 0}' | Unload a model via APIA keep_alive of 0 frees the memory as soon as the request is answered. |
No row on this page matches that filter.
Notes
The pull–run loop
Day-to-day Ollama is three commands: ollama pull MODEL downloads, ollama run MODEL opens an interactive chat, and ollama list shows what is on disk (ollama rm MODEL reclaims the space — local models are gigabytes each). Tags select variants: ollama pull gemma4:e2b asks for one specific tag instead of the default, latest. For scripting, pass the prompt inline with ollama run MODEL PROMPT or pipe text straight in, as in echo "Hello world" | ollama run nomic-embed-text. ollama ps shows what is loaded in memory and ollama stop MODEL unloads it.
Inside an interactive session, slash-commands control the chat: /clear wipes context, /set system STRING changes the system prompt on the fly, /show info and /show modelfile reveal what you are actually running, and /bye exits. /? shortcuts prints the editing keys, such as Ctrl + A and Ctrl + E for the ends of the line.
Serving and shaping models
ollama serve runs the API server that everything talks to on port 11434 — POST /api/generate and POST /api/chat are the two endpoints most integrations use. Environment variables tune it: OLLAMA_MODELS relocates the model store to a bigger drive, OLLAMA_NUM_PARALLEL sets how many requests a model handles at once, and OLLAMA_HOST changes the address the server binds to. ollama serve --help lists them all. To make a customised assistant permanent, write a Modelfile — FROM MODEL, a SYSTEM """You are a happy cat.""" line for the system prompt, PARAMETER temperature 1 and PARAMETER num_ctx 4096 — then build it once with ollama create MODEL -f Modelfile and run it by name from then on.
Questions
What do the tags after the colon mean?
Variants of the same model, typically parameter sizes and quantisation levels. Pulling without a tag gets the one tagged latest; ollama pull gemma4:e2b asks for an exact one. ollama show MODEL reports what a downloaded copy actually is — worth checking before comparing quality or speed.
Is OLLAMA_HOST=0.0.0.0 safe?
Treat it carefully. By default the server binds to 127.0.0.1, and the local API asks for no authentication; setting OLLAMA_HOST to 0.0.0.0 binds it to every network interface, so anyone who can reach the port can run your models. Fine on a trusted LAN; behind anything less, keep the default localhost binding or put a reverse proxy with auth in front.
Where do the models live, and can I move them?
By default in ~/.ollama/models on macOS, /usr/share/ollama/.ollama/models on Linux and C:\Users\%username%\.ollama\models on Windows. Set OLLAMA_MODELS for the server process to store them elsewhere — a common fix when the system drive is small, since a handful of models easily consumes tens of gigabytes. On Linux with the standard installer, the ollama user needs read and write access to the new directory.
Do I need to run ollama serve myself?
Usually not on a desktop install, where opening the app starts the server and ollama run MODEL just works. Run ollama serve manually on Linux when the server is not already running, in containers, or whenever you want to control the environment variables the server starts with.
How do I make a custom assistant I can reuse?
Write a Modelfile: FROM MODEL for the base, a SYSTEM line for standing instructions, PARAMETER lines for behaviour. Then ollama create MODEL -f Modelfile builds it as a named local model — your settings persist without repeating /set system STRING every session.
Sources and checks
- Ollama documentation: CLI Reference (docs/cli.mdx, release v0.35.1) Everyday commands: run, pull, rm, ls, ps, stop, serve, signin, launch
- Ollama 0.35.1 built-in help: output of "ollama --help" and "ollama COMMAND --help" from the official Linux release binary Command usage lines, flags and the environment variables each command reads
- Ollama source: cmd/interactive.go (release v0.35.1), the help text printed by /?, /? set, /? show and /? shortcuts Slash commands, /set parameters and editing keys of the interactive session
- Ollama documentation: Modelfile Reference (docs/modelfile.mdx, release v0.35.1) Modelfile instructions, parameters and template variables
- Ollama documentation: FAQ (docs/faq.mdx, release v0.35.1) Server configuration, environment variables, preloading and unloading models
- Ollama documentation: API reference (docs/api.md, release v0.35.1) REST endpoints and the model:tag naming convention
- Ollama documentation: Quickstart (docs/quickstart.mdx, release v0.35.1) First run and pulling a tagged model
Every row on this page was matched to a line in the documentation above on . A binding that could not be found there is not listed.
1 row from the earlier version of this page was removed in that check: duplicates, and bindings the documentation does not list or lists differently.
Found a wrong or missing key? Tell us and it gets checked against the source. How we verify describes the process and its limits.