Using OpenClaw with abliteration.ai
Manually configure abliteration.ai as a custom Anthropic-compatible provider in OpenClaw. Add a models.providers entry, set baseUrl and apiKey, select abliterated-model.
This guide shows how to use OpenClaw with abliteration.ai as a custom Anthropic-compatible model provider. For the packaged provider, use the OpenClaw ClawHub plugin guide. This page is the manual ~/.openclaw/openclaw.json setup.
OpenClaw is an open-source personal AI assistant that runs on macOS, Linux, and Windows (via WSL2). Its model layer reads custom provider definitions from ~/.openclaw/openclaw.json, so you can point its agent at any Anthropic- or OpenAI-compatible gateway.
abliteration.ai exposes the Anthropic Messages surface at /v1/messages and /v1/messages/count_tokens, which matches OpenClaw's anthropic-messages adapter one-for-one. Setup is entirely declarative: add one provider block under models.providers, register abliterated-model in its catalog, and set agents.defaults.model.primary.
Use openclaw onboard for guided setup, or edit ~/.openclaw/openclaw.json (JSON5) directly using the provider block below.
// ~/.openclaw/openclaw.json
{
models: {
mode: "merge",
providers: {
abliteration: {
baseUrl: "https://api.abliteration.ai/v1",
apiKey: "${ABLITERATION_API_KEY}",
api: "anthropic-messages",
models: [
{
id: "abliterated-model",
name: "Abliterated Model",
reasoning: false,
input: ["text"],
contextWindow: 128000,
maxTokens: 8192,
cost: {
input: 0.005,
output: 0.005,
},
},
],
},
},
},
agents: {
defaults: {
model: {
primary: "abliteration/abliterated-model",
},
},
},
}Prerequisites
Before you start, make sure the basics are in place.
Provider settings
OpenClaw's model layer reads custom providers from models.providers.<name> inside ~/.openclaw/openclaw.json. For abliteration.ai, use the anthropic-messages adapter so OpenClaw talks to /v1/messages and /v1/messages/count_tokens.
| Setting | Value | Purpose |
|---|---|---|
models.providers.abliteration.baseUrl | https://api.abliteration.ai/v1 | Targets the public abliteration.ai API under /v1. OpenClaw appends /messages and /messages/count_tokens. |
models.providers.abliteration.apiKey | ${ABLITERATION_API_KEY} | Sends your ak_ API key as the bearer token. The ${VAR} syntax reads the value from your shell at runtime. |
models.providers.abliteration.api | anthropic-messages | Tells OpenClaw to speak the Anthropic Messages protocol to this provider. |
models.providers.abliteration.models[].id | abliterated-model | The model id published by abliteration.ai. Must match exactly. |
models.mode | merge | Keeps OpenClaw's built-in providers available alongside your custom provider. Use replace if you want to expose only abliteration.ai. |
agents.defaults.model.primary | abliteration/abliterated-model | Selects abliteration.ai as the default model for new agent runs. |
Configure openclaw.json
OpenClaw reads its primary config from ~/.openclaw/openclaw.json (legacy path ~/.clawdbot/clawdbot.json is still symlinked on upgraded installs). The file is JSON5, so comments, unquoted keys, and trailing commas are allowed.
Export your API key first so the ${ABLITERATION_API_KEY} interpolation resolves at runtime.
# Put this in ~/.bashrc, ~/.zshrc, or ~/.profile
export ABLITERATION_API_KEY="ak_YOUR_API_KEY"
# Reload your shell
source ~/.zshrc # or source ~/.bashrc
# Open the config in your editor
${EDITOR:-vi} ~/.openclaw/openclaw.jsonProvider block
Paste this provider block into ~/.openclaw/openclaw.json. The merge mode keeps OpenClaw's built-in providers intact so you can still switch to other models from openclaw onboard.
{
models: {
mode: "merge",
providers: {
abliteration: {
baseUrl: "https://api.abliteration.ai/v1",
apiKey: "${ABLITERATION_API_KEY}",
api: "anthropic-messages",
models: [
{
id: "abliterated-model",
name: "Abliterated Model",
reasoning: false,
input: ["text"],
contextWindow: 128000,
maxTokens: 8192,
cost: {
input: 0.005,
output: 0.005,
},
},
],
},
},
},
agents: {
defaults: {
model: {
primary: "abliteration/abliterated-model",
fallbacks: [],
},
},
},
}Validate the config
OpenClaw can dump its live JSON schema and validate the current config before you launch an agent.
# Print the schema OpenClaw uses to validate the config
openclaw config schema | less
# Show the resolved (merged) config that OpenClaw will use
openclaw config show
# Quick connectivity test against /v1/messages
curl -s https://api.abliteration.ai/v1/messages \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ABLITERATION_API_KEY" \
-d '{
"model": "abliterated-model",
"max_tokens": 64,
"messages": [{"role": "user", "content": "ping"}]
}' | python3 -m json.toolRun the agent
Once the provider is in place and agents.defaults.model.primary is set, OpenClaw's agent uses abliteration.ai automatically. The agent command does not accept a positional prompt or a per-run --model flag — pass the prompt with --message and select an agent profile with --agent. The reserved default agent id is main.
To switch models, edit agents.defaults.model.primary in ~/.openclaw/openclaw.json, or create a dedicated agent profile with openclaw agents add that pins its own model.
# List available agents (main is the reserved default id)
openclaw agents list
# Send a one-off message to the default agent using the primary model
openclaw agent --agent main --message "summarize this directory"
# Raise the reasoning effort for a single run
openclaw agent --agent main --thinking high --message "refactor foo.py for readability"
# Emit structured JSON instead of the default formatted output
openclaw agent --agent main --json --message "list the files in this repo"
# Bypass the gateway and run the embedded agent directly
openclaw agent --agent main --local --message "ping"How it works
OpenClaw's anthropic-messages adapter is a drop-in client for Anthropic-compatible gateways. The custom provider you defined has the same contract as OpenClaw's built-in Anthropic support.
Alternative: OpenAI-compatible wire format
If you prefer to route OpenClaw through the OpenAI Chat Completions surface, abliteration.ai also exposes /v1/chat/completions. Use api: "openai-completions" instead. This path is useful if another part of your stack already standardizes on OpenAI-style payloads.
Avoid api: "openai-responses" for custom providers on current OpenClaw releases — it has known issues for user-defined providers (see openclaw/openclaw#43018). Prefer the anthropic-messages config at the top of this page.
{
models: {
mode: "merge",
providers: {
"abliteration-openai": {
baseUrl: "https://api.abliteration.ai/v1",
apiKey: "${ABLITERATION_API_KEY}",
api: "openai-completions",
models: [
{
id: "abliterated-model",
name: "Abliterated Model (OpenAI wire)",
input: ["text"],
contextWindow: 128000,
maxTokens: 8192,
cost: { input: 0.005, output: 0.005 },
},
],
},
},
},
agents: {
defaults: {
model: {
primary: "abliteration-openai/abliterated-model",
},
},
},
}Troubleshooting
Most setup issues are config resolution, env var interpolation, or model id mismatches.