Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CypherpunkSamurai/f6db701dd48463f89b8c5fa89982c175 to your computer and use it in GitHub Desktop.
Save CypherpunkSamurai/f6db701dd48463f89b8c5fa89982c175 to your computer and use it in GitHub Desktop.
Using Claude Code with Gemini 2.5 Pro using Claude Code Router (ccr)

Using Claude Code with Gemini 2.5 Pro using Claude Code Router (ccr)

Install Claude Code

pnpm install -g @anthropic-ai/claude-code
pnpm install -g @musistudio/claude-code-router

Edit ~/.claude-code-router/config.json

nvim '~/.claude-code-router/config.json'

I'll use the api endpoint mentioned here

{
  "OPENAI_API_KEY": "$OPENAI_API_KEY",
  "GEMINI_API_KEY": "${GEMINI_API_KEY}",
  "Providers": [
    {
      "name": "openai",
      "api_base_url": "https://ai.google.dev/gemini-api/docs/openai",
      "api_key": "$OPENAI_API_KEY",
      "models": ["gpt-5", "gpt-5-mini"]
    }
  ]
}

The ${GEMINI_API_KEY} or $OPENAI_API_KEY allows to load api keys from env. Or you could hard code it.

or instead use

{
  "name": "openrouter",
  "api_base_url": "https://openrouter.ai/api/v1/chat/completions",
  "api_key": "sk-xxx",
  "models": [
    "google/gemini-2.5-pro-preview",
    "anthropic/claude-sonnet-4",
    "anthropic/claude-3.5-sonnet"
  ],
  "transformer": { "use": ["openrouter"] }
}

Running Claude Code

Run claude code

ccr code

or use the ui

ccr ui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment