OpenAI

OpenAI GPT models are the most popular choice for OpenClaw tasks. Supports GPT-4o, GPT-4o-mini, o1-mini, and all other OpenAI models.

Setup

# Set your API key
export OPENCLAW_OPENAI_KEY="sk-proj-..."

# Or with openclaw config
openclaw config set openai.api_key "sk-proj-..."
# .openclaw/config.yaml
provider: openai
openai:
  api_key: "${OPENCLAW_OPENAI_KEY}"
  model: gpt-4o-mini
  max_tokens: 4096
  temperature: 0.1
  timeout: 120

Available Models

ModelBest ForContextSpeed
gpt-4oComplex tasks, multimodal128KMedium
gpt-4o-miniGeneral automation (recommended)128KFast
o1-miniMulti-step reasoning, math128KSlow
gpt-3.5-turboSimple tasks, high volume16KVery Fast

Anthropic Claude

Claude models excel at nuanced instruction following, long-document analysis, and code generation. Claude 3.5 Sonnet is highly recommended for complex automation.

Setup

export OPENCLAW_ANTHROPIC_KEY="sk-ant-..."
openclaw config set anthropic.api_key "sk-ant-..."
# Use Claude for a task
openclaw run "Analyze this 90-page PDF and extract all action items" \
  --provider anthropic \
  --model claude-3-5-sonnet-20241022
provider: anthropic
anthropic:
  api_key: "${OPENCLAW_ANTHROPIC_KEY}"
  model: claude-3-5-sonnet-20241022
  max_tokens: 8192

Ollama (Local Models)

Run OpenClaw entirely offline with Ollama local models. No API keys required — complete privacy on your own hardware.

Install Ollama & Models

# Install Ollama (macOS/Linux)
curl -fsSL https://ollama.com/install.sh | sh

# Pull recommended models
ollama pull llama3.1:8b       # Best for most tasks (4.7GB)
ollama pull codellama:7b      # Code-focused tasks (3.8GB)
ollama pull mistral:7b        # Fast and capable (4.1GB)
ollama pull phi3:mini         # Lightweight (2.2GB)

# Start Ollama server (if not running as service)
ollama serve

Configure OpenClaw for Ollama

provider: ollama
ollama:
  base_url: "http://localhost:11434"
  model: llama3.1:8b
  context_length: 8192
  num_thread: 8        # Number of CPU threads
  gpu_layers: 32       # Set -1 for full GPU offload
# Run with local Ollama
openclaw run "Refactor this file to use async/await" \
  --provider ollama \
  --model codellama:7b \
  ./legacy_client.py
📝
Hardware requirements

Llama 3.1 8B requires ~8GB RAM minimum. For GPU acceleration, 8GB VRAM recommended. Use phi3:mini for systems with less than 8GB RAM.

Telegram Bot Integration

Create a personal Telegram bot powered by OpenClaw — send tasks via Telegram and get results back immediately.

Create a Bot & Get Token

  1. Open Telegram and message @BotFather
  2. Send /newbot and follow the steps
  3. Copy the bot token (format: 123456789:ABCdef...)

Bot Implementation

pip install openclaw[telegram]
import os
from openclaw.integrations.telegram import TelegramBot
from openclaw import Agent, Config

# Configure the agent
agent = Agent(Config(
    provider="openai",
    model="gpt-4o-mini",
    max_steps=15,
    allow_file_write=True,
))

# Create bot with access control
bot = TelegramBot(
    token=os.environ["TELEGRAM_BOT_TOKEN"],
    agent=agent,
    allowed_users=[123456789],  # Your Telegram user ID
)

# Start polling
bot.run()

Send messages to your bot to run tasks. The bot accepts natural language commands:

You: Summarize the latest commits in /home/user/myproject

Bot: 🤖 Running task...

Bot: Here are the latest 5 commits:
  - feat: add async support for file reader (2h ago)
  - fix: handle empty CSV edge case (5h ago)
  - docs: update README with new examples (1d ago)
  ...
  
  Task completed in 8s (3 steps)

Discord Bot Integration

Add OpenClaw to your Discord server as a bot that teammates can query with AI-powered commands.

pip install openclaw[discord]
import os
import discord
from discord.ext import commands
from openclaw import Agent, Config

intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
agent = Agent(Config(provider="openai", model="gpt-4o-mini"))

@bot.command(name="ai")
async def ai_task(ctx, *, task: str):
    """Run an AI task: !ai """
    await ctx.send(f"⏳ Running: *{task}*")
    try:
        result = agent.run(task)
        # Discord message limit: 2000 chars
        response = result.output[:1900] + "..." if len(result.output) > 1900 else result.output
        await ctx.send(f"✅ **Done** ({result.duration:.1f}s)\n\n{response}")
    except Exception as e:
        await ctx.send(f"❌ Error: {str(e)}")

bot.run(os.environ["DISCORD_BOT_TOKEN"])

Custom API Integration

Connect OpenClaw to any REST API by building a custom tool:

from openclaw import Agent, Config, Tool
import httpx

@Tool.register(
    name="jira_create_ticket",
    description="Create a JIRA ticket. Requires: project_key, summary, description, priority (Low/Medium/High/Critical)"
)
def jira_create_ticket(project_key: str, summary: str, description: str, priority: str = "Medium") -> str:
    client = httpx.Client(
        base_url="https://your-domain.atlassian.net",
        auth=("your@email.com", os.environ["JIRA_API_TOKEN"]),
        headers={"Content-Type": "application/json"}
    )
    resp = client.post("/rest/api/3/issue", json={
        "fields": {
            "project": {"key": project_key},
            "summary": summary,
            "description": {"type": "doc", "version": 1, "content": [{"type": "paragraph", "content": [{"type": "text", "text": description}]}]},
            "issuetype": {"name": "Task"},
            "priority": {"name": priority}
        }
    })
    resp.raise_for_status()
    data = resp.json()
    return f"Created ticket {data['key']}: {data['self']}"

agent = Agent(Config(provider="openai"), extra_tools=["jira_create_ticket"])
agent.run("Read the TODO.md file and create JIRA tickets for each incomplete item in project OC")
🔗
See Also

Configuration — Set up API keys and provider settings for each integration.

Automation Examples — Practical integration examples in real-world workflows.

Use Cases — See how integrations power real productivity gains.