Skip to content

Conversation

@fhalamzie
Copy link

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.

- Add Gemini provider implementation with Anthropic-to-Gemini request/response conversion
- Add OpenRouter provider implementation supporting multiple LLM models
- Update config structure to support new providers
- Add environment variable support for GEMINI_API_KEY, GEMINI_BASE_URL, OPENROUTER_API_KEY, OPENROUTER_BASE_URL
- Update config.yaml.example with new provider configurations
- Support streaming and regular responses for both providers

This enables routing Claude Code subagents to Gemini models and any OpenRouter-supported model.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant