Ray Fu, ex-Meta senior engineer and AI automation educator

Ray Fu

I'm an Ex Meta Senior Engineer that makes content and teaches OpenClaw and AI Automations.

stan.store/raycfu

How to Run OpenClaw for Free with Gemma 4

Don't want to figure this out alone? I walk members through every step inside the community. Join the Skool → skool.com/raycfu

OpenClaw is an open source AI assistant that connects to your messaging apps (WhatsApp, Telegram, Discord, Slack, and more) and automates tasks on your behalf. Normally it runs on cloud models like Claude or GPT which cost money per token. Gemma 4 is Google's open source model released April 2, 2026 under Apache 2.0. It runs locally on your hardware through Ollama. Connect the two and you have a full AI agent running for free.

WHY GEMMA 4 SPECIFICALLY

Not every local model works well as an agent. OpenClaw needs a model that can reliably call tools, which means formatting function calls correctly every single time. Most small models fail at this. Gemma 4 was specifically built for agentic use. It scores 85.5% on agentic tool use benchmarks and has native function calling out of the box.

The model you want is the 26B A4B. It is a mixture of experts model with 26 billion total parameters but only 3.8 billion active at any given time. That means it runs at the speed of a tiny model but thinks at the level of a much bigger one. It handles calendar management, message drafting, quick lookups, file operations, simple code review, and basic automations without breaking a sweat. In practice this covers 60 to 70% of what most people use OpenClaw for.

HARDWARE REQUIREMENTS

Gemma 4 comes in four sizes. Here is what each one needs:

E2B: Runs on any modern phone. iPhone 15 and up, Pixel 8 and up. Good for simple Q&A but too small for serious agent work.

E4B: Runs on most laptops and the base Mac Mini M4 with 8GB RAM. Handles basic tasks but struggles with complex multi-tool chains.

26B A4B (the one you want): Mac Studio M4 Pro with 48GB is the sweet spot. Also runs well on any Mac with Apple Silicon and 24GB or more, or a PC with an NVIDIA GPU with 16GB+ VRAM (RTX 3090, 4090, etc). At Q4 quantization the model needs about 10 to 14GB. A Mac Mini with 24GB unified memory runs it comfortably with headroom to spare.

31B Dense: Mac Studio M4 Max with 64GB or more. The strongest model in the family but significantly slower than the 26B. Only worth it if you need maximum quality and have the hardware.

If you are not sure, go with the 26B A4B. It is the local sweet spot that the community has settled on.

CPU only: Technically possible but not usable. Under 1 token per second on most consumer hardware. You need a GPU or Apple Silicon.

SETUP IN 3 STEPS

STEP 1: INSTALL OLLAMA

Go to ollama.com/download and grab the installer for your operating system.

On Mac: Download the app, open it, done. It runs quietly in the background.

On Windows: Download the installer and follow the prompts.

On Linux: Open terminal and run:

curl -fsSL https://ollama.com/install.sh | sh

After installing, verify it works:

ollama --version

If you get an error, the Ollama service might not be running. Start it with:

ollama serve

STEP 2: PICK YOUR MODEL

Pull the 26B A4B model:

ollama pull gemma4

This downloads the model to your machine. Depending on your internet speed it takes a few minutes. The default gemma4 tag pulls the 26B A4B variant which is the one you want.

Test that it works:

ollama run gemma4

Type a simple question and make sure you get a response. Press Ctrl+D to exit.

If you want a different size:

ollama pull gemma4:e4b (for the smaller 8B model on limited hardware) ollama pull gemma4:31b (for the full 31B dense on powerful hardware)

You can skip this step entirely if you want. Step 3 handles the download automatically.

STEP 3: LAUNCH OPENCLAW WITH GEMMA 4

One command:

ollama launch openclaw --model gemma4

That is it. Ollama downloads Gemma 4 if you have not already, installs OpenClaw if you do not have it, connects them together, and launches everything. Your agent is now running locally.

If you want it to skip the selection menu and auto-pull:

ollama launch openclaw --yes --model gemma4

IMPORTANT CONFIGURATION NOTE

Set reasoning to false for Gemma 4 in your OpenClaw config. Gemma 4 handles tool calling well but reasoning mode causes formatting issues with OpenClaw's expected tool-call format. If you leave reasoning on, tool calls will fail silently.

In your openclaw.json (located at ~/.openclaw/openclaw.json), make sure your Ollama provider config looks like this:

{ models: { providers: { ollama: { baseUrl: "http://localhost:11434/v1", apiKey: "ollama", api: "openai-completions", models: [ { id: "gemma4:latest", name: "Gemma 4 26B", reasoning: false, contextWindow: 131072, maxTokens: 8192 } ] } } } }

If you have 24GB or more of memory, set contextWindow to 131072 (128K). If you are on 16GB, drop it to 32768 to avoid quality degradation under memory pressure.

WHAT GEMMA 4 HANDLES WELL

Calendar management. Message drafting. Quick lookups. File operations. Simple code review. Basic automations. Scheduling. Reminders. Simple Q&A. Heartbeat checks. Sub-agent tasks that do not require deep reasoning.

This is the routine stuff that makes up 60 to 70% of a typical OpenClaw session. All of it running locally, no API cost, no data leaving your machine.

WHERE GEMMA 4 FALLS SHORT

Multi-file refactoring. Anything touching 5 or more files gets unreliable. The model loses track of changes across files.

Complex debugging. If a bug spans multiple abstraction layers, Gemma 4 tends to suggest surface-level fixes.

Deep multi-step reasoning. Long chains of dependent logic where each step builds on the last. This is where cloud models like Opus and GPT-5.4 still win.

Large context under memory pressure. Even though it supports 128K context, running at that length on tight hardware slows everything down. Keep context reasonable for your setup.

THE SMART SETUP: HYBRID LOCAL + CLOUD

Most people end up using Gemma 4 for the routine stuff and keeping a cloud model for hard tasks. Here is how to set that up in your OpenClaw config:

{ agents: { defaults: { model: { primary: "ollama/gemma4:latest", thinking: "anthropic/claude-sonnet-4-6" } } } }

This tells OpenClaw to use Gemma 4 locally for daily interactions and sub-agents, and only switch to Claude Sonnet when the task needs serious reasoning. You can also switch models on the fly inside OpenClaw:

/model gemma (switch to local Gemma 4) /model sonnet (switch to Claude Sonnet) /model opus (switch to Opus for the hard stuff)

To make those short aliases work, add this to your config:

{ agents: { defaults: { models: { "ollama/gemma4:latest": { alias: "gemma" }, "anthropic/claude-sonnet-4-6": { alias: "sonnet" }, "anthropic/claude-opus-4-6": { alias: "opus" } } } } }

One user running this hybrid setup dropped their monthly API bill from $40 to under $5. The local model handles the volume. The cloud model handles the hard problems. You pay almost nothing.

VERIFY EVERYTHING IS WORKING

After launching, test a few things:

Send a simple message through whichever channel you have connected (WhatsApp, Telegram, etc). You should get a response.

Check that tool calls work by asking the agent to do something that requires a tool, like checking a file or looking something up.

To confirm nothing is going to the internet, disconnect from WiFi and send another message. If you still get a response, you are fully local.

If the agent cannot see your files or run commands, check /permissions inside OpenClaw and make sure the basic tools (Read, Write, Edit, Bash) are in the allow list.

TROUBLESHOOTING

"Connection refused" error: Ollama is not running. Start it with ollama serve in a separate terminal.

"Model not found" error: Run ollama list to see what models you have downloaded. Make sure you are using the exact model name.

Tool calls failing: Check that reasoning is set to false in your model config. This is the number one issue people run into with Gemma 4 on OpenClaw.

Very slow responses: Make sure Ollama is using your GPU. On NVIDIA, check with nvidia-smi. On Mac, Ollama uses Metal automatically. If it is still slow, try dropping the context window size.

"Unknown command: launch" error: Your Ollama version is too old. Update to v0.14.0 or later from ollama.com/download.

You just read the full playbook. Most people will close this tab and never implement it. The ones who do usually hit a wall around the technical setup and quit.

Inside the Skool, I walk you through the exact build step-by-step, troubleshoot your setup live in the community, and share the scripts and templates I use to actually land paying clients.

If you want the shortcut instead of the long way around:

Join the Skool →