---
title: "Gemini in Claude Code — on your own Google Cloud · Selan"
description: "Claude Code speaks Anthropic's API, so Gemini needs a gateway that translates. Run Gemini 3.8 Flash on your own Vertex project or OpenRouter."
url: https://selan.ai/guides/gemini-in-claude-code
updated: 2026-11-13T09:56:03+02:00
---

Guide · Other models in Claude Code

# How do you run Gemini in Claude Code?

Point Claude Code at a gateway that translates Anthropic's API into Gemini's, then name a Gemini model. Claude Code cannot call Gemini by itself. Through Selan, an owner connects the company's own Google Vertex project or an OpenRouter key once. Each developer then runs `selan claude --model vertex:gemini-3.8-flash`.

## Why can't Claude Code call Gemini by itself?

Claude Code sends requests in three formats: Anthropic's Messages API, Amazon Bedrock's and Google Cloud's. All three are formats for Claude models.

Claude Code's own Google Cloud setting is for Claude too. Its setup enables Claude models in Model Garden and pins Claude model ids.

Google serves Gemini over its own API and an OpenAI-compatible one. Neither is Anthropic's, so something in the middle has to rewrite each request and each streamed reply.

That something is a gateway. Claude Code reaches one when `ANTHROPIC_BASE_URL` is set to its address.

## How do you run Gemini in Claude Code by hand?

Run a translating proxy on your own machine, such as [LiteLLM](https://selan.ai/compare/litellm) or [claude-code-router](https://selan.ai/compare/claude-code-router). LiteLLM's own tutorial maps a Gemini API key to a model name:

```yaml
model_list:
  - model_name: gemini-3.8-flash
    litellm_params:
      model: gemini/gemini-3.8-flash
      api_key: os.environ/GEMINI_API_KEY
```

Start the proxy, point Claude Code at it and name the model:

```bash
litellm --config config.yaml
export ANTHROPIC_BASE_URL="http://0.0.0.0:4000"
export ANTHROPIC_AUTH_TOKEN="$LITELLM_MASTER_KEY"
claude --model gemini-3.8-flash
```

OpenRouter needs no proxy. Set `ANTHROPIC_BASE_URL` to `https://openrouter.ai/api`, put your OpenRouter key in `ANTHROPIC_AUTH_TOKEN` and leave `ANTHROPIC_API_KEY` empty. OpenRouter says Claude Code through it is only guaranteed on Anthropic's own models.

Either way works for one person. Three things then fall to you:

-   **The context window.** Claude Code applies its own default window to a model name it does not recognise. LiteLLM says to set `CLAUDE_CODE_AUTO_COMPACT_WINDOW` yourself.
-   **The picker.** A gateway's model list reaches `/model` only for ids containing `claude` or `anthropic`. A Gemini model never appears there by itself.
-   **The thought signatures.** Gemini's tool calls carry one, and a proxy that drops it breaks the session. The next section explains it.

On a team, that is one proxy and one Google key per laptop, and no shared view of what Gemini costs. Why a key on every laptop is the expensive part is in [keeping API keys off laptops](https://selan.ai/guides/claude-code-without-api-keys).

## Why does Gemini say a function call is missing a thought\_signature?

Gemini 3 and Gemini 4 models return a thought signature with their tool calls. Google requires it back, in the exact part it came in, when the conversation is sent again.

If the first function call of a step comes back without it, Gemini refuses the request with a 400. Google's docs give the message in this form:

```text
Function call FC1 in the 1. content block is missing a thought_signature.
```

Claude Code edits files and runs commands through tool calls, so a Gemini session sends them back on every turn. Whatever translates has to carry each signature between turns, and nothing obliges Claude Code to return one.

On the Vertex route, Selan's gateway does the translating and keeps each call's signature itself, by the tool call's id. That session does not depend on Claude Code returning it. On the OpenRouter route, OpenRouter does the translating.

## How does a team run Gemini in Claude Code through Selan?

Gemini 3.8 Flash is a model Selan lists, on Google Vertex as `gemini-3.8-flash` and at OpenRouter as `google/gemini-3.8-flash`. An owner connects the account once, then switches Gemini 3.8 Flash on under [Settings → Models](https://control.selan.ai/settings/models).

Developers install the `selan` CLI, sign in as themselves and name the model:

```bash
selan claude --model vertex:gemini-3.8-flash
```

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 Gemini 3.8 Flash at 1,000,000 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 Gemini 3.8 Flash to Claude Code's picker under [Settings → Model pickers](https://control.selan.ai/settings/pickers). It then appears in `/model` beside the Claude models. The details are in [Run any model](https://selan.ai/docs#any-model).

## Which account does a Gemini turn run on?

| Route | How it bills | Name it as |
| --- | --- | --- |
| Your Google Vertex project | Per token, on your own Google invoice: $0.75 per million input tokens and $3.75 per million output tokens, Google's launch price through 31 December 2026 | `vertex:gemini-3.8-flash` |
| An OpenRouter key | Per token, on your OpenRouter invoice: $0.825 per million input tokens and $4.125 per million output tokens | `openrouter:google/gemini-3.8-flash` |

A Gemini 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 holds no key to your Google account. You grant your workspace's own Google service account one role on a project you own, and Selan mints a short-lived token for each request. The steps are in [Google Vertex](https://selan.ai/docs/vertex).

Through that connection, Gemini is served from Google's EU tier, which answers in seconds where Global can queue it for minutes. What else stays in the EU is in [EU data residency](https://selan.ai/guides/claude-code-eu-data-residency).

Selan lists only Gemini 3.8 Flash. Any other Gemini model OpenRouter serves can be named the same way, as `openrouter:google/gemini-4-argon`. Every provider is on [Providers and models](https://selan.ai/docs/providers).

## What does a team get beyond the model?

-   **One usage record.** Gemini turns land beside Claude turns, per person and per repository. [Usage per developer](https://selan.ai/guides/claude-code-usage-per-developer) shows what an owner sees.
-   **One spend limit.** Both routes bill per token, so a Gemini turn counts against a member's limit. See [spend limits](https://selan.ai/solutions/spend).
-   **No Google key on a laptop.** On Vertex there is no key at all, only the grant on your project. A developer holds a Selan session you can revoke.
-   **Codex on the same project.** `selan codex --model vertex:gemini-3.8-flash` reaches Gemini through Vertex, translated the same way. See [Codex](https://selan.ai/docs/codex#eligible).

## What should you check before switching a team to Gemini?

-   **The launch price ends.** From 1 January 2027, Google's price for Gemini 3.8 Flash on Vertex doubles, to $1.50 per million input tokens and $7.50 per million output tokens.
-   **The project must serve Gemini.** Adding a Vertex project tries Gemini on the EU tier, so a project that cannot use it is refused when you add it, not on the first Gemini request.
-   **The model must be switched on.** A model your company cannot use is refused before Claude Code starts, not at the first request.

**Good to know:** Anthropic doesn't support routing Claude Code to non-Claude models through any gateway, Selan included. A Gemini session is the gateway's to answer for, not Anthropic's.

[Start for free](https://auth.selan.ai/r)

Free for up to three seats, and the Free plan needs no card.

### The short version

-   Claude Code speaks Anthropic's API, so Gemini needs a gateway that translates.
-   By hand, that is LiteLLM or claude-code-router with a Gemini key, or OpenRouter, which guarantees only Anthropic's models.
-   Gemini 3 and 4 refuse a replayed tool call without its thought signature; on Vertex, Selan's gateway keeps each one.
-   Through Selan, a developer runs `selan claude --model vertex:gemini-3.8-flash`, or `openrouter:google/gemini-3.8-flash`.
-   On Vertex, Gemini runs on your own Google project and invoice, with one usage record and no key on a laptop.

What Claude Code sends to a gateway is as Anthropic's Claude Code docs described it on 15 October 2026, and its Google Cloud setup as its Agent Platform page read on 13 November 2026. The LiteLLM setup and its caveats are LiteLLM's Claude Code tutorial, OpenRouter's setup and guarantee its Claude Code integration page, and the thought-signature rule and error Google's thought signatures doc, all read on 13 November 2026, as was OpenRouter's model list. The Vertex prices are Google's Vertex AI pricing as Selan's model list records it. What Selan does is its model list, its gateway and its providers, Vertex, Codex and getting-started docs as they stood on 13 November 2026.
