Skip to main content

One-Click Script Tutorial

Quick Start

Before running this script, please ensure:

  1. Node.js 24 is recommended, and Node.js 22.14+ is also supported
  2. OpenClaw is installed and initialized
  3. It is recommended to run openclaw onboard --install-daemon first
  4. Your network connection is working properly, and the B.AI API is accessible

Script Commands

Linux & macOS:

Mac users: open Terminal from Applications, then run the command below:

curl -LsSf https://chat.b.ai/scripts/openclaw-install-bai-provider.sh | bash

Windows PowerShell:

Windows users: open PowerShell from the Start menu, then run the command below (CMD is not supported):

iwr -useb https://chat.b.ai/scripts/openclaw-install-bai-provider.ps1 | iex

Note: The current official one-click scripts are published through B.AI Chat.


Detailed Steps

1. Create an API Key

  1. Log in to the B.AI Platform
  2. Go to the API Key Management Page
  3. Create a new API Key


2. Run the Installation Script

Depending on your operating system, run the corresponding command above.

The script will automatically:

  • Check your environment, including Node.js and OpenClaw
  • Prompt you to enter your B.AI API Key
  • Write the bai provider configuration into your OpenClaw config
  • Set a default model
  • Attempt to restart the local Gateway service if it is already installed

3. Select a Default Model

After validating the API Key, the script will fetch the list of available models and prompt you to choose a default model.

Note: Some Gemini-series models may not work reliably in OpenClaw because certain function-calling scenarios are more strict about client fingerprinting. Please choose carefully.


4. Complete Configuration

After you finish model selection, the script will automatically:

  • Back up your original configuration file
  • Update your OpenClaw configuration
  • Try to restart the related local service

Important: A successful script run does not always mean the Gateway service is already installed and running. After the script finishes, verify it explicitly:

openclaw gateway status

If the CLI says the service is not installed, run:

openclaw gateway install
openclaw gateway restart


5. Switch Models

You can switch the model you use in two ways:

Option 1: Command Line

openclaw models set bai/<model_name>

You can also manually edit the ~/.openclaw/openclaw.json configuration file.

Option 2: Web UI - Dashboard

Open the following address in your browser:

http://127.0.0.1:18789/

This is the default OpenClaw Dashboard address.

Then:

  1. Click Agent in the left navigation menu
  2. Find the Primary model dropdown
  3. Select the model you want to use

Note: After changing the model in the Dashboard, command-line model switching may no longer work as expected, because the Dashboard may automatically add a list field to the configuration file.



Compatibility Testing

Operating SystemStatus
Ubuntu 24.04✅ Passed
Windows 11✅ Passed
macOS✅ Passed

FAQ

Q: What should I do if the script fails to run?

A: Please make sure that:

  1. Node.js 22.14+ is installed
  2. OpenClaw is installed
  3. You have already completed initialization, ideally with openclaw onboard --install-daemon
  4. Your network connection is working properly
  5. The B.AI API endpoint is reachable
  6. You are using the current official script URLs from B.AI Chat
  7. After the script finishes, you have confirmed the Gateway state with openclaw gateway status

Q: How do I switch models?

A: See Step 5: Switch Models above.

Q: What if I have not installed OpenClaw yet?

A: Please install OpenClaw first, then run:

openclaw onboard --install-daemon

After onboarding is complete, come back and run the B.AI provider installation script.

Q: Where can I find the OpenClaw Dashboard?

A: By default, the Dashboard is available at:

http://127.0.0.1:18789/

Q: Can I edit the configuration manually instead of using the script?

A: Yes. You can manually edit:

~/.openclaw/openclaw.json

and add the bai provider configuration yourself.