Skip to content
Try chatGet API key

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.
Terminal window
curl -fsSL https://openclaw.ai/install.sh | bash

That is the installer for macOS and Linux. For Windows and other methods, see the official install guide.

Don't have a Bayle key yet?Get API key

Set your key in the environment OpenClaw runs in:

Terminal window
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" }],
},
},
},
}
  • baseUrl is https://api.bayle.ai. OpenClaw adds /chat/completions itself.
  • api: "openai-completions" selects the chat completions format, which is what Bayle serves.
  • A model is referenced as provider/id, so bayle/MODEL_ID, and it must also appear in the provider’s models list.
  • mode: "merge" keeps OpenClaw’s other providers alongside this one.

OpenClaw drives tools, so choose a model that supports function calling:

Terminal window
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.

  • A 404 means the base URL has a path on it. It should be exactly https://api.bayle.ai.
  • A 401 means the key didn’t reach the request. Check BAYLE_API_KEY is set in the shell or service that starts OpenClaw.
  • See Bayle as an agent backend for retries and balance errors.