Back to Tutorials

Configuring OpenClaw

Learn how to configure AI models, channels, and system settings.

Beginner10 min
configurationai-modelssetup

Configuring OpenClaw

⚙️ This guide covers the essential configuration options for OpenClaw.

Configuration File Structure

OpenClaw uses a config.yaml file in the project root for all settings.

# config.yaml
gateway:
  # Session settings
  session:
    timeout: 3600        # Session timeout in seconds
    max_history: 50      # Max messages to remember

  # Channel configurations
  channels:
    - name: wechat
      enabled: true
      webhook_port: 8080

    - name: telegram
      enabled: false
      bot_token: ${TELEGRAM_BOT_TOKEN}

  # AI Model settings
  models:
    default: claude
    providers:
      - name: claude
        model: claude-3-sonnet-20240229
        api_key: ${ANTHROPIC_API_KEY}

      - name: openai
        model: gpt-4-turbo-preview
        api_key: ${OPENAI_API_KEY}

Configuring AI Models

Using Claude (Anthropic)

  1. Get your API key from Anthropic Console
  2. Add to .env:
ANTHROPIC_API_KEY=sk-ant-xxxxx
  1. Set as default in config:
models:
  default: claude

Using ChatGPT (OpenAI)

  1. Get your API key from OpenAI Platform
  2. Add to .env:
OPENAI_API_KEY=sk-xxxxx
  1. Set as default in config:
models:
  default: openai

Using Other Models

OpenClaw supports various AI providers:

| Provider | Model | Notes | |----------|-------|-------| | Anthropic | Claude 3 | Recommended for best results | | OpenAI | GPT-4 | Reliable alternative | | DeepSeek | DeepSeek Chat | Cost-effective | | Replicate | Various | For image models |

Configuring Channels

WeChat

channels:
  - name: wechat
    enabled: true
    webhook_port: 8080

See Connect WeChat for detailed setup.

Telegram

channels:
  - name: telegram
    enabled: true
    bot_token: ${TELEGRAM_BOT_TOKEN}

See Connect Telegram for detailed setup.

System Prompts

Customize how OpenClaw responds:

prompts:
  system: |
    You are a helpful AI assistant.
    Be concise and friendly.
    Always offer to help with follow-up questions.

  # Per-channel overrides
  channels:
    wechat: |
      You are assisting via WeChat.
      Keep responses short and mobile-friendly.

Testing Configuration

After making changes:

npm run dev

Check the console for any configuration errors.

Next Steps