Logo
Configuration

AI Providers

How to configure AI providers and models in BabyClaw.

AI Providers

BabyClaw uses the Vercel AI SDK under the hood, which means it works with multiple AI providers out of the box. You can configure one or several providers and assign different models to different tasks.

Supported providers

  • Anthropic (Claude) -- recommended
  • OpenAI (GPT, o-series)
  • Google (Gemini)
  • Mistral
  • xAI (Grok)
  • OpenRouter (any model behind their API)
  • Vercel AI Gateway

Each provider just needs an API key. Some also accept a custom baseUrl if you're using a proxy or self-hosted endpoint.

Configuring a provider

Add providers under ai.providers in your config. The key is the provider name, and the value has at least an apiKey:

{
  "ai": {
    "providers": {
      "anthropic": {
        "apiKey": "sk-ant-..."
      }
    }
  }
}

You can configure multiple providers at once:

{
  "ai": {
    "providers": {
      "anthropic": { "apiKey": "sk-ant-..." },
      "openai": { "apiKey": "sk-..." },
      "google": { "apiKey": "AIza..." }
    }
  }
}

Custom base URL

If you're using a proxy, self-hosted endpoint, or OpenRouter, set baseUrl:

{
  "ai": {
    "providers": {
      "openrouter": {
        "apiKey": "sk-or-...",
        "baseUrl": "https://openrouter.ai/api/v1"
      }
    }
  }
}

Setting models

BabyClaw uses up to two models for different tasks:

ModelRequiredPurpose
chatYesMain conversation model -- handles messages and tool calls
visionNoUsed when processing images (falls back to chat if not set)

Models are referenced as provider:modelId:

{
  "ai": {
    "models": {
      "chat": "anthropic:claude-sonnet-4-20250514",
      "vision": "openai:gpt-4o"
    }
  }
}

The provider name before the colon must match a key in ai.providers.

Model aliases

Aliases let you define short names for models. This is handy if you switch models often or want something easier to type:

{
  "ai": {
    "aliases": {
      "sonnet": "anthropic:claude-sonnet-4-20250514",
      "gpt4": "openai:gpt-4o",
      "gemini": "google:gemini-2.5-pro"
    }
  }
}

Alias names must be lowercase alphanumeric with hyphens or underscores (^[a-z0-9_-]+$).

You can manage aliases from the CLI:

babyclaw model alias              # list aliases
babyclaw model alias set --name sonnet --model anthropic:claude-sonnet-4-20250514
babyclaw model alias remove --name gpt4

Provider examples

{
  "ai": {
    "providers": {
      "anthropic": { "apiKey": "sk-ant-..." }
    },
    "models": {
      "chat": "anthropic:claude-sonnet-4-20250514"
    }
  }
}

OpenAI

{
  "ai": {
    "providers": {
      "openai": { "apiKey": "sk-..." }
    },
    "models": {
      "chat": "openai:gpt-4o"
    }
  }
}

Google (Gemini)

{
  "ai": {
    "providers": {
      "google": { "apiKey": "AIza..." }
    },
    "models": {
      "chat": "google:gemini-2.5-pro"
    }
  }
}

OpenRouter

OpenRouter lets you access many models through a single API. Set the baseUrl to their endpoint:

{
  "ai": {
    "providers": {
      "openrouter": {
        "apiKey": "sk-or-...",
        "baseUrl": "https://openrouter.ai/api/v1"
      }
    },
    "models": {
      "chat": "openrouter:anthropic/claude-sonnet-4"
    }
  }
}

Mixed providers

You can use different providers for different tasks:

{
  "ai": {
    "providers": {
      "anthropic": { "apiKey": "sk-ant-..." },
      "openai": { "apiKey": "sk-..." }
    },
    "models": {
      "chat": "anthropic:claude-sonnet-4-20250514",
      "vision": "openai:gpt-4o"
    }
  }
}

Interactive setup

If you'd rather not edit JSON, the CLI has an interactive wizard:

babyclaw model configure

This walks you through picking a provider and entering your API key.