induwara.lk
induwara.lkDeveloper · AI

Ollama Modelfile Generator

Turn a base model, system prompt and sampling parameters into a valid Ollama Modelfile — plus the exact ollama create and ollama run commands. Built entirely in your browser from the official spec. No signup, no upload.

By Induwara AshinsanaUpdated Jul 9, 2026
Build your Modelfile
Ollama spec · client-side
Presets

Used in the ollama create command. Lowercase, digits and . _ - only.

Any Ollama library tag, or a namespace/model path.

The persistent instruction baked into the model. Leave blank to omit the SYSTEM block.

Sampling parameters

Each becomes one PARAMETER stop line. Press Enter or Add.

Generated Modelfile

FROM llama3.1

SYSTEM """You are a helpful assistant."""
1 · Build the model
ollama create my-model -f Modelfile

Save the Modelfile next to your terminal, then run this.

2 · Run it
ollama run my-model

Starts an interactive chat with your custom model.

Everything is generated in your browser from the official Ollama Modelfile spec. No account, no upload, no network calls.

How it works

A Modelfile is Ollama's build recipe for a custom model — the local-LLM equivalent of a Dockerfile. This generator maps each form field to an instruction from the official Ollama Modelfile grammar and assembles them in the order Ollama expects. Nothing is invented: every default and valid range is pinned from the Ollama documentation and the reference table below renders from those same constants, so the tool and the docs cannot drift.

  1. FROM — always the first line: FROM <base model>. The spec requires it, so the tool blocks generation until you supply a base model such as llama3.1.
  2. SYSTEM — if you enter a system prompt, it is emitted as a triple-quote block: SYSTEM """…""". The block form keeps multi-line prompts intact, and any literal """ inside your text is escaped so it cannot close the block early.
  3. PARAMETER — one line per setting: PARAMETER <name> <value>. With "Only emit changed params" on (the default), a parameter is written only when it differs from the Ollama default, keeping the file minimal. Turn it off to write every parameter explicitly. Each stop sequence becomes its own PARAMETER stop "…" line, which the spec allows you to repeat.
  4. TEMPLATE and LICENSE — emitted verbatim in """ blocks only when the advanced fields are filled, so most files stay clean.
  5. Commands — the tool assembles ollama create <name> -f Modelfile and ollama run <name>. Your name is lowercased and stripped to [a-z0-9._-]to match Ollama's naming rules; if it changes, a notice tells you what it became.

Validation runs on every keystroke. Out-of-range values (for example a temperature above 2.0) raise an inline warning before the output, so you never copy a file Ollama will reject. Because the whole thing is a pure, deterministic function of the form, the same inputs always produce the same Modelfile — and an internal cross-check confirms the number of PARAMETER lines in the output matches the number of non-default values you set.

Parameter reference

Every supported PARAMETER with its Ollama default, valid range and effect. These are the exact values the generator writes and diffs against.

ParameterDefaultRangeWhat it does
temperature0.80.02Creativity vs. determinism. Higher is more random; lower is more focused. Ollama default 0.8.
top_k400200Sample only from the K most likely next tokens. Higher gives more diversity; lower is more conservative.
top_p0.90.01Nucleus sampling: keep the smallest set of tokens whose probability sums to top_p. Works with top_k.
min_p0.00.01Drop tokens below this fraction of the most likely token's probability. An alternative to top_p.
repeat_penalty1.10.02Penalise repeated tokens. Higher penalises repetition more strongly; 1.0 disables the penalty.
repeat_last_n64-12,048How far back the repeat penalty looks. 0 disables it; -1 uses the full context window (num_ctx).
num_ctx2048256131,072Context window size in tokens. Larger fits more history but uses more memory (VRAM/RAM).
num_predict-1-28,192Max tokens to generate per reply. -1 = generate until a stop; -2 = fill the remaining context.
seed004,294,967,295Random seed. A fixed non-zero value makes generations reproducible for the same prompt; 0 is random.

Worked examples

Low-temperature SQL tutor (minimal file)

Only changed params · on

  1. Name sql-tutor · base llama3.1 · temperature 0.3 · num_ctx 8192
  2. Only 0.3 ≠ 0.8 and 8192 ≠ 2048, so just two PARAMETER lines appear.
  3. FROM llama3.1
  4. SYSTEM """You are a SQL tutor. Always answer with ANSI SQL and explain briefly."""
  5. PARAMETER temperature 0.3
  6. PARAMETER num_ctx 8192
  7. → ollama create sql-tutor -f Modelfile · ollama run sql-tutor

Creative writer with stop tokens (explicit file)

Only changed params · off

  1. Name story-bot · base mistral · temperature 1.2 · top_p 0.95 · repeat_penalty 1.15 · num_predict 512
  2. Stop sequences <|end|> and User: each get their own quoted line.
  3. FROM mistral
  4. SYSTEM """You are a vivid fiction writer."""
  5. PARAMETER temperature 1.2 … (all 9 params written because the toggle is off)
  6. PARAMETER stop "<|end|>"
  7. PARAMETER stop "User:"
  8. → ollama create story-bot -f Modelfile · ollama run story-bot

Edge case: messy model name

Sanitisation

  1. You type the name "My SQL Tutor!" with spaces and a bang.
  2. Ollama names allow only lowercase, digits and . _ - characters.
  3. The tool sanitises it to my-sql-tutor and shows a notice.
  4. → ollama create my-sql-tutor -f Modelfile

Frequently asked questions

Sources & references

Parameter defaults and ranges on this page were last cross-checked against the Ollama documentation on 2026-07-09. They are reviewed whenever Ollama publishes a change to the Modelfile spec.

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.