---
title: "Aider OpenAI compatible API setup for security models"
canonical: https://pentestllm.ai/guides/aider
generated: 2026-11-18T03:35:56.561Z
source: https://pentestllm.ai/guides/aider
base_url: https://api.pentestllm.ai/v1
---

# Aider on a security model: the OpenAI compatible API setup

Point aider at the API with two environment variables or .aider.conf.yml, prefix the model id with openai/, and silence the unknown-model line with a metadata file. Weak model, architect mode, what an edit turn costs and the errors you will meet.

Steps checked November 2, 2026 · prices as of November 17, 2026

You run aider because it edits files from the terminal without ceremony. The problem is the model behind it: ask a stock assistant to review a proof of concept against a host in your scope and it declines. Aider will use any OpenAI-compatible API, so swap the model. Set two environment variables, start aider with `--model openai/` plus an id from the models page, and a security-tuned or uncensored build does the editing. The same ids drop into [OpenCode](https://pentestllm.ai/guides/opencode), [Cursor](https://pentestllm.ai/guides/cursor) and [Claude Code](https://pentestllm.ai/guides/claude-code); the short version of this page is at [/agents/aider](https://pentestllm.ai/agents/aider).

## What you need

A key from the [console](https://app.pentestllm.ai/console) with credit on it, aider installed, and a repository you are allowed to work in: your own tooling, a client codebase under an engagement, or the files from a CTF challenge. Nothing else. Aider has no provider picker; it treats this API as an OpenAI endpoint at a different address.

Two environment variables do the routing. `OPENAI_API_BASE` is the address, `OPENAI_API_KEY` the credential, and the model goes on the command line behind an `openai/` prefix. That prefix is the whole trick: it tells aider to send the id to the base URL rather than look it up in its built-in list.

Everything the command line takes can live in a file instead. `.aider.conf.yml` takes each option as a YAML key and is read from three places, your home directory, then the git root, then the directory you launched from, with the later file overriding the earlier one. `--config <file>` reads a single file and nothing else. A `.env` in the same three places carries environment variables, `--env-file` names one elsewhere, and every flag doubles as an `AIDER_` variable (`AIDER_MODEL`, `AIDER_OPENAI_API_BASE`), which is handy in a shell profile on a testing VM.

A model aider has never heard of gets two more files: `.aider.model.metadata.json` for the window and the price, and `.aider.model.settings.yml` for the edit format and the helper models. Both are searched for in the same three directories or wherever `--model-metadata-file` and `--model-settings-file` point. Mid-session, `/model`, `/weak-model` and `/editor-model` swap models, and `/settings` shows the live configuration.

## First reply in two commands

1. Export the base URL and the key in the shell that will run aider. On Windows use `setx` in place of `export` and open a fresh shell afterwards:

```bash
export OPENAI_API_BASE=https://api.pentestllm.ai/v1
export OPENAI_API_KEY=sk-ptl-live-…
```

1. Launch aider inside the repository with the id behind `openai/`. Every id on the [models page](https://pentestllm.ai/models) goes in the same slot:

```bash
cd /to/your/project
aider --model openai/glm-5.3-uncensored
```

That is enough to work. `/add` the handler you are reviewing and ask where the input reaches a sink, or add a proof of concept for a target in scope and ask for a line-by-line read before you run it. If you would rather see the model answer before installing anything, the home page gives a few demo turns with no account, and the [playground](https://pentestllm.ai/playground) runs the same catalog from a browser.

1. Move the flags into `.aider.conf.yml` at the git root so you stop retyping them. `weak-model` is the build aider uses for commit messages and for summarising old chat history; a fast id keeps those calls cheap. Drop the `openai-api-key` line if the key is already exported:

```
# .aider.conf.yml, in the git root (or ~ for every project)
openai-api-base: https://api.pentestllm.ai/v1
openai-api-key: sk-ptl-live-…
model: openai/glm-5.3-uncensored
weak-model: openai/glm-5.3-flash-uncensored
```

1. On start, aider prints `Unknown context window size and costs, using sane defaults` because the id is not in its table. It runs anyway; it just cannot show you cost or window. Give it the figures in `.aider.model.metadata.json` beside the config, each entry named with the `openai/` prefix. The block below holds the catalog values for the three ids at the moment this page was built:

```
{
  "openai/glm-5.3-uncensored": {
    "input_cost_per_token": 0.000000282,
    "output_cost_per_token": 0.000000846,
    "litellm_provider": "openai",
    "mode": "chat"
  },
  "openai/glm-5.3-flash-uncensored": {
    "input_cost_per_token": 0.00000010528,
    "output_cost_per_token": 0.00000036848,
    "litellm_provider": "openai",
    "mode": "chat"
  },
  "openai/deepseek-v4.1-flash-abliterated": {
    "input_cost_per_token": 0.00000084875,
    "output_cost_per_token": 0.0000016975,
    "litellm_provider": "openai",
    "mode": "chat"
  }
}
```

1. Optional: pin edit format and helper models per id in `.aider.model.settings.yml`, so they survive a `/model` switch. `diff` is the search/replace format, which returns changed lines and nothing else:

```
- name: openai/glm-5.3-uncensored
  edit_format: diff
  weak_model_name: openai/glm-5.3-flash-uncensored
  editor_model_name: openai/deepseek-v4.1-flash-abliterated
  editor_edit_format: editor-diff
  use_repo_map: true
- name: openai/glm-5.3-flash-uncensored
  edit_format: diff
  use_repo_map: true
- name: openai/deepseek-v4.1-flash-abliterated
  edit_format: diff
  use_repo_map: true
```

1. Optional: architect mode, where the main model writes the plan; a second request hands that plan to the editor model, which produces the edit blocks. Two requests per turn, so the bill goes up, but it rescues a build that reasons well and botches the edit syntax. `/architect` in the chat applies it to one message:

```bash
aider --architect --model openai/glm-5.3-uncensored --editor-model openai/deepseek-v4.1-flash-abliterated
```

## Each setting, one line

- OPENAI_API_BASE: https://api.pentestllm.ai/v1 the address every request goes to, including the trailing /v1. In YAML it is openai-api-base; on the command line --openai-api-base
- OPENAI_API_KEY: the whole sk-ptl- key the bearer credential. YAML openai-api-key, flag --openai-api-key. Aider treats it as the OpenAI key, so it has to sit in this slot rather than --api-key
- --model: openai/glm-5.3-uncensored the main chat model. The prefix sends the request to the base URL; what follows it must match the models page character for character
- --weak-model: openai/glm-5.3-flash-uncensored handles commit messages and history summaries. Aider derives a default from the main model, which it cannot do for an id it does not know, so set it
- --architect / --editor-model: openai/deepseek-v4.1-flash-abliterated architect mode: the main model plans the change, the editor model writes the blocks. --editor-edit-format chooses editor-diff or editor-whole
- .aider.model.metadata.json: openai/<id> → window and cost max_input_tokens, max_output_tokens, input_cost_per_token and output_cost_per_token for each id. Kills the unknown-model warning and switches on the running cost
- .aider.model.settings.yml: openai/<id> → edit_format… edit_format, weak_model_name, editor_model_name, use_repo_map and the other ModelSettings keys for an id aider ships no entry for
- --show-model-warnings: true by default controls the unknown-model line. --no-show-model-warnings hides it with no metadata file, but then the cost readout stays dark

## Choosing the build

Aider speaks OpenAI chat requests, and every build in the catalog answers them. Picture one edit turn late in a review session: the system prompt, the repo map (aider holds it near `--map-tokens`, 1k by default, and lets it swell when the chat has no files), the files you brought in with `/add` and the whole conversation go up; a handful of search/replace blocks come back. Input dominates the cost, which is why a build with a cheap input rate wins per turn and why `/drop` and `/clear` are the fastest way to cut the next request.

Both `diff` and `whole` are plain text, so a build with no tool calling still edits files under aider. The tool-call column is there for when you reuse the same ids in [OpenCode](https://pentestllm.ai/guides/opencode) or [Cursor](https://pentestllm.ai/guides/cursor), whose agent loops depend on tool calls.

| Model | One edit turn | Tool calls |
| --- | --- | --- |
| [GLM-5.3 Uncensored](https://pentestllm.ai/models/glm-5.3-uncensored) | $0.01 | [model page](https://pentestllm.ai/models/glm-5.3-uncensored) |
| [GLM-5.3 Flash Uncensored](https://pentestllm.ai/models/glm-5.3-flash-uncensored) | $0.0047 | [model page](https://pentestllm.ai/models/glm-5.3-flash-uncensored) |
| [DeepSeek V4.1 Flash Abliterated](https://pentestllm.ai/models/deepseek-v4.1-flash-abliterated) | $0.04 | [model page](https://pentestllm.ai/models/deepseek-v4.1-flash-abliterated) |
| [DeepSeek V4 Pro Uncensored](https://pentestllm.ai/models/deepseek-v4-pro-uncensored) | $0.04 | [model page](https://pentestllm.ai/models/deepseek-v4-pro-uncensored) |
| [GLM-5.3 Abliterated](https://pentestllm.ai/models/glm-5.3-abliterated) | $0.09 | [model page](https://pentestllm.ai/models/glm-5.3-abliterated) |
| [GLM-5.3 Flash Code Uncensored](https://pentestllm.ai/models/glm-5.3-flash-code-uncensored) | $0.25 | [model page](https://pentestllm.ai/models/glm-5.3-flash-code-uncensored) |

Costed at 40,000 input tokens and 1,200 output tokens, catalog prices of 2026-11-17. The tool-call column repeats what the catalog publishes; a blank means the model page has the answer.

| 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 |
| [GLM-5.3 Flash Code Uncensored](https://pentestllm.ai/models/glm-5.3-flash-code-uncensored) glm-5.3-flash-code-uncensored | Uncensored | $6.00 | $6.00 |

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

For a whole day of exploit development or tooling work, [the uncensored coding AI guide](https://pentestllm.ai/guides/uncensored-coding-ai) puts the code builds next to each other with a day’s cost on each. The common pairing is a strong id as `--model` and a fast one as `--weak-model`; the metadata file is what lets aider tally the session as you go.

## Prove it works

Ask the API which models your key may call. Each id you plan to put behind `openai/` has to appear in this list:

```bash
curl https://api.pentestllm.ai/v1/models -H "Authorization: Bearer sk-ptl-live-…"
```

Next, fire one request shaped like aider’s own. The `-i` flag shows the response headers, which carry the request id and, when the answer is not streamed, the charge in USD.

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

Inside aider, the opening lines name the main model, the edit format in use and the weak model. `/settings` dumps the full configuration; `/tokens` sizes the next request file by file, useful before you add a large scan output. Send one message with a file attached, then open the console’s usage page: the request is there with its token counts and its charge.

## When it breaks

- `401 invalid_api_key`: wrong or revoked key, or `OPENAI_API_KEY` was never exported in the shell that launched aider. Re-export it or paste it fresh from the console. A key under `api-key:` in the YAML lands in the wrong slot; it has to be `openai-api-key:`.
- `404 model_not_found`: whatever follows `openai/` is not an id on the models page. Compare it character by character; the id is everything after the prefix.
- `402 insufficient_balance`: not enough credit for this request; top up in the console. `402 monthly_limit_reached`: the key reached the monthly cap you gave it.
- `403 scope_denied`: this key is restricted to a set of models and the one you asked for is outside it.
- `429 rate_limited`: the key is over its rate limit. Read `retry-after` on the response.
- `Unknown context window size and costs, using sane defaults`: aider has no entry for the id. Not an error; it assumes a boundless window and a free model. Step 4’s metadata file fixes both, or `--no-show-model-warnings` hides the line.
- Aider offers a look-alike model name instead of starting on yours: you left off `openai/`. Without the prefix aider searches its own catalog; with it, the id goes to the base URL.
- `Failed to apply edit to <file>`: the model broke the edit format. Aider’s own remedies, in order: a stronger build, `--edit-format whole`, architect mode so a second model handles the edits, and fewer files in the chat (`/drop`, `/clear`, with `/tokens` to measure). Aider’s docs mark roughly 25k tokens of context as the point where many models start to slip.
- `.aider.model.settings.yml` seems ignored: `name` must be the prefixed string, `openai/glm-5.3-uncensored`, not the bare id.

## Questions

### Can aider talk to an OpenAI compatible API that is not OpenAI?

Yes. Point OPENAI_API_BASE at the endpoint, put the key in OPENAI_API_KEY, and write the model as openai/<id>; aider sends OpenAI-format chat requests there. This API is such an endpoint, so those two variables plus the prefix are the complete setup, and the YAML keys hold the same values on disk.

### How do I get rid of the unknown context window and costs line?

Create .aider.model.metadata.json with one entry per openai/<id> carrying max_input_tokens, max_output_tokens, input_cost_per_token and output_cost_per_token. With those in place aider reports the running session cost. --no-show-model-warnings only hides the line and gives you no figures.

### Which edit format suits these builds?

Begin with diff, the search/replace format: it sends back changed lines only. If a build keeps producing edits aider cannot apply, move to --edit-format whole, which returns the complete file at a higher output cost, or run --architect so a separate editor model writes the blocks.

### What will an aider session cost me?

Tokens at the model’s listed price, drawn from prepaid credit, no subscription required. The table above prices one edit-sized turn per build at the live rate; commit messages and summaries go to the weak model at its own cheaper rate. See the models page.

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.
