@wuhrai/gemini-cli
v1.0.1
Published
Enhanced Gemini CLI with multi-provider support and advanced features
Downloads
5
Maintainers
Readme
@hyflog/gemini-cli
Enhanced Gemini CLI with multi-provider support, tool calling, and advanced automation features.
🚀 Installation
# Install globally
npm install -g @hyflog/gemini-cli
# Or use with npx (no installation required)
npx @hyflog/gemini-cli --help✨ Features
- Multi-Provider Support: OpenAI, DeepSeek, Gemini, and custom endpoints
- Tool Calling: Automatic command execution with
--yoloflag - File Integration: Include files with
@filenamesyntax - Shell Commands: Execute commands with
!commandsyntax - Slash Commands: Built-in commands like
/help,/tools,/stats - Streaming Responses: Real-time output for better UX
- Custom Base URLs: Support for proxy services and self-hosted models
🔧 Quick Start
1. Basic Usage
# Simple text conversation
echo "Hello, introduce yourself" | gemini --provider openai-compatible --model-name gpt-4o
# With API configuration
OPENAI_API_KEY=your-key \
OPENAI_BASE_URL=https://api.openai.com/v1 \
echo "Hello" | gemini --provider openai-compatible --model-name gpt-4o2. Tool Calling (Automation)
# Manual confirmation (safe mode)
echo "Create a test folder on desktop" | gemini --provider deepseek --model-name deepseek-chat
# Automatic execution (--yolo flag)
echo "Create a test folder on desktop" | gemini --provider deepseek --model-name deepseek-chat --yolo3. File Integration
# Include file content in conversation
echo "@package.json Analyze this project" | gemini --provider openai-compatible --model-name gpt-4o4. Shell Commands
# Execute shell commands
echo "!ls -la" | gemini --provider openai-compatible --model-name gpt-4o🌐 Supported Providers
OpenAI Compatible
# OpenAI Official
OPENAI_API_KEY=sk-your-key \
OPENAI_BASE_URL=https://api.openai.com/v1 \
gemini --provider openai-compatible --model-name gpt-4o
# Third-party proxy
OPENAI_API_KEY=sk-proxy-key \
OPENAI_BASE_URL=https://your-proxy.com/v1 \
gemini --provider openai-compatible --model-name gpt-4oDeepSeek
DEEPSEEK_API_KEY=sk-your-deepseek-key \
gemini --provider deepseek --model-name deepseek-chatSelf-hosted Models
# Local Ollama
OPENAI_BASE_URL=http://localhost:11434/v1 \
gemini --provider openai-compatible --model-name llama3.2
# Custom server
OPENAI_BASE_URL=http://your-server:port/v1 \
gemini --provider openai-compatible --model-name "your-model"📖 Command Reference
Core Options
--provider- Model provider (openai-compatible, deepseek, gemini)--model-name- Model name (gpt-4o, deepseek-chat, etc.)--api-key- API key (or use environment variables)--base-url- API base URL for OpenAI-compatible services--yolo- Enable automatic tool execution--telemetry false- Disable telemetry
Built-in Commands
/help- Show help information/tools- List available tools/stats- Show session statistics/clear- Clear conversation history@filename- Include file content!command- Execute shell command
🔑 Environment Variables
# OpenAI Compatible
export OPENAI_API_KEY=your-api-key
export OPENAI_BASE_URL=https://api.openai.com/v1
# DeepSeek
export DEEPSEEK_API_KEY=your-deepseek-key
# Gemini (Google)
export GOOGLE_API_KEY=your-google-key📚 Examples
Development Workflow
# Project analysis
echo "@package.json @README.md Analyze this project structure" | \
gemini --provider openai-compatible --model-name gpt-4o --yolo
# Code review
echo "!git diff HEAD~1" | \
gemini --provider deepseek --model-name deepseek-coder
# Automated tasks
echo "Create a new React component called UserProfile" | \
gemini --provider openai-compatible --model-name gpt-4o --yoloSystem Administration
# System monitoring
echo "Check system performance and suggest optimizations" | \
gemini --provider deepseek --model-name deepseek-chat --yolo
# Log analysis
echo "@/var/log/nginx/error.log Analyze these errors" | \
gemini --provider openai-compatible --model-name gpt-4o🛠️ Advanced Configuration
Custom Script
Create a helper script for easier usage:
#!/bin/bash
# gemini-helper.sh
case $1 in
"openai")
echo "$2" | OPENAI_API_KEY=$OPENAI_API_KEY \
OPENAI_BASE_URL=https://api.openai.com/v1 \
gemini --provider openai-compatible --model-name gpt-4o --telemetry false
;;
"deepseek")
echo "$2" | DEEPSEEK_API_KEY=$DEEPSEEK_API_KEY \
gemini --provider deepseek --model-name deepseek-chat --telemetry false
;;
*)
echo "Usage: $0 {openai|deepseek} 'your question'"
;;
esac🐛 Troubleshooting
Common Issues
Permission Denied
chmod +x $(which gemini)API Key Errors
# Check environment variables echo $OPENAI_API_KEY echo $OPENAI_BASE_URLNetwork Issues
# Test API connectivity curl -H "Authorization: Bearer $OPENAI_API_KEY" $OPENAI_BASE_URL/models
📄 License
MIT License - see LICENSE file for details.
🤝 Contributing
Issues and pull requests are welcome at: https://github.com/hyflog/gemini-cli
📞 Support
- 📖 Documentation: Provider Usage Guide
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
