OpenAI (GPT) with OpenClaw

Configure GPT-4, GPT-3.5, and Codex — OAuth or API key

OpenAI's GPT models are supported in OpenClaw for chat, code generation, and general-purpose tasks. OpenClaw integrates with ChatGPT Plus via OAuth (subscription) or with API keys for pay-as-you-go and team usage. Models include GPT-4, GPT-3.5, and Codex (including gpt-5.3-codex for advanced code generation).

Models

  • GPT-4 — Top tier, strong reasoning and long context
  • GPT-3.5 — Fast, cost-effective for simpler tasks
  • Codex — Optimized for code generation (e.g. gpt-5.3-codex)

Configure model in your Gateway config, e.g. openai/gpt-4. Use tiered routing: reserve GPT-4 for important work; use GPT-3.5 for heartbeats and background tasks. See Example Setups & Cost.

Authentication: OAuth vs API Key

OAuth (subscription): If you have ChatGPT Plus, you can authenticate with your subscription—no API key. Uses your subscription limits. Set up during openclaw onboard or in the Setup Wizard.

API key: Create an API key at platform.openai.com. Use for pay-as-you-go or when you prefer key-based auth. Store in ~/.openclaw/credentials or via openclaw secrets.

Basic Configuration

Minimal config
{
  "agent": {
    "model": "openai/gpt-4"
  }
}

Authentication is configured during onboarding or via credentials. See Configuration guide for full options.

Why OpenAI for OpenClaw

  • Code generation — Codex and GPT-4 excel at coding tasks
  • General purpose — Strong across many use cases
  • OAuth support — Use ChatGPT Plus without managing API keys
  • API ecosystem — Well-documented, widely used