Guide · Other models in Claude Code
How do you run Gemma 4 in Claude Code?
Run ollama launch claude --model gemma4. Ollama starts Claude Code on Gemma 4
through its Anthropic-compatible API, on your own machine or on Ollama's cloud. Through Selan,
an owner connects the company's Ollama Cloud plan or OpenRouter key once. Each developer then
runs selan claude --model ollama:gemma4:31b.
Why does Gemma 4 work in Claude Code at all?
Claude Code sends every request in Anthropic's Messages format. It reaches another server
when ANTHROPIC_BASE_URL is set to that server's address.
Ollama answers in that format, on your own machine and on its cloud. OpenRouter answers in it too.
Claude Code edits files and runs commands through tool calls. Google built Gemma 4 with native function calling, so it can drive those tools.
Google publishes Gemma 4 as open weights under the Apache 2.0 license. Anyone may run it, on their own hardware or on a host's.
How do you run Gemma 4 in Claude Code on your own machine?
Install Ollama and Claude Code, then start Claude Code on Gemma 4:
ollama launch claude --model gemma4
A bare gemma4 is Ollama's default tag, the small E4B model with a 128K window.
For a larger repository, Ollama says to set the context length to 64K or higher.
The model then runs on your own hardware, and Ollama's plans put no limit on local use. How fast it answers depends on that hardware.
For one developer with a capable machine, this is the simpler answer. A gateway adds nothing there.
Which Gemma 4 size should Claude Code use?
Gemma 4 comes in five sizes. Ollama names each one as a tag:
| Ollama tag | What it is | Window |
|---|---|---|
gemma4:e2b, gemma4:e4b | Small models made for laptops and phones | 128K |
gemma4:12b | A medium model | 256K |
gemma4:26b | A mixture-of-experts model with 4B parameters active | 256K |
gemma4:31b | The largest, a dense model | 256K |
gemma4:cloud | Ollama's cloud, with no download | 256K |
The 26B model runs almost as fast as a 4B model, Google says, because only 4B of its parameters work on each token.
The 31B model is a download of about 20GB. Ollama's cloud runs it without one.
How do you use Gemma 4 on Ollama's cloud?
With the Ollama app, name the cloud tag:
ollama launch claude --model gemma4:cloud
Without the app, create an API key on ollama.com. Set ANTHROPIC_BASE_URL to
https://ollama.com and put the key in ANTHROPIC_AUTH_TOKEN. Then
name the model as Ollama's cloud lists it, gemma4:31b.
Your code then leaves your machine for Ollama's servers. The usage counts against your Ollama plan.
On a team, that is one Ollama key and one set of variables per laptop, with no shared view of who used what. Why a key on every laptop is the expensive part is in keeping API keys off laptops.
How does a team run Gemma 4 in Claude Code through Selan?
Gemma 4 is a model Selan lists, at Ollama as gemma4:31b and at OpenRouter as
google/gemma-4-31b-it. An owner connects the account once, then switches Gemma 4
on under Settings → Models.
Developers install the selan CLI, sign in as themselves and name the model:
selan claude --model ollama:gemma4:31b
The part before the first colon is the provider. Everything after it is that provider's own model id, passed through as it is.
With --model, Selan tells Claude Code the model's real context window. Selan
lists Gemma 4 at 262,144 tokens, so a session compacts there and not at 200K. If an owner
set a lower context limit for your company, it compacts at that instead.
To skip the flag, an owner adds Gemma 4 to Claude Code's picker under
Settings → Model pickers. It then
appears in /model beside the Claude models. The details are in
Run any model.
Which account does a Gemma 4 turn run on?
| Route | How it bills | Name it as |
|---|---|---|
| An Ollama Cloud plan | Your Ollama plan's monthly usage, then any credits you bought | ollama:gemma4:31b |
| An OpenRouter key | Per token, on your OpenRouter invoice: $0.20 per million input tokens and $0.40 per million output tokens | openrouter:google/gemma-4-31b-it |
A Gemma 4 turn runs on the provider its name points at, and on no other.
If that account is out of quota, the request fails rather than moving to the other one.
Selan reaches Ollama's cloud at ollama.com, never an Ollama server on a laptop. How Ollama itself runs in Claude Code is in using Ollama with Claude Code. Every provider is on Providers and models.
What does a team get beyond the model?
- One usage record. Gemma 4 turns land beside Claude turns, per person and per repository. Usage per developer shows what an owner sees.
- One spend limit. An OpenRouter turn is metered, so it counts against a member's limit. A turn on an Ollama plan does not. See spend limits.
- No Ollama or OpenRouter key on a laptop. Keys stay on the gateway. A developer holds a Selan session you can revoke.
-
Codex on the same plan.
selan codex --model ollama:gemma4:31buses Ollama's own Responses API. See Codex. -
Cheap agent work. Selan's comment-cleaning agent names
openrouter:google/gemma-4-31b-itas its model, because the work is mechanical. See the minimise-comments agent.
What should you check before switching a team to Gemma 4?
- Local turns are not on the record. A developer running Gemma 4 on a laptop by Ollama's own setup bypasses Selan. Its usage record and spend limits do not see those turns.
- The size is part of the answer. Selan runs the 31B model. A teammate comparing it with E4B on a laptop is comparing two different models.
- The model must be switched on. A model your company cannot use is refused before Claude Code starts, not at the first request.
Free for up to three seats, and the Free plan needs no card.
The short version
- Ollama answers in Anthropic's API format, so
ollama launch claude --model gemma4runs Claude Code on Gemma 4. - Gemma 4 is open weights under Apache 2.0, in five sizes; the small ones have a 128K window and the rest 256K.
- On a laptop, Ollama puts no limit on it; for one developer with the hardware, that is the simpler answer.
- Through Selan, a developer runs
selan claude --model ollama:gemma4:31b, oropenrouter:google/gemma-4-31b-itper token. - Gemma 4 runs on your Ollama plan or OpenRouter key, with one usage record and no key on a laptop.
The sizes, windows, license and function calling are Google's Gemma 4 model card. The tags, the launch command and the context advice are Ollama's Gemma 4 page and its Claude Code and cloud docs. The OpenRouter price and window are its model list. All were read on 10 November 2026, as was Ollama's cloud model list. Anthropic's position is its gateway docs, as read on 3 November 2026. What Selan does is its model list, its CLI and its providers, Codex, agents and getting-started docs as they stood on 10 November 2026.