A custom Ollama model packages a base model with a Modelfile so the system prompt, parameters, template, adapters, or imported weights can be reused by name. It keeps application prompts shorter and makes model behavior easier to version.

The simplest Modelfile starts from an existing model and adds a SYSTEM instruction or PARAMETER values. More advanced Modelfiles can point at GGUF or Safetensors sources, but the same ollama create command builds the local model name.

Create custom names in a disposable namespace while testing. Remove failed or experimental names so later scripts do not accidentally use old behavior.

Steps to create a custom Ollama model:

  1. Create a Modelfile for the custom behavior.
    FROM gpt-oss:20b
    SYSTEM You answer every smoke test with the word OK.
    PARAMETER temperature 0
  2. Build the custom model from that Modelfile.
    $ ollama create example/ok-model -f Modelfile
    transferring model data
    using existing layer sha256:17052f91a42e
    writing manifest
    success
  3. Inspect the generated model metadata.
    $ ollama show example/ok-model
      Model
        architecture        gptoss
    ##### snipped #####
  4. Run the custom model with a short smoke test.
    $ ollama run example/ok-model "Smoke test"
    OK
  5. Remove the custom model if it was only a validation artifact.
    $ ollama rm example/ok-model
    deleted 'example/ok-model'