Ollama Mock 🦙
A fake Ollama server for testing without running models. Same API, same port, any model name.
Answers are deterministic, varied and kinda realistic in shape: thinking, tool calls, vision, JSON, embeddings, decisions, fill-in-the-middle, real model sizes and token speeds. Ollama works as usual. Open source on GitHub.
Loading the mock (about 2 MB of WebAssembly)…
Last request and response
Things to try
| Same question twice | Start a new chat and ask it again: same answer, word for word. |
| The CLI | The Terminal tab is the ollama CLI pointed at the mock: pull, list, ps, show, run, stop, cp, rm, and curl against the API. The log above it shows every request, from any tab. |
| Any model | Pull any name from the library, like ollama pull mistral-small3.2:24b, then pick it in Chat. Its size sets the download, load time and token speed. |
| Tools | Turn on Tools and ask about the weather in a city. The model calls get_weather with the city from your prompt, the page answers with a made-up result, and the model replies. |
| Vision | Pick gemma3:4b and attach an image. The mock counts images rather than looking at them, so the description is filler. |
| JSON | Turn on JSON to send a schema as format. The answer always matches it. |
| Decision | Typed questions about a state: yes or no, one of a set, or a score. Each comes back with probabilities that sum to 1. |
| Embeddings | Texts that share words land closer together, so the two password questions score higher with each other than with the pizza ones. |
| Infill | A code model fills the gap between the two halves, the way an editor's autocomplete asks. |
| Errors | A model you haven't pulled, tools on gemma3:4b, or a chat with nomic-embed-text get Ollama's own errors. |
| Stop | Stop mid-answer: the request is cancelled inside the mock, as a client hanging up would. |
This is the real mock, compiled to WebAssembly, answering requests in this tab, with qwen3:8b, llama3.2, gemma3:4b, nomic-embed-text, kev and qwen2.5-coder:7b installed. Nothing is sent anywhere. Open the console and try await (await ollamaMock.fetch("/api/ps")).json().
Run it
go install github.com/kinduff/ollama-mock/cmd/ollama-mock@latest ollama-mock -models qwen3:8b,llama3.2,nomic-embed-text
It listens on 127.0.0.1:11434, like Ollama, so your code and the ollama CLI work against it unchanged.
curl -N localhost:11434/api/chat -d '{
"model": "qwen3:8b",
"messages": [{"role": "user", "content": "How do I keep a sourdough starter alive?"}]
}'
In CI, -latency 0 drops every wait. From Go, mock.New(mock.Options{...}) is an http.Handler for httptest.
Endpoints
/api/* | Ollama's native API: chat, generate, embed, pull, show, ps, create, copy, delete. |
/v1/* | The OpenAI-compatible API: chat completions, completions, embeddings, models. |
/v1/systemone | Typed decisions for decision models like kev. |
/_mock/* | For tests: inspect state and requests, inject faults, reset. |
Everything else, including faults and how answers are made, is in the README.