---
title: "Codex CLI custom provider: run an uncensored model"
canonical: https://pentestllm.ai/guides/codex-cli
generated: 2026-11-18T03:35:51.603Z
source: https://pentestllm.ai/guides/codex-cli
base_url: https://api.pentestllm.ai/v1
---

# Codex CLI custom provider for security-tuned models

A [model_providers] table in ~/.codex/config.toml: base_url, env_key, wire_api responses, model on a security build. A profile per model; the /model menu trap.

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

If Codex refuses to look at the exploit you were hired to validate, change the model under it. It accepts a custom provider in `~/.codex/config.toml`: a base URL, the variable that carries your key, and the Responses wire API. One table later it runs a security-tuned or uncensored build from prepaid credit, billed per token. Prefer a Chat Completions client on the same ids? See [OpenCode](https://pentestllm.ai/guides/opencode) or [Cline](https://pentestllm.ai/guides/cline).

## What you need

- Codex CLI installed and `codex` on your PATH.
- A key from the [console](https://app.pentestllm.ai/console), with some prepaid credit on it.
- A model id from the [models page](https://pentestllm.ai/models). The builds tagged security are tuned for this work; [auto/security](https://pentestllm.ai/auto-router) chooses one per request.

## The one file Codex reads

Everything lives in `~/.codex/config.toml`. A custom provider is one `[model_providers.<id>]` table in that file: a label, the base URL, the name of the variable holding your key, and the wire API. Codex talks the Responses API and nothing else; every id on the models page answers `/v1/responses` here, so a single table serves the whole catalog. Profiles are separate files beside it, picked with `--profile`.

## Shortest path to a first reply

1. Write the table into `config.toml`. Pick a provider id of your own; `openai`, `ollama` and `lmstudio` are taken:

```
# ~/.codex/config.toml
model = "glm-5.3-uncensored"
model_provider = "pentestllm"

[model_providers.pentestllm]
name = "PentestLLM"
base_url = "https://api.pentestllm.ai/v1"
env_key = "PENTESTLLM_API_KEY"
wire_api = "responses"
```

1. Make a key in the [console](https://app.pentestllm.ai/console), export it in the shell you will run Codex from, and launch:

```bash
export PENTESTLLM_API_KEY="sk-ptl-live-…"
codex
```

1. Give it a task: a severity-ranked summary of a scan file from an engagement you are on, say. The request reaches the console’s usage page within seconds, with token counts and charge. To run once on a different id: `codex --model glm-5.3-flash-uncensored`.

Want to test the model before touching a config file? The home page offers a few free demo turns, and the [playground](https://pentestllm.ai/playground) runs any id on a key.

## The settings, one by one

- model_provider: pentestllm names the table to use; without it Codex falls back to openai
- name: PentestLLM the label Codex prints for this provider
- base_url: https://api.pentestllm.ai/v1 ends in /v1; Codex appends /responses on its own
- env_key: PENTESTLLM_API_KEY the variable holding the full sk-ptl- key, so the key itself stays out of the file
- wire_api: responses the sole accepted value and the default; you may omit the line
- model: glm-5.3-uncensored an id copied from the models page, spelled exactly as shown

## One profile file per build

A profile is `~/.codex/<name>.config.toml`, holding just the keys that differ from the main file. Launch with `--profile <name>` and Codex merges it over `config.toml`. Older write-ups put `[profiles.<name>]` tables inside `config.toml`; the current reference documents separate files instead.

```
# ~/.codex/ptl-flash.config.toml
model_provider = "pentestllm"
model = "glm-5.3-flash-uncensored"
```

```
# ~/.codex/ptl-pro.config.toml
model_provider = "pentestllm"
model = "deepseek-v4-pro-uncensored"
```

```bash
codex --profile ptl-flash
codex exec --profile ptl-flash "review poc.py for the CVE it claims to exploit and list the preconditions"
```

One trap. While a custom provider is active, the `/model` menu still shows Codex’s built-in models rather than yours, and choosing one overwrites the `model` line of the active profile ([openai/codex issue #35487](https://github.com/openai/codex/issues/35487), read 2026-11-06). The next request then asks this API for an id it does not have and gets a `404`. Recover by setting `model` back in the file. Switch builds with `--profile` or `--model` instead of the menu.

## Which build, and what a session costs

Each agent turn resends the whole session plus every tool result, so input tokens dominate the bill. The cost column prices one turn of 30,000 tokens in and 1,000 out at the catalog prices on 2026-11-18. When a session repeats a prefix, the cached input tokens bill at the build’s cached rate where it publishes one.

| Model | One turn | 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.

For code-heavy work such as reviewing a target’s source for bugs, [the uncensored coding AI guide](https://pentestllm.ai/guides/uncensored-coding-ai) ranks the code builds and prices a full day on each.

## Prove the key outside Codex

Before blaming the config, hit the Responses path with curl. `-i` shows the headers, which carry a request id and, when the answer is not streamed, the charge in USD.

```bash
curl -i https://api.pentestllm.ai/v1/responses \
  -H "Authorization: Bearer $PENTESTLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "glm-5.3-uncensored", "input": "Reply with the single word ok."}'
```

## When it breaks

- `401 invalid_api_key`: the key is bad or revoked, or `PENTESTLLM_API_KEY` was empty in the shell where Codex started. Export it and relaunch.
- `402 insufficient_balance`: credit ran out; add some in the console. `402 monthly_limit_reached`: you hit the monthly cap you set on the key.
- `404 model_not_found`: the id is not on the models page, usually because the `/model` menu rewrote a profile. Correct the `model` line.
- `429 rate_limited`: the key is over its rate limit. Wait for the `retry-after` value in the response.
- `wire_api = "chat"` copied from an old guide: Codex rejects it now. Use `responses` or remove the line.
- The profile does nothing: it is still written as a `[profiles.<name>]` table in `config.toml`. Move those keys to `~/.codex/<name>.config.toml`.
- Codex ignores the table: the id collides with a reserved name, or `model_provider` points at another id.

## Where this comes from

Every key and value above matches Codex’s [Configuration Reference](https://learn.chatgpt.com/docs/config-file/config-reference) as read on 2026-11-06. Prices come from the live catalog when the page renders.

## Questions

### What goes in config.toml for a Codex CLI custom provider?

One [model_providers.pentestllm] table carrying name, base_url and env_key, plus model_provider = "pentestllm" and a model line with an id from the models page.

### Is wire_api chat or responses?

responses. It is the only value Codex supports and also the default, so the line is optional. Setting chat, as some older guides do, fails now. Every id on the models page answers /v1/responses on this API.

### How does Codex get the API key?

Through the environment variable that env_key names. Export PENTESTLLM_API_KEY in the shell before starting Codex; config.toml never holds the key.

### What is the right way to change models in Codex CLI?

One profile file per setup at ~/.codex/<name>.config.toml, started with --profile <name>; or --model for a single run. Stay out of the /model menu while a custom provider is selected.

### How is a Codex session billed here?

Per token at the build’s catalog price, drawn from prepaid credit, with no subscription required. The table on this page prices one agent-sized turn and a longer session on each build.

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.
