PicoClaw Gemini API Integration Guide

February 16, 2026

PicoClaw is an ultra-lightweight AI assistant that can run on $10 hardware, with a memory usage of less than 10MB. This tutorial will guide you on how to configure the Gemini API for PicoClaw.

Introduction

PicoClaw supports multiple methods to access the Gemini API:

  • Defapi Platform (recommended): Half-price discount, no VPN needed, directly accessible within the country.
  • Official Google Gemini API: Direct connection to official services.
  • OpenRouter: Access through third-party routing.

Defapi is an AI API aggregation platform with prices at only half that of the official rates, making it very suitable for individual developers and small projects. The Gemini model from Defapi is compatible with the OpenAI v1/chat/completions protocol and can be used directly.

1. Obtain Defapi API Key

  1. Visit Defapi Official Website to register an account.
  2. Get your API Key in your personal center.

2. Configure PicoClaw

Edit the configuration file ~/.picoclaw/config.json:

{
  "agents": {
    "defaults": {
      "model": "google/gemini-2.0-flash"
    }
  },
  "providers": {
    "openrouter": {
      "api_key": "your-Defapi-Key",
      "api_base": "https://api.defapi.org"
    }
  }
}

3. Supported Gemini Models

ModelConfiguration Name
Gemini 2.0 Flashgoogle/gemini-2.0-flash
Gemini 1.5 Progoogle/gemini-1.5-pro
Gemini 1.5 Flashgoogle/gemini-1.5-flash

4. Advantages of Defapi

  • Half-price discount: 50% lower than the official price.
  • No VPN needed: Directly accessible within the country.
  • Stable and fast: Enterprise-level stable service.
  • Good compatibility: Compatible with the OpenAI v1/chat/completions protocol.

Method 2: Official Gemini API

1. Obtain API Key

  1. Visit Google AI Studio.
  2. Create an API Key.

2. Configure PicoClaw

{
  "agents": {
    "defaults": {
      "model": "gemini-2.0-flash"
    }
  },
  "providers": {
    "gemini": {
      "api_key": "your-gemini-api-key"
    }
  }
}

If a proxy is needed:

{
  "providers": {
    "gemini": {
      "api_key": "your-gemini-api-key",
      "proxy": "http://127.0.0.1:7890"
    }
  }
}

Method 3: OpenRouter

1. Obtain API Key

Visit OpenRouter to get your API Key.

2. Configure PicoClaw

{
  "agents": {
    "defaults": {
      "model": "google/gemini-2.0-flash"
    }
  },
  "providers": {
    "openrouter": {
      "api_key": "sk-or-v1-xxx"
    }
  }
}

If a proxy is needed:

{
  "providers": {
    "openrouter": {
      "api_key": "sk-or-v1-xxx",
      "proxy": "http://127.0.0.1:7890"
    }
  }
}

Verify if PicoClaw is Working Properly

Method 1: Direct Message Test

# Navigate to the PicoClaw directory
cd picoclaw

# Test if Gemini is functioning correctly
picoclaw agent -m "Hello, please reply hello"

If a normal response is returned, the configuration is successful!

Method 2: Start Gateway for Testing

# Start the gateway
picoclaw gateway

# Then send a message for testing through the configured chat channel (Telegram/Discord, etc.)

Method 3: Check Logs

# Check the PicoClaw logs
docker compose logs -f picoclaw-gateway

Common Use Cases for PicoClaw

1. Intelligent Conversation Assistant

Configure a Telegram or Discord bot to create an always-available AI conversation assistant.

{
  "channels": {
    "telegram": {
      "enabled": true,
      "token": "YOUR_BOT_TOKEN"
    }
  }
}

2. Code Review Assistant

PicoClaw can read code files and assist in reviewing and optimizing code.

# Ask AI to review code
picoclaw agent -m "Please review the code quality of src/main.go"

3. Document Generation

Utilize AI to automatically generate project documentation, API documentation, etc.

# Generate README
picoclaw agent -m "Create a README.md for this project"

4. Scheduled Tasks

Configure heartbeat tasks to allow AI to perform regular checks or reports.

{
  "heartbeat": {
    "enabled": true,
    "interval": 30
  }
}

5. Multi-Channel Deployment

Simultaneously configure multiple chat channels for a cross-platform AI assistant.

{
  "channels": {
    "telegram": { "enabled": true },
    "discord": { "enabled": true },
    "qq": { "enabled": true }
  }
}

Frequently Asked Questions

1. Returns "no API key configured"

Check whether the api_key in the configuration file is filled in correctly.

2. Model not supported

Make sure the model name you're using is correct; you can try the default model gemini-2.0-flash.

3. Network connection issues

If a proxy is needed, add the proxy field in the corresponding provider configuration.


Updated February 16, 2026