Random Bright, Funny, Info, Deep Thoughts, AI Chats, and More

[
[
[

]
]
]

How to Install OpenClaw with Google Gemini 1.5 Flash

OpenClaw is a powerful AI agent framework that can use multiple AI models, including Google’s Gemini. This guide will walk you through installing OpenClaw and configuring it to use 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:

  1. Visit: https://aistudio.google.com/app/apikey
  2. Sign in with your Google account
  3. Click: “Create API Key”
  4. Select: Your Google Cloud project (or create a new one)
  5. 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:

  1. Name: Enter your name
  2. Default model: Choose “Google” from the list
  3. API key: Paste your Gemini API key when prompted
  4. 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:

# Windows
notepad %USERPROFILE%\.openclaw\openclaw.json

# Mac/Linux
nano ~/.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 ~/.zshrc
echo 'export GOOGLE_API_KEY="your-api-key-here"' >> ~/.bashrc
source ~/.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:

# Windows
cd %USERPROFILE%\.openclaw\workspace

# Mac/Linux
cd ~/.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:

# Windows
notepad %USERPROFILE%\.openclaw\workspace\SOUL.md

# Mac/Linux
nano ~/.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 gateway
openclaw gateway start

# Stop the gateway
openclaw gateway stop

# Restart the gateway
openclaw gateway restart

# Check gateway status
openclaw gateway status

Chat & Interaction

# Start interactive chat
openclaw chat

# Send a single message
openclaw chat "Your question here"

# Use a different model for one message
openclaw chat --model google/gemini-1.5-pro "Your question"

Configuration

# View configuration
openclaw config get

# Set a configuration value
openclaw config set key.path "value"

# Edit config file directly
openclaw config edit

Skills Management

# List available skills
openclaw skills list

# View skill details
openclaw skills info skill-name

# Refresh skills
openclaw skills refresh

Troubleshooting

Issue: “API key not valid”

Solution:

  1. Verify your API key is correct
  2. Check that the environment variable is set: echo $GOOGLE_API_KEY (Mac/Linux) or echo %GOOGLE_API_KEY% (Windows)
  3. Make sure you’ve enabled the Generative Language API in Google Cloud Console
  4. Generate a new API key if needed

Issue: “Gateway failed to start”

Solution:

  1. Check if the port is already in use: openclaw gateway status
  2. Stop any existing gateway: openclaw gateway stop
  3. Check the logs: openclaw gateway logs
  4. Try restarting: openclaw gateway restart

Issue: “Command not found: openclaw”

Solution:

  1. Verify global npm install: npm list -g openclaw
  2. Check your PATH includes npm global bin
  3. Try reinstalling: npm install -g openclaw
  4. On Windows, restart your terminal after installation

Issue: Slow responses from Gemini

Solution:

  1. Check your internet connection
  2. Google API may have rate limits – wait a moment
  3. 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 WhatsApp
openclaw config set channels.whatsapp.enabled true

# Configure Telegram
openclaw config set channels.telegram.enabled true
openclaw config set channels.telegram.token "your-bot-token"

# Configure Discord
openclaw config set channels.discord.enabled true
openclaw config set channels.discord.token "your-bot-token"

Next Steps

Now that OpenClaw is installed and configured with Gemini 1.5 Flash, you can:

  1. Explore Skills – Check out built-in skills: openclaw skills list
  2. Create Custom Skills – Build your own capabilities
  3. Set Up Memory – Configure long-term memory for your agent
  4. Connect Channels – Integrate with WhatsApp, Telegram, etc.
  5. Build Automations – Create workflows and scheduled tasks

Useful Resources

Quick Reference Card

Save these commands for easy access:

# Start/stop gateway
openclaw gateway start
openclaw gateway stop

# Chat
openclaw chat

# Check status
openclaw status

# Update OpenClaw
openclaw update

# Get help
openclaw help
openclaw help <command>

# View configuration
openclaw config get

# List skills
openclaw skills list

Tips for Best Performance

  1. Use Gemini Flash for: Quick responses, chatting, simple tasks, high-volume use
  2. Use Gemini Pro for: Complex reasoning, code generation, detailed analysis
  3. Set up fallbacks: Configure multiple models so OpenClaw switches automatically if one fails
  4. Monitor usage: Keep an eye on your Google Cloud API usage to avoid unexpected charges
  5. Keep OpenClaw updated: Run openclaw update regularly 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! 🦞


Discover more from NathanLegakis.com

Subscribe to get the latest posts sent to your email.

Leave a Reply

Discover more from NathanLegakis.com

Subscribe now to keep reading and get access to the full archive.

Continue reading