OpenClaw
OpenClaw is a self-hosted personal AI agent that you reach through chat apps such as Telegram and WhatsApp. It takes custom OpenAI-compatible providers in its config file.
Copies this page's setup instructions, to paste into your coding agent.
Show the prompt
Help me set this up to use Bayle AI, an OpenAI-compatible API. Full guide: https://docs.bayle.ai/guides/agents/openclaw/
Goal: run the OpenClaw personal agent (https://openclaw.ai) on a Bayle model.
1. Install OpenClaw if `openclaw --version` fails:
curl -fsSL https://openclaw.ai/install.sh | bash
On Windows or other methods, follow https://docs.openclaw.ai/install.
2. Pick a model that supports function calling, since OpenClaw drives tools:
curl -s "https://api.bayle.ai/models?type=text" \
| jq -r '.data[] | select(.model_spec.capabilities.supportsFunctionCalling) | .id'
Show me the list, let me choose, and use that id as MODEL_ID.
3. Make sure BAYLE_API_KEY is set in the environment OpenClaw runs in (the shell or service that starts it). If it is not, tell me how to set it there.
4. Edit ~/.openclaw/openclaw.json (JSON5), merging into what is already there. MODEL_ID goes in both places, and the key stays a reference:
{
agents: {
defaults: { model: { primary: "bayle/MODEL_ID" } },
},
models: {
mode: "merge",
providers: {
bayle: {
baseUrl: "https://api.bayle.ai",
apiKey: "${BAYLE_API_KEY}",
api: "openai-completions",
models: [{ id: "MODEL_ID", name: "MODEL_ID" }],
},
},
},
}
5. Verify by sending OpenClaw one short message through its CLI or chat. A 404 means the base URL has a path on it; a 401 means the key did not reach the request.
Rules:
1. The base URL is https://api.bayle.ai exactly as written. Append no path to it.
2. Read the key from the BAYLE_API_KEY environment variable. Never write the key itself into a file you create, a command, a commit or the chat. Where the tool keeps the key in its own settings screen, tell me where to paste it. If BAYLE_API_KEY is not set, stop and ask me to create a key at https://chat.bayle.ai/developers and export it.
3. Take model ids only from GET https://api.bayle.ai/models (no key needed). Never guess one.
4. Finish with one real test request, show me the result and list the files you changed.Install
Section titled “Install”curl -fsSL https://openclaw.ai/install.sh | bashThat is the installer for macOS and Linux. For Windows and other methods, see the official install guide.
Configure
Section titled “Configure”Don't have a Bayle key yet?Get API key
Set your key in the environment OpenClaw runs in:
export BAYLE_API_KEY="your-key"Add Bayle as a provider in ~/.openclaw/openclaw.json (JSON5), under models.providers, and make
it the agent’s default model:
{ agents: { defaults: { model: { primary: "bayle/MODEL_ID" } }, }, models: { mode: "merge", providers: { bayle: { baseUrl: "https://api.bayle.ai", apiKey: "${BAYLE_API_KEY}", api: "openai-completions", models: [{ id: "MODEL_ID", name: "MODEL_ID" }], }, }, },}baseUrlishttps://api.bayle.ai. OpenClaw adds/chat/completionsitself.api: "openai-completions"selects the chat completions format, which is what Bayle serves.- A model is referenced as
provider/id, sobayle/MODEL_ID, and it must also appear in the provider’smodelslist. mode: "merge"keeps OpenClaw’s other providers alongside this one.
Pick a model
Section titled “Pick a model”OpenClaw drives tools, so choose a model that supports function calling:
curl -s "https://api.bayle.ai/models?type=text" \ | jq -r '.data[] | select(.model_spec.capabilities.supportsFunctionCalling) | .id'Replace MODEL_ID in both places with one of those ids. To add more, list each in models.
If it doesn’t work
Section titled “If it doesn’t work”- A
404means the base URL has a path on it. It should be exactlyhttps://api.bayle.ai. - A
401means the key didn’t reach the request. CheckBAYLE_API_KEYis set in the shell or service that starts OpenClaw. - See Bayle as an agent backend for retries and balance errors.