How to use Gemma 4 with OpenClaw

April 15, 2026 by @anthonynsimon

OpenClaw is an open-source personal AI assistant that runs on your own hardware and connects to chat apps like WhatsApp, Telegram, Slack, and Discord. Paired with Gemma 4 running locally through Ollama, you get a capable AI agent that keeps your data private with zero API costs.

This guide walks you through setting up OpenClaw with Gemma 4 as the local model backend.

Prerequisites

Before you start, make sure you have:

  • Ollama installed and running. If you don't have it yet, follow our guide to running Gemma 4 locally first.
  • Node.js 18+ installed on your system.
  • A machine with at least 8 GB of RAM (16 GB+ recommended for the 26B model).

Choosing a Gemma 4 Model

OpenClaw recommends a model with at least a 64K context window, and all Gemma 4 variants meet that threshold with their 256K context.

  • gemma4:e4b: Best for laptops and machines without a dedicated GPU. Lightweight but capable enough for most tasks.
  • gemma4:26b: The recommended choice if you have 16 GB+ VRAM. It's a Mixture-of-Experts model that activates only 4B parameters per inference, delivering strong reasoning at lower compute cost.
  • gemma4:31b: The most capable option for workstations with 24 GB+ VRAM.

Pull your chosen model with Ollama:

ollama pull gemma4:e4b

Verify it's available:

ollama list

Installing OpenClaw

Install OpenClaw globally via npm:

npm install -g openclaw@latest

Then run the onboarding wizard, which installs the background gateway daemon:

openclaw onboard --install-daemon

The wizard will walk you through initial setup, including selecting a model provider. You can skip the provider selection for now since we'll configure Ollama manually.

Connecting OpenClaw to Gemma 4

The fastest way to connect OpenClaw to a local Gemma 4 model is through Ollama's built-in launcher:

ollama launch openclaw --model gemma4:e4b

This single command handles the full setup: it configures OpenClaw to use your local Gemma 4 model, sets up the gateway, and starts the service.

Manual Configuration

If you prefer to configure the connection manually, edit your OpenClaw config file at ~/.openclaw/openclaw.json:

{
  "agent": {
    "model": "ollama/gemma4:e4b"
  }
}

Make sure Ollama is serving on its default port:

ollama serve

Then restart the OpenClaw gateway to pick up the change:

openclaw gateway stop
openclaw gateway start

Important: When configuring the Ollama endpoint, use http://127.0.0.1:11434 exactly. Do not append /v1 to the URL, as this breaks tool calling.

Connecting a Chat App

OpenClaw works through your existing messaging apps. To link one:

openclaw configure --section channels

This opens an interactive menu where you can connect WhatsApp, Telegram, Slack, Discord, Signal, or iMessage. Follow the on-screen prompts to authenticate.

Once connected, you can message OpenClaw directly from your chat app and it will respond using Gemma 4 running on your machine.

Testing the Setup

Send a test message through your connected chat app, or use the CLI directly:

openclaw chat "What can you help me with?"

You should see Gemma 4 respond through OpenClaw. If you're running the 26B model, expect response times of 1-3 seconds on a modern GPU.

Verifying the Model

To confirm which model is active:

openclaw status

This shows the current model, gateway status, and connected channels.

Tips and Troubleshooting

  • Slow responses: If generation is too slow, try switching to the smaller gemma4:e4b model. On CPU-only machines, the E4B model offers the best speed-to-quality ratio.
  • Gateway won't start: Make sure Ollama is running (ollama serve) before starting the OpenClaw gateway.
  • Tool calling errors: Ensure your Ollama endpoint is set to http://127.0.0.1:11434 without a /v1 suffix.
  • Out of memory: The 26B model needs roughly 16 GB of VRAM. If you're running out of memory, switch to gemma4:e4b which runs comfortably on 8 GB.
  • Web search: To enable web search with local models, sign in to Ollama with ollama signin.

Next Steps

With OpenClaw and Gemma 4 running locally, here are some things to try:

  1. Explore built-in skills: OpenClaw ships with 100+ skills for tasks like file management, web browsing, and code execution. Ask it to list available skills.
  2. Set up persistent memory: OpenClaw remembers context across conversations. Give it background about your preferences and projects to get more relevant responses over time.
  3. Automate workflows: Combine skills to create multi-step automations, like monitoring a GitHub repo and sending Slack updates.
  4. Try image input: Gemma 4 supports vision. Send an image through your chat app and ask OpenClaw to describe or analyze it.
  5. Install community plugins: Browse the OpenClaw plugin registry for integrations with tools like GitHub, Obsidian, and Spotify.

Running everything locally means your conversations, files, and data never leave your machine. Gemma 4's strong reasoning and tool-calling capabilities make it a solid foundation for a private AI assistant.