How to Configure AI Providers in OpenClaw
This guide explains how to configure an AI provider in OpenClaw. Once configured, your agent will be powered by the latest language models to handle conversations, tasks, and integrations.
Available AI Providers
OpenClaw supports multiple leading AI providers. For each provider, except Ollama Cloud, you will need to obtain an API key from the provider's website. You can choose the one that best fits your needs:
No. | Provider | Description |
|---|---|---|
1 | Anthropic (Claude) | Advanced reasoning and safety-focused models, ideal for complex tasks. |
2 | OpenAI | GPT-4 and GPT-3.5 models, versatile for general-purpose AI interactions. |
3 | OpenRouter | A unified API giving access to multiple models (Claude, GPT, Llama, and more). |
4 | Google (Gemini) | Google's multimodal models, excellent for understanding text, images, and more. |
5 | Kimi (Moonshot AI) | A powerful model optimized for long-context understanding. |
6 | MiniMax | Known for strong performance in conversational AI and text generation. |
7 | Mistral | Efficient, open-weight models with great performance-to-cost ratio. |
8 | Ollama Cloud [free] | Run open-source models (like Llama, Mistral) in the cloud. Completely free API keys are available, perfect as a fallback option. |
How to Set Up an AI Provider
Follow these steps to configure your chosen AI provider via SSH.
Prerequisites
- An active OpenClaw VPS
- SSH access to your VPS (see the Essential Command Guide)
- Your API key ready (if using a paid provider)
- Run setup command:
setup-ai.
- When prompted, choose your AI provider by entering the corresponding number from the displayed list of options (1β8). You can select number
4for Google (Gemini).

- Paste your Google (Gemini) API key when prompted. It will be stored securely in
/opt/openclaw/.env.

- You will be prompted to decide whether to set selected model as primary or to designate it as a fallback.
- Primary: The main model your agent will use by default.
- Fallback: The model your agent will use if the primary is unavailable.

- Once the configuration is complete, the OpenClaw service will automatically restart.
Verifying Your Configuration
After the restart, you can verify the setup:
- Test your agent by sending a message to your agent; if you set the model as primary, you will see the agent using that model.

- Check the configuration file to view your configured provider and models.
cat /opt/openclaw/data/.openclaw/openclaw.json

Important Notes
- API Keys - Your API keys (for paid providers) are stored securely in
/opt/openclaw/.env. You can edit this file manually if needed, but usingsetup-aiis recommended to avoid errors. If you do edit manually, you must restart the service for changes to take effect:openclaw-restart. - Provider not listed? - Run
openclaw-updatefirst to get the latest provider list. - Rate limits - Depends on your OpenAI tier. Free trial keys have lower limits.
Need Further Assistance?
If you face any issues or need assistance, donβt hesitate to reach out β our support team is always ready to help!
π§ Need help? Submit a Support Ticket
π¬ Chat with us on Live Chat via our website
Updated on: 20/04/2026
Thank you!