All use cases
Claude Code + GeminiCoding agents
Gemini models in Claude Code
Claude Code talks to the Messages API, and AnyRouter translates it for any catalog model. Save a Google key, then choose a Gemini model with --model.
Set it up
anyr CLI
curl -fsSL https://anyrouter.dev/cli.sh | bash
anyr claude --model google/gemini-2.5-pro- 1.Create a key in Google AI Studio, then add it under Dashboard → BYOK → Google AI Studio.
- 2.Install the anyr CLI and run anyr claude with a Gemini model. A concrete --model also sets Claude Code's haiku, sonnet, opus and subagent models, so background tasks use Gemini too.
- 3.Prefer plain env vars? Point ANTHROPIC_BASE_URL at https://anyrouter.dev/api and pass the same model to claude.
Why use this
You like Claude Code's loop but want to try Gemini on the same repo, without switching to another tool or editing its config by hand.
How the request flows
Claude CodeMessages API
AnyRoutertranslates
Geminiyour Google key
Other ways to set it up
Env wrapper
export ANTHROPIC_BASE_URL="https://anyrouter.dev/api"
export ANTHROPIC_API_KEY="$ANYROUTER_API_KEY"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="google/gemini-2.5-pro"
claude --model google/gemini-2.5-proEndpoints and key
- OpenAI-compatible
- https://anyrouter.dev/api/v1
- Anthropic-compatible
- https://anyrouter.dev/api
- Key
- ANYROUTER_API_KEY (sk-ar-…)
Watch the walkthrough
Limits
- Gemini routes run on keys you add, so Google's limits and billing apply to your account.
- Claude Code is built around Claude. Gemini models vary in how well they handle tool calls and long edits.
- With plain env vars, set ANTHROPIC_DEFAULT_HAIKU_MODEL too, or Claude Code's small background tasks still call a Claude model.
- Features that exist only on Anthropic's API, such as its prompt cache, do not apply on a Gemini route.