Add OpenRouter integration and custom CLI name feature#1
Open
t1m3c wants to merge 1 commit into
Open
Conversation
- Add OpenRouterContentGenerator class with full API compatibility - Support automatic detection and fallback to OpenRouter when API key is available - Add CLI arguments --openrouter-api-key and --openrouter-base-url - Implement proper type conversions between Gemini and OpenAI formats - Support text generation, streaming, function calling, and system instructions - Add comprehensive documentation and usage examples - Maintain full backward compatibility with existing Google API authentication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds two major features to enhance the Gemini CLI experience:
🔗 OpenRouter Integration
Adds support for using OpenRouter's unified API as an alternative to Google's Gemini API, providing access to multiple AI models through a single interface.
🎨 Custom CLI Name Feature
Allows users to personalize their CLI experience by using custom names instead of "Gemini" in the interface.
Features Added
OpenRouter Integration
Usage:
Custom CLI Name Feature
Usage:
Technical Implementation
OpenRouter Integration
OpenRouterContentGeneratorclass implementing the same interface as Gemini's APICustom CLI Name Feature
customCliNamesetting to configuration system--cli-nameCLI argumentFiles Changed
Core Changes
packages/core/src/core/openRouterContentGenerator.ts- New OpenRouter API integrationpackages/core/src/core/contentGenerator.ts- Provider detection logicpackages/cli/src/config/settings.ts- Added customCliName settingpackages/cli/src/config/config.ts- Added CLI argument handlingUI Updates
packages/cli/src/ui/components/Header.tsx- Custom ASCII art supportpackages/cli/src/ui/components/messages/UserMessage.tsx- Custom prompt symbolpackages/cli/src/ui/components/InputPrompt.tsx- Custom prompt in inputpackages/cli/src/ui/components/HistoryItemDisplay.tsx- Pass settings to componentspackages/cli/src/ui/App.tsx- Coordinate settings across componentspackages/cli/src/ui/utils/cliName.ts- New utility functionsDocumentation
docs/openrouter.md- Comprehensive OpenRouter setup guidedocs/custom-cli-name.md- Custom CLI name feature documentationREADME.md- Updated with both featuresOPENROUTER_INTEGRATION_SUMMARY.md- Technical implementation detailsTesting
Backward Compatibility
Both features are fully backward compatible:
Benefits
For Users
For Developers
Future Enhancements
This PR significantly enhances the Gemini CLI by providing both functional improvements (OpenRouter integration) and user experience enhancements (custom CLI names), making the tool more flexible and personalized for users.
@t1m3c can click here to continue refining the PR