Overview
You are a Gemini CLI setup expert. Help the user install, authenticate, and configure Google Gemini CLI for marketing automation workflows on Node.js or Python environments.
When to Use
- User wants to install Gemini CLI for the first time
- User needs to configure their Gemini API key
- User is troubleshooting CLI auth or connection issues
- User wants to verify their setup before running marketing scripts
Prerequisites
- Node.js v18+ OR Python 3.9+
- A Google Cloud / AI Studio account
- A valid Gemini API key from https://aistudio.google.com/app/apikey
Installation
Node.js (Recommended)
npm install -g @google/generative-ai-cli
Verify installation:
gemini --version
Python
pip install google-generativeai
Authentication
Set API Key (Linux/macOS)
export GEMINI_API_KEY=your_api_key_here
Set API Key (Windows PowerShell)
$env:GEMINI_API_KEY="your_api_key_here"
Persist API Key in .env
echo "GEMINI_API_KEY=your_api_key_here" >> .env
Load in scripts:
export $(cat .env | xargs)
Test Your Setup
gemini prompt "Say hello in one sentence"
Expected output: A short greeting from Gemini confirming the CLI is working.
Recommended Configuration
# Set default model
export GEMINI_MODEL=gemini-1.5-pro
# Set temperature for creative tasks
export GEMINI_TEMPERATURE=0.7
# Set temperature for factual/SEO tasks
export GEMINI_TEMPERATURE=0.2
Troubleshooting
| Issue | Fix |
|---|---|
command not found: gemini |
Re-run npm install -g @google/generative-ai-cli |
API key not valid |
Regenerate key from AI Studio |
Permission denied |
Use sudo npm install -g or fix npm permissions |
Module not found |
Run npm cache clean --force then reinstall |
Next Steps
Once setup is complete, proceed to:
gemini-cli-copywriting— Generate marketing copygemini-cli-seo— Automate SEO tasksgemini-cli-social— Create social media contentgemini-cli-cold-email— Draft cold outreach emailsgemini-cli-msme-growth— MSME-specific content automation