shell-sage
v2.3.6
Published
  
Downloads
52
Readme
shell-sage
A minimalistic terminal chatbot for interacting with Google's Gemini 2.0 Flash API. This CLI tool allows you to query the Gemini API using your API key, which is stored persistently on your system.
Features
- Interactive Chat: Ask your questions and receive responses directly in your terminal.
- Persistent API Key Storage: Your Gemini API key is saved in a hidden file in your home directory (
.gemini_api_key), so you don’t need to re-enter it every time. - Modern UI: Enjoy a colorful, gradient ASCII banner and helpful prompts using figlet and chalk.
- Real-time API Calls: Interact with the Gemini 2.0 Flash API using axios.
- Command Line Flags: Includes helpful commands like
--help,--version,--model,--remove-api, and--update. - Automatic Updates: Easily update to the latest version with
shell-sage --update.
Installation
Install via npm:
npm install -g shell-sageThis will install shell-sage globally, allowing you to run it from anywhere in your terminal.
Or Clone the repository manually:
git clone https://github.com/yourusername/shell-sage.git
cd shell-sage
npm installUsage
Run the CLI with:
shell-sageOn the first run, you'll be prompted to enter your Gemini API key. The key will be saved persistently in a hidden file in your home directory. Once stored, the CLI will load the key automatically on subsequent runs.
Available Commands:
shell-sage --help # Show available commands
shell-sage --version # Show current version
shell-sage --model # Show the current model (default: gemini-2.0-flash)
shell-sage --remove-api # Remove the stored API key
shell-sage --update # Update shell-sage to the latest versionInteractive Chat Mode:
Simply run shell-sage and type your queries when prompted. To exit, type exit.
API Integration
This CLI interacts with the Gemini API using the following endpoint:
https://generativelanguage.googleapis.com/v1/models/gemini-2.0-flash:generateContent?key=YOUR_API_KEYThe API expects a JSON payload structured like this:
{
"contents": [
{
"parts": [
{ "text": "Your query goes here" }
]
}
]
}The API key is dynamically inserted into the URL at runtime.
Acknowledgements
This project is built using:
License
This project is licensed under the MIT License.
