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 17, 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 or Cline.

What you need

  • Codex CLI installed and codex on your PATH.
  • A key from the console, with some prepaid credit on it.
  • A model id from the models page. The builds tagged security are tuned for this work; auto/security 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:
config.toml
1# ~/.codex/config.toml
2model = "glm-5.3-uncensored"
3model_provider = "pentestllm"
4
5[model_providers.pentestllm]
6name = "PentestLLM"
7base_url = "https://api.pentestllm.ai/v1"
8env_key = "PENTESTLLM_API_KEY"
9wire_api = "responses"
  1. Make a key in the console, export it in the shell you will run Codex from, and launch:
shell
1export PENTESTLLM_API_KEY="sk-ptl-live-…"
2codex
  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 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.

ptl-flash.config.toml
1# ~/.codex/ptl-flash.config.toml
2model_provider = "pentestllm"
3model = "glm-5.3-flash-uncensored"
ptl-pro.config.toml
1# ~/.codex/ptl-pro.config.toml
2model_provider = "pentestllm"
3model = "deepseek-v4-pro-uncensored"
shell
1codex --profile ptl-flash
2codex 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, 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-17. When a session repeats a prefix, the cached input tokens bill at the build’s cached rate where it publishes one.

ModelOne turn40 turns
GLM-5.3 Uncensored$0.0093$0.37
GLM-5.3 Flash Uncensored$0.0035$0.14
DeepSeek V4.1 Flash Abliterated$0.03$1.09
DeepSeek V4 Pro Uncensored$0.03$1.24
GLM-5.3 Abliterated$0.07$2.79
Kimi K3.1 Pro Uncensored$0.04$1.63
Uncensored models and their prices per million tokens
GLM-5.3 Uncensoredglm-5.3-uncensoredUncensored$0.282$0.846
GLM-5.3 Flash Uncensoredglm-5.3-flash-uncensoredUncensored$0.1053$0.3685
DeepSeek V4.1 Flash Abliterateddeepseek-v4.1-flash-abliteratedAbliterated$0.8488$1.6975
DeepSeek V4 Pro Uncensoreddeepseek-v4-pro-uncensoredUncensored$0.97$1.94
GLM-5.3 Abliteratedglm-5.3-abliteratedAbliterated$2.1825$4.365
Kimi K3.1 Pro Uncensoredkimi-k3.1-pro-uncensoredUncensored$1.164$5.82

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

For code-heavy work such as reviewing a target’s source for bugs, the uncensored coding AI guide 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.

shell
1curl -i https://api.pentestllm.ai/v1/responses \
2 -H "Authorization: Bearer $PENTESTLLM_API_KEY" \
3 -H "Content-Type: application/json" \
4 -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 as read on 2026-11-06. Prices come from the live catalog when the page renders.

Questions

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.

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.

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

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.

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 with its live price per million tokens. Per-token pricing sets the whole catalog side by side, and the family directory groups the builds by base model.

Get a keyPrepaid 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.

Help