Ollama Command Builder

Build Ollama commands: run and pull with the right tags, Modelfiles with parameters and system prompts, Hugging Face GGUF imports and server env vars.

Advertisement

Compose Ollama CLI commands with the right model tag and quantisation

The hard part of the Ollama command line is never the verb. ollama run is obvious. What is not obvious is the argument after it: whether the model you want is llama3.1:8b or llama3.1:8b-q8_0, whether the quantisation suffix is spelled q5_K_M or Q5_K_M, whether it exists in the Ollama library at all or has to be pulled from Hugging Face as hf.co/org/repo:Q4_K_M — and whether the result will fit in the memory you have.

This builder composes that command for you. Pick an action, pick a model, pick a quantisation, and it produces the exact command line, an inline estimate of the memory the choice needs, and a warning when the model is not in the Ollama library and the tag falls back to Hugging Face syntax. It runs entirely in your browser against a curated model list — there is no lookup against ollama.com or Hugging Face, and nothing you select is sent anywhere.

The nine actions it builds

ActionWhat it doesCommand produced
runRun a model interactivelyollama run <tag> plus any run flags
pullDownload a model without starting itollama pull <tag>
createBuild a customised model from a Modelfileollama create <name> -f Modelfile
serveStart the Ollama server in the foregroundollama serve
listList installed modelsollama list
psShow models currently loaded in memoryollama ps
stopUnload a running modelollama stop <tag>
rmDelete a downloaded modelollama rm <tag>
showPrint a model's parameters and templateollama show <tag>

Four of these — serve, list, ps and the model-free forms — take no model argument, and the builder hides the model picker when you select one of them. The other five all operate on a tag, which is where the interesting work happens.

How the tag is resolved

This is the part worth understanding, because it explains why two models that look equally popular produce very different commands.

The builder keeps a curated map from its internal model ids to Ollama library tags — entries such as llama3.1:8b, gemma3:27b, qwen3-coder:30b, deepseek-r1:14b, phi4:14b, mistral-small:24b, gpt-oss:20b and mixtral:8x7b. If the model you pick has an entry, you get a library tag. If it does not but the model has a Hugging Face repository, you get Hugging Face GGUF syntax instead, and the tool raises a warning telling you it is pulling a community GGUF and that you should verify the repo and quant tag exist on the model's Hugging Face page. That warning is the honest signal that the command is a best guess rather than a curated fact.

A custom model with no repository at all falls back to the placeholder your-model:latest, with its own warning telling you to substitute a real tag.

Quantisation suffixes, spelled correctly for each source

The same quantisation is spelled differently in an Ollama library tag and in a Hugging Face GGUF reference, and this is a reliable source of "manifest not found" errors. The builder applies the right casing automatically:

QuantisationOllama library suffixHugging Face tag
FP16 / BF16-fp16:F16
Q8_0-q8_0:Q8_0
Q6_K-q6_K:Q6_K
Q5_K_M-q5_K_M:Q5_K_M
Q4_K_Mnone — it is the defaultnone — it is the default
Q3_K_M-q3_K_M:Q3_K_M
IQ2_M-IQ2_M:IQ2_M

Note the asymmetry in the library column: the quantisation family letter stays uppercase (q5_K_M) while the leading q is lowercase, which is how the library tags are actually spelled. Note too that Q4_K_M produces no suffix on either side. The bare tag already points at it, so llama3.1:8b and llama3.1:8b-q4_K_M would fetch the same weights — the builder emits the clean form.

Worked through: picking Llama 3.1 8B at Q4_K_M gives ollama run llama3.1:8b. Switching the quantisation to Q8_0 gives ollama run llama3.1:8b-q8_0. Picking a model with no library entry gives something of the form ollama run hf.co/org/repo:Q5_K_M, with the same quantisation expressed in Hugging Face's uppercase convention.

The memory estimate

Alongside the quantisation selector the tool shows an estimate of the memory the current model-and-quantisation choice needs, computed from the model's parameter count and the bytes-per-parameter of the chosen quantisation. It is there to catch the mistake before the download, not after: a 70B model at Q8_0 is a very different proposition from the same model at Q4_K_M, and the difference is visible before you commit to fetching several gigabytes. Treat it as an estimate for planning — actual resident memory also depends on your context length and what else is loaded.

Flags versus session settings — the distinction that catches people

Not every option you want is a command-line flag. Three of the run flags genuinely are, and the builder appends them to the command:

  • --keepalive with a duration such as 5m, or -1 to keep the model resident indefinitely, or 0 to unload immediately after the response.
  • --format json to force valid-JSON output.
  • --verbose to print timing information after each response.

Context window, temperature and system prompt are not flags on ollama run. If you set them and the action is run, the builder emits them separately as interactive commands to paste once the session has started — /set parameter num_ctx …, /set parameter temperature … and /set system … with the prompt safely single-quoted — and raises a warning explaining exactly this: these have no run-flag, so either paste the /set lines after the model starts, or bake them into a custom model with create. Expecting --num_ctx to exist is one of the most common Ollama frustrations, and it is a real gap in the CLI rather than a mistake on your part.

Chaining commands into a script

Each composed command can be committed as a step, and the steps accumulate into a single script you can copy in one go. The natural sequence is pull, then create, then run — or a maintenance pass of list, ps and rm. The preview block always shows the current selection appended to the committed steps, so the script you copy is the whole thing including what you are still editing. Individual steps can be removed without disturbing the rest.

Custom models and server tuning, briefly

Selecting create also renders the Modelfile the command expects, with a FROM line for the resolved tag plus whatever parameters and system prompt you set, and there is a panel of Ollama server environment variables that renders as export lines on Unix or setx lines on Windows. Both are here so the command you build is runnable end to end. If persistent configuration is your actual task rather than a one-off command, the Ollama config generator is built around it and goes considerably further.

Troubleshooting

SymptomLikely cause
Manifest or model not found on pullQuantisation suffix does not exist for that tag. Not every model publishes every quantisation — check the model's tag list.
Hugging Face pull failsThe repo does not publish GGUF files, or uses a different quant tag. This is exactly what the fallback warning is telling you to verify.
Model loads then the machine swapsThe quantisation is too large for available memory. Step down one level and re-check the estimate.
--num_ctx is not recognisedIt is not a flag. Use the /set parameter num_ctx line, or a Modelfile.
Settings vanish between sessions/set lines are per-session. Bake them into a model with create.
Another machine cannot reach the serverOllama binds to localhost by default. That is a server environment setting, not a CLI flag.
Model still resident after you finishModels stay loaded for a while by design. ollama stop <tag>, or set --keepalive 0.
Disk filling upollama list then ollama rm. Each quantisation of a model is a separate download.

Limits worth knowing

  • The model list is curated. A brand-new model may not appear, and its library mapping may not exist yet even if it does.
  • Nothing is verified against a live registry. The builder produces correctly-formed commands; whether a specific tag has been published is between you and the registry.
  • The memory figure is an estimate from parameter count and quantisation, not a measurement of your machine.
  • The commands cover the everyday CLI surface listed above, not every flag Ollama accepts.

Choosing a quantisation level

Quantisation is the main lever between "this model does not fit" and "this model fits but is worse", and the selector labels each level with a quality rating so the trade is visible while you choose rather than after you download.

LevelQuality labelTypical use
FP16 / BF16FullUnquantised reference weights. Largest by a wide margin; worth it mainly for evaluation or very small models.
Q8_0FullEffectively lossless in practice, at roughly half the size of FP16.
Q6_KHighA good stop when Q8_0 is slightly too big.
Q5_K_MHighThe usual step up from the default when memory allows.
Q4_K_MGoodThe default the bare library tag points at, and the right starting point for most people.
Q3_K_MReducedNoticeably degraded. Use to fit a larger model that is still better than a smaller one at Q4.
IQ2_MLowLast resort for running something very large on very little.

The memory estimate is driven by bytes per parameter, which is what makes the choice concrete: FP16 costs about 2 bytes per parameter, Q8_0 about 1, and Q4_K_M around 0.6. That is why the same model at the default quantisation is roughly a third the size of its unquantised form, and why stepping from Q4 to Q3 buys far less than stepping from Q8 to Q4 did.

The practical heuristic: prefer a larger model at Q4_K_M over a smaller model at Q8_0 when both fit, and only drop below Q4 when the alternative is not running the model at all. Start at the default, and move up only if you can measure a difference in your own work.

Ollama Commands: The Complete Mental Model

Ollama has three layers of commands, and knowing which layer you are working in makes everything click:

Model management (like a package manager): ollama pull downloads, ollama list shows what you have, ollama rm deletes, ollama cp duplicates. Models are identified as name:tag where the tag encodes size and quantization (llama3.1:8b, gemma3:27b-q8_0).

Running models (interactive or API): ollama run <model> starts an interactive chat (and pulls the model if needed). ollama serve runs the API server that other apps connect to. ollama ps shows what is currently loaded in memory and whether it is on GPU or CPU.

Customization (Modelfiles): ollama create <name> -f Modelfile builds a custom variant — your own system prompt, parameters, or imported GGUF weights.

The session commands (/set parameter, /show info, /bye) work inside an ollama run session and are temporary; Modelfile settings are permanent.

Getting Exact Quantizations: Library Tags vs Hugging Face

Ollama's library (ollama.com/library) hosts popular models with a limited set of quantization tags. The default tag (e.g. llama3.1:8b) is always Q4_K_M. Other quantizations follow the pattern 8b-instruct-q8_0, but not every model has every quant.

When you need a specific quantization the library does not have — or any model not in the library — pull directly from Hugging Face: ollama pull hf.co/{user}/{repo}:{QUANT}. Any public GGUF repository works, and quant tags like Q4_K_M, Q5_K_M, Q8_0 map directly to the GGUF filenames in the repo.

Rule of thumb: use library tags for the common case (default Q4), and hf.co pulls when you care about the exact quantization or want models outside the library.

Frequently Asked Questions

How do I run a model from Hugging Face in Ollama?+

Ollama can pull GGUF models directly from Hugging Face: ollama run hf.co/{username}/{repository} — for example ollama run hf.co/unsloth/Qwen3-8B-GGUF. To pick a specific quantization, append it as a tag: hf.co/unsloth/Qwen3-8B-GGUF:Q4_K_M. This works for any public GGUF repository and is the most reliable way to get exact quantizations. This tool generates these commands for you when you select a Hugging Face model.

How do I increase the context window in Ollama?+

Two ways: temporarily in a session with /set parameter num_ctx 32768, or permanently with a Modelfile: FROM llama3.1:8b then PARAMETER num_ctx 32768, saved via ollama create mymodel -f Modelfile. Ollama defaults to a small context (often 4K) regardless of what the model supports — this is the most common reason long prompts get truncated. Remember larger context uses more VRAM.

What is a Modelfile and when do I need one?+

A Modelfile is Ollama's recipe format for customizing models — like a Dockerfile for LLMs. You need one to: set a permanent system prompt, change default parameters (context size, temperature), or package a custom GGUF file. The format: FROM <base model>, PARAMETER <name> <value> lines, and SYSTEM "<your prompt>". Then ollama create <name> -f Modelfile builds it.

How do I make Ollama listen on my network (not just localhost)?+

Set the OLLAMA_HOST environment variable to 0.0.0.0 before starting the server: OLLAMA_HOST=0.0.0.0:11434 ollama serve (Linux/macOS) or set it as a system environment variable on Windows. Be aware this exposes the API to your network without authentication — only do it on trusted networks or behind a reverse proxy.

How do I run multiple models or serve multiple users with Ollama?+

Two environment variables control this: OLLAMA_MAX_LOADED_MODELS (how many models stay in memory simultaneously — each needs its own VRAM) and OLLAMA_NUM_PARALLEL (how many requests one model serves concurrently — each parallel slot needs its own KV cache). For a single-GPU setup serving a few users, OLLAMA_NUM_PARALLEL=4 with one loaded model is a reasonable starting point.

Why is my Ollama model slow?+

Most common causes, in order: 1) The model does not fully fit in VRAM and layers spilled to CPU — check with ollama ps (it shows the GPU/CPU split). 2) Context size set very high, inflating the KV cache beyond VRAM. 3) Another model is also loaded, competing for VRAM. 4) Flash attention is off — set OLLAMA_FLASH_ATTENTION=1. Use our "What LLM Can I Run?" tool to check what actually fits your GPU.

How do I delete models and free up disk space?+

ollama rm <model> deletes a model. ollama list shows everything you have downloaded with sizes. Models live in ~/.ollama/models (macOS/Linux) or C:\Users\\.ollama\models (Windows). Note that removing a model you created with ollama create does not remove the base model it was built FROM — remove that separately if you no longer need it.

Related tools

This tool is provided for informational and educational purposes only. All processing happens in your browser — no data is sent to or stored on our servers. While we strive for accuracy, we make no warranties about the completeness or reliability of results.