claude-code-proxy icon indicating copy to clipboard operation
claude-code-proxy copied to clipboard

feat: Add Google Gemini and OpenRouter providers

Open fhalamzie opened this issue 4 months ago • 0 comments

This PR adds support for Google Gemini and OpenRouter as additional LLM providers for the claude-code-proxy.

🚀 Changes

New Providers Added

  • Google Gemini - Full integration with Google's Gemini API
  • OpenRouter - Access to 100+ models through a single API

Implementation Details

  • ✅ Added gemini.go provider with Anthropic-to-Gemini request/response conversion
  • ✅ Added openrouter.go provider supporting all OpenRouter models
  • ✅ Updated config structure to support new providers
  • ✅ Added environment variable support:
    • GEMINI_API_KEY, GEMINI_BASE_URL
    • OPENROUTER_API_KEY, OPENROUTER_BASE_URL
  • ✅ Updated config.yaml.example with new provider configurations
  • ✅ Full support for both streaming and regular responses

💡 Benefits

  • Enables routing Claude Code subagents to Gemini models (gemini-1.5-pro, gemini-1.5-flash)
  • Access to all OpenRouter-supported models (GPT-4, Claude, Llama, Mistral, etc.)
  • More flexibility in model selection for different tasks
  • Cost optimization by routing to different providers based on task requirements

📝 Example Configuration

```yaml providers: gemini: api_key: "YOUR_GEMINI_KEY"

openrouter: api_key: "YOUR_OPENROUTER_KEY"

subagents: enable: true mappings: code-reviewer: "gpt-4o" data-analyst: "gemini-1.5-pro" doc-writer: "openrouter/claude-3-haiku" ```

✅ Testing

  • Compiled and tested locally
  • No API keys included in the code
  • All provider implementations follow existing patterns

📚 Documentation

Updated config.yaml.example with comprehensive examples and environment variable documentation.

fhalamzie avatar Aug 11 '25 19:08 fhalamzie