# Connect an agent to Oathbreaker

> Setup instructions for an AI agent, or a script, that a person has asked to connect a coding tool to Oathbreaker AI: a prepaid, OpenAI-compatible API for abliterated open-weight models. Do the steps in order.

This file is generated from the service's current configuration. Prices and every limit are in https://oathbreaker.ai/llms.txt.

## Rules

- Base URL: `https://oathbreaker.ai/v1`. The host is `oathbreaker.ai`, with no `api.` or other subdomain. Do not append a second `/v1`.
- The API key is the person's secret. Do not ask them to paste it to you, and do not write it into a file, a command argument or your own output. Every setup below reads it from the `OATHBREAKER_API_KEY` environment variable.
- Say which files you will change before you change them. If a settings file already exists, merge into it. Do not replace it.
- Requests are paid from prepaid credit. A request the account cannot pay for is refused with HTTP 402 `insufficient_credit`, and nothing is charged.

## Steps

1. Find the tool. Ask the person which coding tool they use, or check which of these commands exist: `claude`, `codex`, `opencode`, `openclaw`, `hermes`.
2. Get the key into the environment. The person creates a key in their console, https://oathbreaker.ai/dashboard, under API keys. A key is shown once, when it is made. They then set it at a hidden prompt in the terminal the tool starts from. Bash or Zsh:

   ```
   printf 'Oathbreaker API key: '; read -rs OATHBREAKER_API_KEY; export OATHBREAKER_API_KEY; printf '\n'
   ```

   PowerShell 7.2 or later:

   ```
   $env:OATHBREAKER_API_KEY = Read-Host -MaskInput "Oathbreaker API key"
   ```

   If you cannot show the person a prompt, ask them to run that line themselves and to tell you when it is done.
3. Apply the setup for their tool from "Tools" below. A tool sees the key only if it is started from that terminal after the key is set, so a tool that is already running has to be started again.
4. Run the tool's check. It sends one small request (`Reply with OK`), which costs a fraction of a cent.
5. Tell the person which files you changed, which model is selected and whether the check passed.

## Models

Default model: `oathbreaker-glm-5.3`. For background or bulk work: `oathbreaker-glm-5.3-flash`.

- `oathbreaker-glm-5.3`: plan for a context window of 131,072 tokens and at most 32,768 output tokens per request. Function calling works.
- `oathbreaker-glm-5.3-flash`: plan for a context window of 131,072 tokens and at most 32,768 output tokens per request. Function calling works.
- `oathbreaker-deepseek-v4.1-flash`: plan for a context window of 65,536 tokens and at most 32,768 output tokens per request. Function calling works.
- `oathbreaker-deepseek-v4.1-flash-fast`: plan for a context window of 65,536 tokens and at most 32,768 output tokens per request. Function calling works.
- `oathbreaker-kimi-k3.1-pro`: plan for a context window of 524,288 tokens and at most 24,576 output tokens per request. Function calling works.

`GET https://oathbreaker.ai/v1/models` returns this list, with prices, and needs no key.

## Tools

The numbered instructions under each tool are the ones a person would follow by hand. Do them for the person where you can, except entering the key.

### Claude Code

1. In your terminal, run this and paste your key when it asks. The key stays out of your shell history.

   ```
   printf 'Oathbreaker API key: '; read -rs OATHBREAKER_API_KEY; export OATHBREAKER_API_KEY; printf '\n'
   ```

2. In the same terminal, point Claude Code at Oathbreaker.

   ```
   export ANTHROPIC_BASE_URL=https://oathbreaker.ai
   export ANTHROPIC_AUTH_TOKEN="$OATHBREAKER_API_KEY"
   export ANTHROPIC_MODEL=oathbreaker-glm-5.3
   export ANTHROPIC_DEFAULT_OPUS_MODEL=oathbreaker-glm-5.3
   export ANTHROPIC_DEFAULT_SONNET_MODEL=oathbreaker-glm-5.3
   export ANTHROPIC_DEFAULT_HAIKU_MODEL=oathbreaker-glm-5.3-flash
   export CLAUDE_CODE_AUTO_COMPACT_WINDOW=100000
   ```

Check: `claude -p "Reply with OK"`

Full guide: https://oathbreaker.ai/agents/claude-code

### Codex

1. In your terminal, run this and paste your key when it asks. The key stays out of your shell history.

   ```
   printf 'Oathbreaker API key: '; read -rs OATHBREAKER_API_KEY; export OATHBREAKER_API_KEY; printf '\n'
   ```

2. Add this to ~/.codex/config.toml.

   ```
   model = "oathbreaker-glm-5.3"
   model_provider = "oathbreaker"
   model_context_window = 131072
   model_auto_compact_token_limit = 91750

   [model_providers.oathbreaker]
   name = "Oathbreaker"
   base_url = "https://oathbreaker.ai/v1"
   env_key = "OATHBREAKER_API_KEY"
   wire_api = "responses"
   ```

Check: `codex exec "Reply with OK"`

Full guide: https://oathbreaker.ai/agents/codex

### OpenCode

1. In your terminal, run this and paste your key when it asks. The key stays out of your shell history.

   ```
   printf 'Oathbreaker API key: '; read -rs OATHBREAKER_API_KEY; export OATHBREAKER_API_KEY; printf '\n'
   ```

2. Save this as ~/.config/opencode/opencode.json. This is the OpenCode 1.x format; the guide has 2.x.

   ```
   {
     "provider": {
       "oathbreaker": {
         "name": "Oathbreaker",
         "npm": "@ai-sdk/openai-compatible",
         "options": {
           "baseURL": "https://oathbreaker.ai/v1",
           "apiKey": "{env:OATHBREAKER_API_KEY}"
         },
         "models": {
           "oathbreaker-glm-5.3": {
             "name": "oathbreaker-glm-5.3",
             "tool_call": true,
             "limit": {
               "context": 131072,
               "output": 32768
             }
           },
           "oathbreaker-glm-5.3-flash": {
             "name": "oathbreaker-glm-5.3-flash",
             "tool_call": true,
             "limit": {
               "context": 131072,
               "output": 32768
             }
           },
           "oathbreaker-deepseek-v4.1-flash": {
             "name": "oathbreaker-deepseek-v4.1-flash",
             "tool_call": true,
             "limit": {
               "context": 65536,
               "output": 32768
             }
           },
           "oathbreaker-deepseek-v4.1-flash-fast": {
             "name": "oathbreaker-deepseek-v4.1-flash-fast",
             "tool_call": true,
             "limit": {
               "context": 65536,
               "output": 32768
             }
           },
           "oathbreaker-kimi-k3.1-pro": {
             "name": "oathbreaker-kimi-k3.1-pro",
             "tool_call": true,
             "limit": {
               "context": 524288,
               "output": 24576
             }
           }
         }
       }
     }
   }
   ```

Check: `opencode run --model oathbreaker/oathbreaker-glm-5.3 "Reply with OK"`

Full guide: https://oathbreaker.ai/agents/opencode

### OpenClaw

1. Install Oathbreaker's provider plugin.

   ```
   openclaw plugins install openclaw-oathbreaker
   ```

2. Start onboarding and paste your key when it asks.

   ```
   openclaw onboard --auth-choice oathbreaker-api-key
   ```

Check: `openclaw infer model run --prompt "Reply with OK"`

Full guide: https://oathbreaker.ai/agents/openclaw

### Hermes

1. Outside any Hermes conversation, run this and choose Custom endpoint.

   ```
   hermes model
   ```

2. API base URL. Then paste your key at Hermes's masked prompt and choose Chat Completions.

   ```
   https://oathbreaker.ai/v1
   ```

3. Model.

   ```
   oathbreaker-glm-5.3
   ```

4. Context length.

   ```
   131072
   ```

Check: start a new conversation in the tool and send `Reply with OK`.

Full guide: https://oathbreaker.ai/agents#hermes

### Other / curl

1. Any OpenAI-compatible client works. Base URL:

   ```
   https://oathbreaker.ai/v1
   ```

2. Model:

   ```
   oathbreaker-glm-5.3
   ```

3. In your terminal, run this and paste your key when it asks. The key stays out of your shell history.

   ```
   printf 'Oathbreaker API key: '; read -rs OATHBREAKER_API_KEY; export OATHBREAKER_API_KEY; printf '\n'
   ```

4. Then send a request with curl.

   ```
   curl https://oathbreaker.ai/v1/chat/completions \
     -H "Authorization: Bearer $OATHBREAKER_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{"model":"oathbreaker-glm-5.3-flash","messages":[{"role":"user","content":"Reply with OK"}],"max_tokens":256}'
   ```

Check: the request above returns a JSON reply with the model's answer.

Full guide: https://oathbreaker.ai/docs#quickstart

## If the check fails

- HTTP 401 `invalid_api_key`: the key is missing from the environment, mistyped or revoked. Ask the person to set it again. Never ask them to send it to you.
- HTTP 402 `insufficient_credit`: the account has no credit for the request. Show the person the whole error message, because it says where to add credit. Run the check again after they have paid.
- HTTP 404, or the host cannot be found: the base URL is wrong. It is `https://oathbreaker.ai/v1`, on the host `oathbreaker.ai`.
- HTTP 400 `context_limit` (`context_length_exceeded` on the Responses API, which Codex uses), or "prompt is too long": the conversation is larger than the model's window. Start a new conversation and use the context windows listed under "Models".
- HTTP 429: wait for the number of seconds in the `Retry-After` header, then try once more.
- Anything else: the error's `message` says what happened. The API reference is https://oathbreaker.ai/docs and support is support@oathbreaker.ai. Never include the key.
