π Enhanced Gemini CLI with OpenRouter Support - Access 200+ AI Models Through One Interface
β οΈ Important Notice: This is a modified version of Google Gemini CLI. Original project copyright belongs to Google LLC under Apache 2.0 License.
Current Status: This project currently supports a curated selection of high-performance models through OpenRouter integration. We're actively working to expand model compatibility and enhance features.
Community Driven: Your support helps us grow! β Star this repository and consider contributing to help us:
- Add support for more AI models
- Improve performance and reliability
- Develop new features and integrations
- Maintain comprehensive documentation
Get Involved: Have suggestions or want to contribute? Contact us at mythicscribe2014@gmail.com - we'd love to hear from you!
| πΊπΈ English | π»π³ TiαΊΏng Viα»t | π―π΅ ζ₯ζ¬θͺ | π©πͺ Deutsch | πΈπ¦ Ψ§ΩΨΉΨ±Ψ¨ΩΨ© | π¨π³ δΈζ |
- π― OpenRouter Integration: Access 200+ AI models through OpenRouter's unified API
- π Model Flexibility: Switch between GPT-4, Claude, Llama, Mistral, and many more
- π Global Model Coverage: Supports all major AI models from OpenAI, Anthropic, Meta, Google, and more
- π§ Simple Configuration: Single API key for all models
- π Complete Functionality: Streaming/non-streaming, token counting, function calling all supported
- π Enhanced Performance: Optimized for OpenRouter's high-performance infrastructure
npm install -g @chameleon-nexus-tech/gemini-cli-openrouter# Using npm (Node.js package manager)
npm install -g @chameleon-nexus-tech/gemini-cli-openrouter
# Using yarn
yarn global add @chameleon-nexus-tech/gemini-cli-openrouter
# Using pnpm
pnpm add -g @chameleon-nexus-tech/gemini-cli-openrouterOpenRouter provides access to the world's most advanced AI models through a single, unified API. This enhanced Gemini CLI leverages OpenRouter to give you instant access to:
π₯ Popular Models Available:
anthropic/claude-3.5-sonnet(default) - Anthropic's most capable modelopenai/gpt-4- OpenAI's flagship modelopenai/gpt-4-turbo- Faster GPT-4 variantmeta-llama/llama-3.1-8b-instruct- Meta's latest Llama modelmeta-llama/llama-3.1-70b-instruct- Meta's most powerful Llamamistralai/mistral-7b-instruct- Mistral's efficient modelmistralai/mixtral-8x7b-instruct- Mixtral's mixture of expertsgoogle/gemini-pro- Google's Gemini modelgoogle/gemini-pro-vision- Google's multimodal modelcohere/command-r-plus- Cohere's advanced modeldeepseek/deepseek-coder- Specialized coding model- And 190+ more models from leading AI companies!
π― Why OpenRouter?
- Single API Key: Access all models with one credential
- Best Pricing: Competitive rates across all providers
- High Availability: 99.9% uptime with global infrastructure
- Model Comparison: Easy switching between models for testing
- Enterprise Features: Rate limiting, usage analytics, and more
You only need to set these 4 environment variables to get started:
# 1. Set AI engine to OpenRouter
export AI_ENGINE="openrouter"
# 2. Set your OpenRouter API key (get from https://openrouter.ai/keys)
export AI_API_KEY="your-openrouter-api-key"
# 3. Choose your preferred model
export AI_MODEL="openai/gpt-4o"
# 4. Set any value to skip Gemini API validation
export GEMINI_API_KEY="any-value-here"# Set the 4 required environment variables
$env:AI_ENGINE="openrouter"
$env:AI_API_KEY="your-openrouter-api-key"
$env:AI_MODEL="openai/gpt-4o"
$env:GEMINI_API_KEY="any-value-here"That's it! These 4 variables are all you need:
AI_ENGINE="openrouter"- Tells the system to use OpenRouterAI_API_KEY="your-key"- Your OpenRouter API keyAI_MODEL="model-name"- The AI model you want to useGEMINI_API_KEY="anything"- Set to any value to skip validation
gemini "Hello, please introduce yourself"geminiThen select "2. Use Gemini API Key" and press Enter to start chatting.
# Set the 4 required environment variables
export AI_ENGINE="openrouter"
export AI_API_KEY="your-openrouter-api-key"
export AI_MODEL="openai/gpt-4o"
export GEMINI_API_KEY="any-value-here"
# Test command
gemini "Hello, please introduce yourself and tell me which AI model you are."This project features a specialized OpenRouter integration that provides seamless access to 200+ AI models:
OpenRouter Integration
βββ OpenrouterContentGenerator (Primary OpenRouter adapter)
βββ ContentGeneratorFactory (Engine selection and management)
βββ Tool Execution System (Function calling support)
βββ Streaming Response Handler (Real-time response processing)
β
OpenRouter Integration: Direct access to 200+ AI models through OpenRouter's unified API
β
Model Flexibility: Easy switching between different AI models with a single environment variable
β
Automatic Format Conversion: Seamless conversion between Gemini format and OpenRouter API format
β
Streaming Response Support: Real-time streaming responses for all supported models
β
Function Calling: Full support for tool/function calling across all models
β
Intelligent Error Handling: Comprehensive error handling with detailed messages
β
Configuration Priority: OpenRouter-specific config > Unified config > Default config
packages/core/src/core/
βββ contentGenerator.ts # ContentGenerator interface definition
βββ contentGeneratorFactory.ts # Engine factory with OpenRouter priority
βββ openrouterContentGenerator.ts # OpenRouter adapter (primary)
βββ coreToolScheduler.ts # Tool execution and function calling
βββ [other adapters] # Additional engine support
Request Conversion Flow:
Gemini Request β OpenRouter Adapter β OpenRouter API β 200+ AI Models
Response Conversion Flow:
AI Model Response β OpenRouter API β OpenRouter Adapter β Gemini Response Format
Supported OpenRouter Features:
- Model Selection: Easy switching between 200+ models
- Function Calling: Full tool/function calling support
- Streaming: Real-time response streaming
- Token Counting: Automatic token usage tracking
- Error Handling: Comprehensive error management
- Rate Limiting: Built-in rate limiting and retry logic
This project is based on Google Gemini CLI and follows Apache 2.0 License requirements:
- Original Project: Google Gemini CLI
- Original Copyright: Copyright 2025 Google LLC
- Original License: Apache License 2.0
- Original Repository: https://github.com/google-gemini/gemini-cli
In accordance with Apache 2.0 License Section 4:
- β Retained original Apache 2.0 license
- β Retained original copyright notices
- β Clearly marked modifications
- β Included complete license text
If you're migrating from the original Google Gemini CLI:
- Uninstall original version:
npm uninstall -g @google/gemini-cli - Install this version:
npm install -g @chameleon-nexus-tech/gemini-cli - Get OpenRouter API key: Sign up at OpenRouter
- Set the 4 required environment variables:
export AI_ENGINE="openrouter" export AI_API_KEY="your-openrouter-api-key" export AI_MODEL="openai/gpt-4o" export GEMINI_API_KEY="any-value-here"
- Use as before: All commands remain the same, now with access to 200+ models!
Create a simple test script to verify your OpenRouter setup:
#!/bin/bash
# test-openrouter.sh
# Set the 4 required environment variables
export AI_ENGINE="openrouter"
export AI_API_KEY="your-openrouter-api-key"
export AI_MODEL="openai/gpt-4o"
export GEMINI_API_KEY="any-value-here"
echo "Testing OpenRouter with GPT-4o..."
gemini "Hello, please introduce yourself and tell me which AI model you are."Test different models to compare their responses:
#!/bin/bash
# compare-models.sh
# Set up the base configuration (set once)
export AI_ENGINE="openrouter"
export AI_API_KEY="your-openrouter-api-key"
export GEMINI_API_KEY="any-value-here"
# Test GPT-4o
echo "=== Testing GPT-4o ==="
export AI_MODEL="openai/gpt-4o"
gemini "Write a haiku about artificial intelligence."- Original Project (Google Gemini CLI)
- OpenRouter - Access 200+ AI models
- OpenRouter API Documentation
- OpenRouter Model List
- Apache 2.0 License
If you encounter any issues, please report them on GitHub Issues.
Contributions are welcome! Please ensure:
- Follow the original project's code style
- Include appropriate tests
- Update relevant documentation
- Respect the Apache 2.0 license terms
- π OpenRouter Integration: Direct access to 200+ AI models through one API
- π― Model Flexibility: Easy switching between GPT-4, Claude, Llama, and more
- π Simple Configuration: Single API key for all models
- π Global Coverage: Access to models from OpenAI, Anthropic, Meta, Google, and more
- π Enterprise Grade: Complete error handling and configuration management
- π§ Function Calling: Full support for tool/function calling across all models
Disclaimer: This project is not affiliated with Google or OpenRouter. Please comply with the terms of service of the respective platforms when using this software.