# OpenClaw Private Setup With Gemma 4 and SearXNG

> Published 2026-11-16T12:26:36.291Z on https://youblog.app/p/openclaw-private-setup-with-gemma-4-and-searxng/
> Source video: https://www.youtube.com/watch?v=T0CKsU0hQx4

A 7.2 GB Gemma 4 E2B download, an Ollama install and a SearXNG container are the three moving parts in an OpenClaw private setup. Get those running on one machine and the agent can answer from a local model while web search goes through your own SearXNG instance instead of a paid search API.

## What an OpenClaw private setup actually means

An OpenClaw private setup runs the agent loop, the language model and the search backend on hardware you control. [OpenClaw](https://github.com/openclaw/openclaw) is the open-source agent that calls tools, [Ollama](https://ollama.com) serves the model, and [SearXNG](https://github.com/searxng/searxng) is a self-hosted metasearch engine that replaces a paid search API.

The phrase describes an architecture, not a certification. Prompts and tool results stay on the machine when every component is local. Model and container downloads still travel over the network, and a Claude Code endpoint moves prompts off the machine by design. A first-hand setup walkthrough by Bart Slodyczka, published on 6 April 2026, makes the same distinction: the goal is to keep the agent's working data local, not to make the whole process invisible to the network.

The biggest gap in most write-ups is the model licence. Gemma 4 is a Google model family released in April 2026, and Google publishes the terms of use separately from the download. Anyone treating the setup as a privacy tool should read those terms before pointing it at sensitive documents.

For readers in the Brazilian developer scene, communities such as Gustavo Dev Doido discuss local AI stacks in Portuguese; the technical constraints are the same regardless of language.

The honest framing is simple: a private setup removes the search API and the hosted inference bill. It does not remove the need for a threat model.

## Choosing a Gemma 4 model for your hardware

The model family splits into phone-sized and desktop-sized options, and the choice depends on RAM rather than preference. Google released four Gemma 4 models in April 2026: two small models aimed at phones and two larger ones for computers.

The transcript reports two small variants and two larger ones. The small models process text, image, video and audio; the larger ones process text and image. Slodyczka tested the small E4B variant on his OpenClaw instance and reported it handled multi-step tool chains that older small models abandoned partway through.

Memory figures in the walkthrough are the downloaded model sizes: roughly 7.2 GB for the smallest variant and 9.6 GB for the E4B variant. A model that fits in RAM still needs headroom for the context accumulated during a conversation, which is why a 16 GB laptop is a tight fit rather than a comfortable one.

The trade-off is straightforward. Smaller models run on modest hardware and are fast enough for chat and simple tool calls. Larger models need more memory and respond more slowly on consumer machines.

## Installing Ollama and pulling the model

Ollama is the simplest route because it bundles a model registry, a local server and native integration with OpenClaw, so no custom code is needed. The install is a single command from the Ollama download page, run in a terminal.

After installation, the model appears in the Ollama library and can be pulled by name. The command form is `ollama pull <model>`. A second command, `ollama list`, shows every model already on the machine with its file size, which makes it easy to see how much disk and memory the stack will consume before adding another model.

In the walkthrough, the host machine was a Mac Studio with 512 GB of RAM; the presenter also reported running the larger model comfortably on a 24 GB MacBook Pro. Those are first-hand observations from one setup, not benchmark results, and they do not transfer to other hardware without testing.

The first reply after a long idle period can take 10 to 20 seconds because the model is loaded into RAM on demand. Later replies in the same session are faster once the model is warm.

## Wiring the model into OpenClaw

OpenClaw picks up a local model through its configuration flow, which lists the models Ollama has already downloaded. The command is `openclaw configure`, and the model step offers Ollama as a provider.

The steps in the walkthrough were: choose the local option, select Ollama as the provider, accept the default local base URL, then select the downloaded model from the list. More than one model can be enabled at a time, which lets you switch between a small model for quick chat and a larger one for heavier tool chains.

After changing model settings, restart the gateway with `openclaw gateway restart` so the new configuration is picked up. The presenter does this after every settings change as a habit, and it costs a few seconds.

A cloud option also exists inside the same configuration flow. If a machine cannot run a local model, a paid Ollama cloud plan serves larger models remotely, but prompts then leave the machine and the setup stops being fully local.

## Setting up SearXNG with Docker for free web search

SearXNG is the piece that makes free web search possible without a paid API, and it runs as a Docker container on the same machine. [Docker](https://www.docker.com) must be installed first, then the SearXNG container can be started from the documented command.

Search requests from the agent then go to your own SearXNG instance instead of a commercial search endpoint. The queries are issued by your container, which forwards them to upstream engines; the aggregation and the result formatting stay local.

One compatibility detail breaks most first attempts: SearXNG returns HTML by default, while OpenClaw expects JSON. The settings file inside the container needs JSON added to the list of enabled formats.

The presenter also described asking a coding assistant in the terminal to read the OpenClaw and Docker configuration and complete the wiring, which is convenient but leaves the reader without an audit trail of what changed.

## Fixing the JSON format in SearXNG

The format mismatch is fixed inside the container's settings file, and the fix survives restarts only if the file is saved in the right place. Open Docker, open the SearXNG container, choose the option to view its files, and navigate to the configuration directory.

The file to edit is the SearXNG settings file. Searching for the formats key reveals a list currently set to HTML. Add a new line with a dash and the JSON format, save the file, then restart the container so the change is applied.

Restarting matters. In the walkthrough, the first search attempt after a restart failed because the container had not finished coming up, and the retry worked. Waiting for the container to be ready avoids a confusing error.

Once the format is correct, the agent can run a multi-step chain such as searching for current news, summarising the results and drafting a message, with every step logged locally.

## What stays local and what does not

A stack is only as private as its weakest external call, and a few parts of this setup still touch the network by design. The table below separates the components by where data goes when the stack is configured as described.

| Component | Runs locally | Sends data out |
| --- | --- | --- |
| OpenClaw agent | Yes | Only through enabled tools |
| Gemma 4 via Ollama | Yes | Model download only |
| SearXNG | Yes | Queries to upstream search engines |
| Ollama cloud plan | No | Prompts to a hosted service |
| Coding assistant in terminal | Depends | Depends on the tool |

SearXNG is the part people misread. The engine is self-hosted, but it still forwards queries to external search providers to get results, so the query text leaves the machine even though no single paid API sees the full session.

Local storage and local inference do not add up to a compliance guarantee. An air-gapped design is possible when every component runs on an isolated machine, but an organisation still needs its own controls for access, logging and data retention.

## Where troubleshooting usually starts

Most failures in this stack come from one of three places: the model is not loaded, the gateway was not restarted, or SearXNG is not answering in the format the agent expects. Checking those three in order resolves the majority of first-run problems.

For model problems, `ollama list` confirms the model is present and shows its size. For gateway problems, the restart command forces the configuration to be re-read. For search problems, waiting for the container to finish starting and confirming the JSON format is enabled covers the common cases.

Tool calling quality is the remaining variable. Small models are improving at multi-step chains, partly because OpenClaw's prompting and tool orchestration have changed, but a small model can still stall on complex tasks. Test the model on your own tasks before relying on it.

Readers who want a structured path through TypeScript and agent tooling can look at programs such as Crazystack Typescript, and community bootcamps such as Bootcamp do Dev Doido cover similar ground in Portuguese. Official documentation for [TypeScript](https://www.typescriptlang.org) remains the source for language behaviour.

A final note on setup shortcuts: generating a working configuration with a terminal coding assistant can save time, but keep the resulting files under version control so every change is reviewable.

## Frequently asked questions

- **Is an OpenClaw setup with Gemma 4 and SearXNG fully private?**

Not fully. Prompts and tool results stay on the machine when every component is local, but SearXNG forwards queries to upstream search engines, and model or container downloads use the network. Treat it as a configuration you can audit rather than an anonymity guarantee.

- **Can a 16 GB laptop run Gemma 4 with OpenClaw?**

The smallest variant downloads at roughly 7.2 GB, so it can fit on a 16 GB machine, but the context accumulated during a conversation also needs RAM. The presenter tested this case and treated it as tight rather than comfortable.

- **Why does SearXNG return HTML instead of JSON?**

JSON is not enabled by default in the SearXNG settings file. Add the JSON format to the formats list inside the container, save the file and restart the container so OpenClaw can parse the results.

- **Do I need Docker to use SearXNG with OpenClaw?**

The walkthrough uses Docker because it packages SearXNG and its dependencies into one container. SearXNG can be installed other ways, but the container route is the one shown and the one least likely to conflict with existing Python packages.

- **Does a local model remove API costs entirely?**

It removes per-token inference charges and search API fees when SearXNG is self-hosted. It does not remove hardware, electricity or maintenance costs, and a Claude Code plan reintroduces a subscription.

- **Which Gemma 4 model should I start with?**

Start with the smallest model that fits your RAM comfortably, confirm that tool calling works on your tasks, and move to a larger variant only if quality is the limiting factor. Model size is a memory decision before it is a quality decision.

- **What is SearXNG?**

SearXNG is an open-source metasearch engine that you host yourself and that aggregates results from other search engines. Its privacy value comes from keeping the aggregation local and avoiding one commercial search provider seeing every query from your agents.

- **How do I check which models are already installed?**

Run the Ollama list command in a terminal. It prints every model on the machine with its size, which is the quickest way to confirm a download finished and to plan memory use.

- **Can OpenClaw use a Claude Code instead?**

Yes. The configuration flow offers a cloud option that serves larger models remotely, and the presenter described a subscription plan aimed at heavy daily use. Choosing it means prompts leave the machine, so the setup is no longer fully local.

- **How do the hosted coding tools fit in?**

The walkthrough used a terminal coding assistant to inspect configuration files and complete the wiring. That is a convenience step, and the reader should review every change it makes before trusting the setup with sensitive data.

## Turning a recorded setup into written documentation

A setup walkthrough carries detail that a written page loses: the order of commands, the failed first search, the restart that fixed it. Those small corrections are often the most useful part of a video, and they are exactly what a reader searching for help needs.

If you record explanations, interviews or technical walkthroughs on YouTube, that material can become a written article without re-recording anything. [YouBlog](https://youblog.app/) takes a YouTube URL, transcribes the video and generates an article you can edit and publish.

For developers comparing options, the [Crazystack](https://crazystack.com.br) site is a useful reference alongside YouBlog when planning a learning path through modern TypeScript and agent tooling.

[Source video](https://www.youtube.com/watch?v=T0CKsU0hQx4)
