How to Install OpenClaw with Google Gemini 1.5 Flash
Prerequisites
Before you begin, make sure you have:
- Node.js 18+ installed on your system
- A Google AI Studio API key (we’ll show you how to get one)
- Terminal/Command Prompt access
- At least 1GB of free disk space
Step 1: Check Node.js Installation
First, verify that Node.js is installed and check your version:
node --version
You should see something like v22.12.0 or higher. If you don’t have Node.js installed:
- Windows/Mac: Download from nodejs.org
- Linux: Use your package manager (apt, yum, etc.)
Step 2: Install OpenClaw
Install OpenClaw globally using npm:
npm install -g openclaw
This will download and install OpenClaw along with all its dependencies. The installation may take 1-2 minutes.
Verify Installation
Check that OpenClaw was installed successfully:
openclaw --version
You should see the version number, for example: 2026.2.22-2
Step 3: Get Your Google Gemini API Key
To use Google Gemini 1.5 Flash, you need an API key:
- Visit: https://aistudio.google.com/app/apikey
- Sign in with your Google account
- Click: “Create API Key”
- Select: Your Google Cloud project (or create a new one)
- Copy the API key that appears
Important: Keep your API key secure! Don’t share it publicly or commit it to git.
Step 4: Initialize OpenClaw
Run the initialization wizard:
openclaw init
Follow the prompts:
- Name: Enter your name
- Default model: Choose “Google” from the list
- API key: Paste your Gemini API key when prompted
- Other settings: Accept defaults or customize as needed
Step 5: Configure Gemini 1.5 Flash
After initialization, configure your model settings:
Option A: Using the CLI
openclaw config set agents.defaults.model.primary "google/gemini-1.5-flash"
Option B: Edit Configuration File
Open the configuration file in your editor:
# Windowsnotepad %USERPROFILE%\.openclaw\openclaw.json# Mac/Linuxnano ~/.openclaw/openclaw.json
Find the agents.defaults.model section and update it:
{"agents": {"defaults": {"model": {"primary": "google/gemini-1.5-flash"},"models": {"google/gemini-1.5-flash": {"alias": "gemini-flash","key": "env:GOOGLE_API_KEY"}}}}}
Step 6: Set Up Your API Key (Environment Variable)
For better security, store your API key as an environment variable:
Windows (PowerShell)
# Temporary (current session only)$env:GOOGLE_API_KEY = "your-api-key-here"# Permanent (add to profile)[System.Environment]::SetEnvironmentVariable("GOOGLE_API_KEY", "your-api-key-here", "User")
Windows (Command Prompt)
setx GOOGLE_API_KEY "your-api-key-here"
Mac/Linux (Bash)
# Add to ~/.bashrc or ~/.zshrcecho 'export GOOGLE_API_KEY="your-api-key-here"' >> ~/.bashrcsource ~/.bashrc
Step 7: Start the OpenClaw Gateway
Start the OpenClaw gateway service:
openclaw gateway start
You should see output like:
✓ OpenClaw gateway started✓ Agent: main (google/gemini-1.5-flash)✓ Listening on: http://localhost:7777
Step 8: Test Your Installation
Test that Gemini 1.5 Flash is working:
openclaw chat "Hello! Please confirm you're using Gemini 1.5 Flash."
You should get a response from Gemini confirming it’s working!
Step 9: Create Your Workspace
OpenClaw uses a workspace directory for your files and configurations. It’s created automatically at:
- Windows:
C:\Users\YourName\.openclaw\workspace - Mac/Linux:
~/.openclaw/workspace
Navigate to your workspace:
# Windowscd %USERPROFILE%\.openclaw\workspace# Mac/Linuxcd ~/.openclaw/workspace
Step 10: Customize Your Agent
OpenClaw comes with several workspace files you can customize:
SOUL.md – Your Agent’s Personality
Edit to define how your agent behaves:
# Windowsnotepad %USERPROFILE%\.openclaw\workspace\SOUL.md# Mac/Linuxnano ~/.openclaw/workspace/SOUL.md
USER.md – Information About You
Tell your agent about yourself:
# USER.md - About Your Human- **Name:** Your Name- **What to call them:** Your preferred name- **Notes:** Any relevant information
Common Commands
Here are the most useful OpenClaw commands:
Gateway Management
# Start the gatewayopenclaw gateway start# Stop the gatewayopenclaw gateway stop# Restart the gatewayopenclaw gateway restart# Check gateway statusopenclaw gateway status
Chat & Interaction
# Start interactive chatopenclaw chat# Send a single messageopenclaw chat "Your question here"# Use a different model for one messageopenclaw chat --model google/gemini-1.5-pro "Your question"
Configuration
# View configurationopenclaw config get# Set a configuration valueopenclaw config set key.path "value"# Edit config file directlyopenclaw config edit
Skills Management
# List available skillsopenclaw skills list# View skill detailsopenclaw skills info skill-name# Refresh skillsopenclaw skills refresh
Troubleshooting
Issue: “API key not valid”
Solution:
- Verify your API key is correct
- Check that the environment variable is set:
echo $GOOGLE_API_KEY(Mac/Linux) orecho %GOOGLE_API_KEY%(Windows) - Make sure you’ve enabled the Generative Language API in Google Cloud Console
- Generate a new API key if needed
Issue: “Gateway failed to start”
Solution:
- Check if the port is already in use:
openclaw gateway status - Stop any existing gateway:
openclaw gateway stop - Check the logs:
openclaw gateway logs - Try restarting:
openclaw gateway restart
Issue: “Command not found: openclaw”
Solution:
- Verify global npm install:
npm list -g openclaw - Check your PATH includes npm global bin
- Try reinstalling:
npm install -g openclaw - On Windows, restart your terminal after installation
Issue: Slow responses from Gemini
Solution:
- Check your internet connection
- Google API may have rate limits – wait a moment
- Try switching to Gemini Pro if Flash is slow:
openclaw config set agents.defaults.model.primary "google/gemini-1.5-pro"
Advanced Configuration
Using Multiple Models
Configure OpenClaw to use multiple AI models:
{"agents": {"defaults": {"model": {"primary": "google/gemini-1.5-flash","fallbacks": ["google/gemini-1.5-pro","openai/gpt-4o"]},"models": {"google/gemini-1.5-flash": {"alias": "gemini-flash","key": "env:GOOGLE_API_KEY"},"google/gemini-1.5-pro": {"alias": "gemini-pro","key": "env:GOOGLE_API_KEY"},"openai/gpt-4o": {"alias": "gpt4","key": "env:OPENAI_API_KEY"}}}}}
Model Comparison: Gemini 1.5 Flash vs Pro
| Feature | Gemini 1.5 Flash | Gemini 1.5 Pro |
|---|---|---|
| Speed | ⚡ Very Fast | 🐢 Slower |
| Cost | 💰 Cheaper | 💰💰 More expensive |
| Quality | ✅ Good | ✅✅ Better |
| Best For | Quick tasks, high volume | Complex reasoning, accuracy |
Setting Up Channels (Optional)
Connect OpenClaw to messaging platforms:
# Configure WhatsAppopenclaw config set channels.whatsapp.enabled true# Configure Telegramopenclaw config set channels.telegram.enabled trueopenclaw config set channels.telegram.token "your-bot-token"# Configure Discordopenclaw config set channels.discord.enabled trueopenclaw config set channels.discord.token "your-bot-token"
Next Steps
Now that OpenClaw is installed and configured with Gemini 1.5 Flash, you can:
- Explore Skills – Check out built-in skills:
openclaw skills list - Create Custom Skills – Build your own capabilities
- Set Up Memory – Configure long-term memory for your agent
- Connect Channels – Integrate with WhatsApp, Telegram, etc.
- Build Automations – Create workflows and scheduled tasks
Useful Resources
- Official Documentation: docs.openclaw.ai
- GitHub Repository: github.com/openclaw/openclaw
- Community Discord: discord.com/invite/clawd
- Skill Library: clawhub.com
- Google AI Studio: aistudio.google.com
Quick Reference Card
Save these commands for easy access:
# Start/stop gatewayopenclaw gateway startopenclaw gateway stop# Chatopenclaw chat# Check statusopenclaw status# Update OpenClawopenclaw update# Get helpopenclaw helpopenclaw help <command># View configurationopenclaw config get# List skillsopenclaw skills list
Tips for Best Performance
- Use Gemini Flash for: Quick responses, chatting, simple tasks, high-volume use
- Use Gemini Pro for: Complex reasoning, code generation, detailed analysis
- Set up fallbacks: Configure multiple models so OpenClaw switches automatically if one fails
- Monitor usage: Keep an eye on your Google Cloud API usage to avoid unexpected charges
- Keep OpenClaw updated: Run
openclaw updateregularly for new features and fixes
Congratulations! 🎉
You’ve successfully installed OpenClaw and configured it to use Google Gemini 1.5 Flash! Your AI agent is now ready to help you with tasks, answer questions, and automate workflows.
Start chatting with your agent:
openclaw chat "Hello! Let's get started."
Happy building with OpenClaw! 🦞
Leave a Reply