A powerful command-line interface for Google's Gemini AI API, built with Go. This CLI tool enables seamless interaction with Gemini AI for chat conversations and content generation directly from your terminal.
- 💬 Interactive chat conversations with Gemini AI
- 📝 Generate explanations and content from text inputs
- 🔑 Simple API key configuration and management
- 💾 Save responses to files
- 📤 JSON output format support
- 🔒 Secure API key handling
- Go 1.21 or higher
- Google Cloud account with Gemini API access
- Gemini API key
Set up your Gemini API key:
gemini-cli config -k YOUR_API_KEYChat with Gemini:
gemini-cli chat -p "What is artificial intelligence?"Generate content with JSON output:
gemini-cli chat -p "Explain quantum computing" -o jsonConfigure your Gemini API key:
gemini-cli config -k YOUR_API_KEYStart a chat conversation:
gemini-cli chat -p "Your prompt" [-s output.txt] [-o json]Options:
-p, --prompt: Input prompt text-s, --save: Save response to file-o, --output: Output format (text/json)
Generate explanations from file input:
gemini-cli explain -f input.txt [-s output.txt] [-o json]Options:
-f, --file: Input file path-s, --save: Save response to file-o, --output: Output format (text/json)
gemini-cli/
├── cmd/ # Command implementations
├── pkg/ # Core packages
│ ├── chat.go # Chat functionality
│ ├── client.go # Gemini API client
│ ├── config.go # Configuration management
│ ├── explain.go # Explanation generation
│ └── models.go # Data models
├── go.mod
├── go.sum
├── main.go # Entry point
└── README.md
-
Clone the repository:
git clone https://github.com/Pradipbabar/gemini-cli.git cd gemini-cli -
Install dependencies:
go mod tidy
-
Build the project:
go build -o gemini-cli
-
Run tests:
go test ./...
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
GEMINI_API_KEY: Your Gemini API key (set automatically by the config command)
- API keys are stored securely in the user's environment
- HTTPS is used for all API communications
- Input validation is performed on all commands
This project is licensed under the MIT License - see the LICENSE file for details.
- Google's Gemini AI team for providing the API
- The Go community for excellent tools and libraries
- Contributors to this project
This is not an official Google product. This CLI tool is maintained independently and is subject to the Gemini API's terms of service and usage limits.
For support, please:
- Check the issues page
- Create a new issue if your problem isn't already listed
- Provide as much context as possible when reporting issues
Made with ❤️ by Pradip Babar