OzAI: a self-hosted ChatGPT on a 16 GB MacBook with Ollama, LiteLLM and Open WebUI, and what broke
- Hardware
- MacBook Pro M1 Pro, 16 GB RAM
- Models & engines
- Ollama running natively on macOS (Metal), serving qwen3:8b (Q4_K_M, 5.2 GB) and qwen2.5-coder:3b (Q4, 1.9 GB)
- Key gotcha
- Qwen3's hidden reasoning made one simple answer take about two minutes, and with a small max_tokens it could spend the whole budget thinking and return nothing. Default to a thinking-off alias.
What they built
Ahmet Ozan GAZİ, a DevOps engineer, wanted a better answer to the interview question "What have you done with AI?" than calling a cloud API. He set out to run open-weight models himself and serve them to other people like a real platform, with API keys, rate limits, usage tracking and his own measurements.
The result, OzAI, runs entirely on one MacBook Pro M1 Pro with 16 GB of RAM. It is not a trained model but a self-hosted platform around Qwen3 8B and Qwen2.5-Coder 3B, with a ChatGPT-style web UI, self-hosted web search and VS Code integration.
Everything except Ollama runs in Docker Compose bound to 127.0.0.1, so nothing is exposed to the internet. The post is part 1 of a 3-part series; later parts cover observability and a move to GPUs on Amazon EKS.
Setup
- MacBook Pro M1 Pro, 16 GB RAM
- Ollama running natively on macOS (Metal), serving qwen3:8b (Q4_K_M, 5.2 GB) and qwen2.5-coder:3b (Q4, 1.9 GB)
- LiteLLM gateway: OpenAI-compatible API, per-user virtual keys, model allow-lists, rate limits, request log in Postgres
- Open WebUI as the chat UI, talking only to the gateway
- SearXNG as a self-hosted search engine for recent-events questions
- VS Code with the Continue extension; Grafana dashboards planned for part 2
How it works
- Ollama runs on the host, not in a container, because Docker on macOS runs containers in a Linux VM without Apple GPU access; containers reach it at host.docker.internal:11434.
- LiteLLM maps friendly names to models: "ozai" is Qwen3 8B with thinking off, "ozai-think" is the same weights with thinking on, and "ozai-coder" is the 3B coder.
- Each client gets its own virtual key with its own allowed models and requests-per-minute limit.
- Open WebUI pulls SearXNG results into the prompt so the model can answer about recent events without a third-party search API.
- Chat and code edits in VS Code go through the gateway; autocomplete goes straight to Ollama.
Results & numbers
- Single-request speed: qwen2.5-coder:3b at 53.3 tok/s generation, qwen3:8b at 22.4 tok/s, with cold loads of 2.1 s and 3.9 s.
- Gateway checks behaved as expected: no key gave 401, a key asking for a model outside its allow-list gave 403, and a 10-per-minute key got 429 after its limit.
- Total throughput stayed flat at about 20 tok/s from 1 to 8 concurrent users; time to first token rose from 0.3 s to 21.3 s median (43.3 s worst) at 8 users.
- Setting num_ctx to 8192 let a ~5,000-token prompt through intact (5,430 prompt tokens counted) and raised memory use from 5.6 GB to 6.2 GB.
Gotchas
- Qwen3's hidden reasoning made one simple answer take about two minutes, and with a small max_tokens it could spend the whole budget thinking and return nothing. Default to a thinking-off alias.
- A LiteLLM key with max_budget 0 blocked every request, because local models cost $0 and the check is spend >= budget. Leave the budget unset or set a custom price.
- Open WebUI's background title, tag and follow-up requests queued in front of the user's next question. Point them at the small model and turn off tags and follow-ups.
- Ollama silently cut long prompts to fit its context window, keeping the end, so Open WebUI's search results at the start were dropped every time. Every request showed exactly 2,050 prompt tokens.
- LiteLLM's completions endpoint dropped the fill-in-the-middle parameters, so autocomplete answered like a chatbot until it was sent directly to Ollama.
- The 8B model answered precise technical questions confidently and wrongly, and reported a knowledge cutoff of October 2023; give it search or documents instead.
“in LLM serving, "no error" doesn't mean "correct."”— Ahmet Ozan GAZİ
Do it yourself
- Install Ollama natively on the Mac and pull qwen3:8b and qwen2.5-coder:3b.
- Measure single-request speed for each model before building anything else.
- Run LiteLLM, Postgres, Open WebUI and SearXNG in Docker Compose, binding every port to 127.0.0.1.
- In LiteLLM's model list, point at ollama_chat models via host.docker.internal:11434, set num_ctx: 8192, and add a thinking-off alias as the default.
- Generate a virtual key per user with an allowed model list and rpm_limit, and test 401, 403 and 429 cases.
- In Open WebUI's admin settings, send background tasks to the 3B model and turn off tags and follow-ups.
- Connect VS Code's Continue extension to the gateway for chat, and to Ollama directly for autocomplete.
- Test for truncation by placing a secret word at the start of a long prompt and checking the reported prompt token count.
model_list:
- model_name: ozai # fast chat
litellm_params:
model: ollama_chat/qwen3:8b
api_base: http://host.docker.internal:11434
reasoning_effort: none
num_ctx: 8192Similar setups
A €200 mini PC as an offline AI box: a week with Gemma and Qwen
Diogo Soares ran Gemma 4 E4B and Qwen2.5-Coder 7B on a cheap NiPoGi P1 mini PC firewalled off the internet, used it from his Mac for a week, and measured what was fast and what wasn't.
A 4B local model on a 4 GB laptop GPU as a PASS/FAIL test evaluator
Qwen3 4B Instruct in Ollama (Docker, WSL2) grades a Spring Boot app's root-cause answers against expected ones, returning a JSON verdict, with every speed and memory number measured on a 4 GB Quadro T1000.
PatchPal TinyAgent: a coding agent on a 4B model and a 6GB laptop GPU
WiseProbe adapted its PatchPal coding agent to run Gemma 4 E4B or Qwen3.5 4B through Ollama on a 6GB RTX A1000, using handoff-note compaction and capped file reads to work inside a 16K or 32K window.
A private ChatGPT alternative on a six-year-old RTX 3090 with Ollama, Open WebUI and imported chat history
Pascal Hetzscholdt turned an older desktop with an RTX 3090 into a local research assistant running GPT-OSS 20B through Ollama and Open WebUI, then imported years of ChatGPT conversations so the local model can search them.