---
title: "OpenClaw custom provider for security-tuned models"
canonical: https://pentestllm.ai/guides/openclaw
generated: 2026-11-18T03:35:56.882Z
source: https://pentestllm.ai/guides/openclaw
base_url: https://api.pentestllm.ai/v1
---

# OpenClaw on a security model that answers

Give OpenClaw this API through one models.providers entry in ~/.openclaw/openclaw.json: baseUrl, a key pulled from the environment, the openai-completions adapter and a models array of security and abliterated builds. Then the default model, what a session costs and the error fixes.

Steps checked November 6, 2026 · prices as of November 18, 2026

An agent that halts a red team exercise to question whether you are allowed to read your own scan output is a liability. OpenClaw takes a custom provider in `~/.openclaw/openclaw.json`: a base URL, the Chat Completions adapter, a key reference and the model ids. With that single block a security-tuned or abliterated build drives the agent, tool calls for files and shell included, billed per token under the PentestLLM name. The same ids also work in [Hermes Agent](https://pentestllm.ai/guides/hermes-agent) and [OpenCode](https://pentestllm.ai/guides/opencode).

## What you need

OpenClaw installed with its Gateway running, a key from the [console](https://app.pentestllm.ai/console), and an editor open on `~/.openclaw/openclaw.json`. That file is JSON5, so comments and trailing commas are legal, and the Gateway watches it: most changes take effect the moment you save. A custom provider is a single entry under `models.providers` holding a base URL, an API adapter, a key reference and the list of models you intend to call. The reference `${PENTESTLLM_API_KEY}` pulls the key from the environment, so the key itself never lands in the file. To try a security build before any of this, the home page prompt box gives a few free turns and [the playground](https://pentestllm.ai/playground) runs the same catalog.

## Shortest path to a first reply

1. Make a key for OpenClaw alone, so its traffic is easy to pick out on the usage page when you reconcile an engagement, and place it where OpenClaw actually looks for the variable: the process environment or the global env file. A `.env` in your working directory is not read for provider keys.

```
# ~/.openclaw/.env
PENTESTLLM_API_KEY=sk-ptl-live-…
```

1. Paste the block into `openclaw.json`. The `input`, `contextWindow` and `maxTokens` fields on each entry are taken from the catalog wherever it publishes them. Any further id from the [models page](https://pentestllm.ai/models) belongs in the same array with, at minimum, its `id`:

```
// ~/.openclaw/openclaw.json
{
  agents: {
    defaults: { model: { primary: "pentestllm/glm-5.3-uncensored" } },
  },
  models: {
    mode: "merge",
    providers: {
      pentestllm: {
        baseUrl: "https://api.pentestllm.ai/v1",
        apiKey: "${PENTESTLLM_API_KEY}",
        api: "openai-completions",
        models: [
          { id: "glm-5.3-uncensored", name: "GLM-5.3 Uncensored" },
          { id: "glm-5.3-flash-uncensored", name: "GLM-5.3 Flash Uncensored" },
          { id: "deepseek-v4.1-flash-abliterated", name: "DeepSeek V4.1 Flash Abliterated" },
          { id: "deepseek-v4-pro-uncensored", name: "DeepSeek V4 Pro Uncensored" },
          { id: "glm-5.3-abliterated", name: "GLM-5.3 Abliterated" },
          { id: "kimi-k3.1-pro-uncensored", name: "Kimi K3.1 Pro Uncensored", contextWindow: 1048576, maxTokens: 131072 },
        ],
      },
    },
  },
}
```

1. See what OpenClaw made of it, then start a conversation:

```bash
openclaw models list --provider pentestllm
openclaw models status
```

`models list --provider pentestllm` echoes the ids you declared and `models status` reports the resolved primary model with its auth state. Swap the default later with `openclaw models set pentestllm/glm-5.3-flash-uncensored`. A first message, for instance asking the agent to read a scan log and group the findings by host, lands on the console’s usage page within seconds, token counts and charge included.

## Each field of the entry

- baseUrl: https://api.pentestllm.ai/v1 keep the trailing /v1; OpenClaw appends /chat/completions itself
- apiKey: ${PENTESTLLM_API_KEY} the full sk-ptl- key, resolved from the environment when OpenClaw starts
- api: openai-completions the Chat Completions adapter; every build in the catalog speaks it
- models: [{ id, name, … }] the ids this provider exposes; an id with no entry here cannot be referenced anywhere
- mode: merge adds this provider beside OpenClaw's bundled ones; replace would remove them
- agents.defaults.model.primary: pentestllm/glm-5.3-uncensored the build OpenClaw opens with, written as provider/model

## Which build to start with

On each turn of an agent session the conversation and all tool output go back to the model, so the input rate is what you are really paying for. Where an entry omits a field, OpenClaw substitutes its own defaults: `input: ["text"]`, `reasoning: false`, a 200,000-token context budget when none is declared, and its own output ceiling. The cost column below prices a single turn of 30,000 tokens in and 1,000 out from the catalog as of 2026-11-18. OpenClaw sends no prompt-cache hints to a custom provider, so budget at the full input rate.

| Build | Single turn | Session of 40 turns |
| --- | --- | --- |
| [GLM-5.3 Uncensored](https://pentestllm.ai/models/glm-5.3-uncensored) | $0.0093 | $0.37 |
| [GLM-5.3 Flash Uncensored](https://pentestllm.ai/models/glm-5.3-flash-uncensored) | $0.0035 | $0.14 |
| [DeepSeek V4.1 Flash Abliterated](https://pentestllm.ai/models/deepseek-v4.1-flash-abliterated) | $0.03 | $1.09 |
| [DeepSeek V4 Pro Uncensored](https://pentestllm.ai/models/deepseek-v4-pro-uncensored) | $0.03 | $1.24 |
| [GLM-5.3 Abliterated](https://pentestllm.ai/models/glm-5.3-abliterated) | $0.07 | $2.79 |
| [Kimi K3.1 Pro Uncensored](https://pentestllm.ai/models/kimi-k3.1-pro-uncensored) | $0.04 | $1.63 |

| Model | Build | Input $/M | Output $/M |
| --- | --- | --- | --- |
| [GLM-5.3 Uncensored](https://pentestllm.ai/models/glm-5.3-uncensored) glm-5.3-uncensored | Uncensored | $0.282 | $0.846 |
| [GLM-5.3 Flash Uncensored](https://pentestllm.ai/models/glm-5.3-flash-uncensored) glm-5.3-flash-uncensored | Uncensored | $0.1053 | $0.3685 |
| [DeepSeek V4.1 Flash Abliterated](https://pentestllm.ai/models/deepseek-v4.1-flash-abliterated) deepseek-v4.1-flash-abliterated | Abliterated | $0.8488 | $1.6975 |
| [DeepSeek V4 Pro Uncensored](https://pentestllm.ai/models/deepseek-v4-pro-uncensored) deepseek-v4-pro-uncensored | Uncensored | $0.97 | $1.94 |
| [GLM-5.3 Abliterated](https://pentestllm.ai/models/glm-5.3-abliterated) glm-5.3-abliterated | Abliterated | $2.1825 | $4.365 |
| [Kimi K3.1 Pro Uncensored](https://pentestllm.ai/models/kimi-k3.1-pro-uncensored) kimi-k3.1-pro-uncensored | Uncensored | $1.164 | $5.82 |

Prices per million tokens, read from the live catalog on 2026-11-18.

If the agent’s job is mostly reviewing code for vulnerabilities, [the coding guide](https://pentestllm.ai/guides/uncensored-coding-ai) compares the code builds and prices a full day on each. [The AI pentesting page](https://pentestllm.ai/ai-pentesting) covers where an agent fits in an engagement.

## Confirm it works

Prove the key and the endpoint from the shell before you blame OpenClaw. The `-i` flag shows the response headers, which carry a request id and, on a non-streamed reply, the charge in USD.

```bash
curl -i https://api.pentestllm.ai/v1/chat/completions \
  -H "Authorization: Bearer $PENTESTLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "glm-5.3-uncensored", "max_tokens": 16, "messages": [{"role": "user", "content": "Reply with the single word ok."}]}'
```

## When something fails

- `${PENTESTLLM_API_KEY}` stays unresolved and the log warns about it: the variable is set in neither of the two places OpenClaw reads (a project-folder `.env` does not count). Export it, or add the line to `~/.openclaw/.env` and save.
- A ref like `pentestllm/glm-5.3-flash-uncensored` is rejected: that id has no `models[]` entry under the provider. Add one, even if it is only the `id`.
- `401 invalid_api_key`: bad or revoked key. Copy a fresh one from the console and verify which variable it ends up in.
- `402 insufficient_balance`: the balance cannot cover this call; add credit in the console. A `402 monthly_limit_reached` instead means the key reached the monthly spend ceiling you gave it.
- `404 model_not_found`: the id is not on the models page. Check the part of the ref after the slash.
- `429 rate_limited`: the key is over its rate limit. Read `retry-after` on the response.
- The Gateway will not come up after your edit: the file fails schema validation. OpenClaw rejects unknown keys, so recheck every field name, or let `openclaw doctor --fix` repair it.

## Sources

Field names and defaults come from OpenClaw’s [custom providers](https://docs.openclaw.ai/concepts/model-providers/custom-providers) documentation, read 2026-11-06. Prices come from the live catalog when the page renders.

## Questions

### What goes in openclaw.json for a custom OpenAI-compatible provider?

One models.providers.pentestllm entry in ~/.openclaw/openclaw.json: baseUrl https://api.pentestllm.ai/v1, api "openai-completions", apiKey "${PENTESTLLM_API_KEY}" and a models array. Then point agents.defaults.model.primary at pentestllm/<model-id>.

### Where does the key for an OpenClaw custom provider live?

In the environment variable that apiKey names, PENTESTLLM_API_KEY here. OpenClaw checks the process environment first and ~/.openclaw/.env second. It skips provider keys in a working-directory .env, and the key is never written into openclaw.json.

### I added the provider but OpenClaw says the model does not exist. Why?

Each model of a custom provider needs its own models[] entry with at least an id. agents.defaults.models only carries aliases and metadata; it registers nothing. Add the entry, save, and confirm with openclaw models list --provider pentestllm.

### Which of these models are OpenAI compatible?

All of them. Each id on the models page serves /v1/chat/completions in OpenAI format under one shared key, so any id can go into the models array, spelled as the page spells it. See the models page.

### How much does an OpenClaw session cost on this API?

You pay per token at the model’s listed price out of prepaid credit, with no subscription required. The table above prices a typical agent turn per build at the current rate. If a response reports cached input tokens, they are charged at that model’s discounted cache price where one exists.

Every model above is on the [uncensored model list](https://pentestllm.ai/models) with its live price per million tokens. [Per-token pricing](https://pentestllm.ai/pricing) sets the whole catalog side by side, and the [family directory](https://pentestllm.ai/uncensored) groups the builds by base model.

[Get a key](https://app.pentestllm.ai/console) Prepaid from $10, no subscription.

## New models and price changes, once a month.

New uncensored builds with their prices, price moves, and what the daily model check found.
