Welcome to RDK X5 Board repository
02. OpenClaw API-KEY Configuration
OpenClaw API-KEY Configuration
OpenClaw API-KEY Configuration1. Course Overview1.1 Course Content2. API-KEY Application2.1 Recommended Model Service Providers3. Configuring OpenClaw API-KEY3.1 Configuration Methods3.2 Quick Configuration3.2.1 Configure baseUrl3.2.2 Fill in apiKey and baseUrl4. View Connected Model Status4.1 View the List of Configured Models4.2 Verify Configuration Success5. Other Access Methods (Advanced)5.1 CLI Command Configuration for API-KEY (Suitable for Beginners)5.2 Modify Configuration File (Recommended Method)Configuration File LocationEdit Configuration File6. Common Issues and Solutions6.1 Invalid API-KEY or Errors6.2 Unable to Access Model Service7. Course Summary
1. Course Overview
This course will detail how to configure the AI model API-KEY for OpenClaw, including the application process for API-KEYs, two configuration methods (CLI command configuration and configuration file modification), and how to verify if the configuration is successful. After completing this course, you will be able to successfully connect to and use various AI large model service providers.
1.1 Course Content
- Understand the types of model service providers supported by OpenClaw
- Master the method for applying for API-KEYs
- Learn how to view and verify the status of connected models
2. API-KEY Application
2.1 Recommended Model Service Providers
Recommended for beginners: Refer to the accompanying tutorial [Chapter 8 Online AI Large Model Development] — [Online Large Models (Text Interaction)] — [2. Tongyi Qianwen Large Model] to apply for the corresponding model provider API-KEY.
OpenClaw supports numerous model service providers, including:
- OpenAI - GPT series (API + Codex)
- Anthropic - Claude series (API + Claude Code)
- Google - Gemini series
- Alibaba Cloud - Qwen Cloud, Tongyi Qianwen
- DeepSeek - DeepSeek models
- Zhipu AI - GLM models
- Moonshot AI - Kimi + Kimi Coding
- Ollama - Local models (cloud + local)
- And many other service providers
You can freely choose a model service provider based on your actual needs and regional network policies, register on the corresponding official website, and apply for an API-KEY.
3. Configuring OpenClaw API-KEY
3.1 Configuration Methods
OpenClaw provides two ways to configure API-KEYs:
CLI Command Configuration (suitable for beginners)
Directly Modify Configuration File (suitable for developers)
- Configuration file path:
$HOME/.openclaw/openclaw.json
- Configuration file path:
3.2 Quick Configuration
- Suitable for users who want to get started quickly. You need to register for an Alibaba Cloud Bailian large model account and create an API-KEY first (refer to the accompanying tutorial [Chapter 8 Online AI Large Model Development] — [Online Large Models (Text Interaction)] — [2. Tongyi Qianwen Large Model]).
- The factory-preset configuration file has already configured the Bailian model parameters; Simply fill in your API-KEY and baseUrl to start using it directly.
- Open the OpenClaw configuration file:
xxxxxxxxxxnano $HOME/.openclaw/openclaw.json
xxxxxxxxxxnano $HOME/.openclaw/agents/main/agent/models.json
3.2.1 Configure baseUrl
- Users need to configure the
tongyi_base_urlcorresponding to their account. Go to the Model Service Platform Bailian Console to apply for an API key. Copy the API key and OpenAI-compatible address (Base URL), then fill them into the corresponding fields.

3.2.2 Fill in apiKey and baseUrl

- After filling it in, press
Ctrl+X, then pressYto confirm saving, and press Enter to exit.
4. View Connected Model Status
4.1 View the List of Configured Models
After configuration, you can use the following command to view the connected models:
xxxxxxxxxxopenclaw models list
4.2 Verify Configuration Success
Test Conversation
xxxxxxxxxxopenclaw tuiStart the TUI interface, send a test message (e.g., "hello"), and confirm that the model responds normally.

5. Other Access Methods (Advanced)
- If you have your own model provider or need to access other model providers later, refer to the following tutorial.
5.1 CLI Command Configuration for API-KEY (Suitable for Beginners)
Start Configuration Wizard
xxxxxxxxxxopenclaw onboard
- Select [Yes] and press Enter.

- Select QuickStart for the configuration mode and press Enter.

Select Model Service Provider
- Use the up and down arrows to select the service provider for which you have applied for an API-KEY, and press Enter to confirm. Here we take Alibaba Cloud Bailian model provider as an example; the configuration method for other model providers is the same.
- Here select Custom Provider [Custom Provider]

- Enter the base_url of the model provider.

- Enter API-KEY
- After selecting the provider, the system will prompt you to enter the corresponding API-KEY.

- Paste or type the API-KEY you applied for, and press Enter to confirm.

- Select OpenAI-compatible for the interface protocol.

- Fill in the model name, taking MiniMax as an example.

- Endpoint ID is the model provider identifier and can be filled in freely.

- Model alias (optional) can be left blank.

- Other Configurations
- For other configuration items, select Skip for all as shown below; no configuration is needed.



- For Enable Hooks, press space to select Skip for now.

- Select Restart to restart the gateway and apply the configuration.

- Close the popped-up OpenClaw webpage.
5.2 Modify Configuration File (Recommended Method)
Configuration File Location
Configuration files are located at: $HOME/.openclaw/openclaw.json
xxxxxxxxxx`$HOME/.openclaw/agents/main/agent/models.json`
Edit Configuration File
Open Configuration File 1
xxxxxxxxxxnano $HOME/.openclaw/openclaw.json# Or use your preferred editor, such as vim, code, etc.Add Model Provider Configuration
Add or modify the
models.providerssection in the configuration file:xxxxxxxxxx{"models": {"providers": {"openai": {"apiKey": "OPENAI_API_KEY"},"anthropic": {"apiKey": "ANTHROPIC_API_KEY"},"google": {"apiKey": "GOOGLE_API_KEY"}}},"agents": {"defaults": {"model": {"primary": "openai/gpt-4"}}}}Open Configuration File 2
xxxxxxxxxxnano $HOME/.openclaw/agents/main/agent/models.jsonAdd Model Provider Configuration
Add or modify as follows:

Configuration Description
models.providers: Configure the API-KEYs for each model service provider.openai.apiKey: OpenAI's API-KEYanthropic.apiKey: Anthropic's API-KEYgoogle.apiKey: Google's API-KEY
agents.defaults.model.primary: Set the default model to use.- Format is
provider/model_name, e.g.,openai/gpt-4,anthropic/claude-3,google/gemini-pro
- Format is
Save and Exit
- Be careful not to randomly delete periods or add other symbols when modifying.
- Press
Ctrl+Oto save,Ctrl+Xto exit (nano editor).
Factory Default Bailian Configuration (Can be directly modified or referenced)
xxxxxxxxxx"models": { "mode": "merge", "providers": { "bailian": { "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1", "apiKey": "sk-a98b519b6bab4e35a7b82b4a95b8a4f6", "api": "openai-completions", "models": [ { "id": "qwen3.5-plus", "name": "qwen3.5-plus", "reasoning": false, "input": [ "text", "image" ], "contextWindow": 1000000, "maxTokens": 65536, "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 } }, { "id": "MiniMax-M2.5", "name": "MiniMax-M2.5", "reasoning": false, "input": [ "text" ], "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 196608, "maxTokens": 32768 }, { "id": "glm-4.7", "name": "glm-4.7", "reasoning": false, "input": [ "text" ], "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 202752, "maxTokens": 16384, "compat": { "thinkingFormat": "qwen" } } ] }