How pasture works¶
This page says what pasture does behind the scenes, and what it promises about your models. The guides show how to use it.
pasture puts a model you have not used in a while out to pasture: it deletes the model from Ollama's models folder and remembers how to bring it back. When a request names that model, pasture brings it back first and then answers the request. The model returns from an archive folder of your choice, such as one on an external SSD, or by downloading it again from the registry it came from.
Where pasture runs¶
pasture runs in front of Ollama on Ollama's usual address,
http://127.0.0.1:11434, and starts ollama serve behind it on
127.0.0.1:11435. Every tool that talks to Ollama keeps working unchanged,
whether it uses Ollama's own API, the OpenAI-compatible API, or the
Anthropic-compatible API. That includes the ollama command, OpenCode, Codex,
and Claude Code.
You set the limits that the models must fit within. Keep a library bigger than your disk explains them.
What pasture never does¶
pasture moves a model away only when the model can come back exactly as it was:
- the archive folder holds a full copy, or
- the model's registry still serves the same manifest, so a download returns the same model.
So a model you built yourself with ollama create, even under a registry name
such as qwen3:8b, stays on disk unless an archive folder is set.
A download brings back the version that the registry serves at that time. If the publisher changes the tag while the model is away, the model comes back as the new version, and the log says so. Set an archive folder to keep the exact version.
A model whose copy is in the archive folder comes back by download only when its registry serves the same manifest. When pasture cannot read the archive, such as when its disk is unplugged, any other such model stays away, and its request fails with a message that names the folder. Connect the disk, and the next request brings the model back.
pasture also never moves:
- a model you pinned;
- a model Ollama holds in memory;
- a model a request is using.
pasture stop, like ollama stop from any app, does not bring a model back,
and it does not count as a use.
When nothing can move away to make room for a model, the request or pull fails
with status 507 and a message that says why, instead of filling the disk. When a
model would not fit even if every model that is not pinned, in memory, or in use
moved away, the request fails at once, and no other model moves away for it. A
sweep in that state moves nothing, rather than move every other model away for
nothing. While pasture runs, pasture budget and pasture pin refuse a change
that would leave the pinned models over the budget.
Moving a model away does not always free disk space at once, as when Time Machine keeps local snapshots or the archive folder is on the same disk. pasture then counts the space each move emptied as free, so it stops once the reserve would hold, rather than move every model away. The log says so once.
Before any model moves away, pasture checks that it reads Ollama's models folder
the way this Ollama writes it: the manifest of a model that Ollama lists must be
in the folder, and its SHA-256 must match the digest that Ollama lists. When the
check fails, as after an Ollama update that changes how it stores models, or
when OLLAMA_MODELS points pasture at another folder, pasture moves no model
away, and pasture status says why.
pasture refuses a request on its port that Ollama would refuse because of its
Host or Origin header, such as a request from a web page on another site,
before it acts on the request. So such a page cannot move, bring back, or
delete your models through pasture. Ollama accepts pages served from
localhost or 127.0.0.1 on any port, and the origins that OLLAMA_ORIGINS
names or that you allow with pasture allow, so pasture accepts them too.
pasture's own commands, such as pasture evict, need pasture's admin token,
which only the pasture command sends. So even a web page that Ollama accepts
cannot move models or change pasture's settings. A web page also needs the
token to delete a model that is moved away or that the archive holds a copy of,
because the delete removes the archive copy too. pasture remove is not a web
page, so it deletes such a model with no token.
pasture never prints the node key that pairing gives this machine, keeps it in a file only you can read, and sends it only to the link address that pairing gave. The link serves only the requests that run a model and the model lists, so your account cannot pull, delete, or move your models through it.