---
title: "Codex CLI custom provider for uncensored models"
canonical: https://unrestrictable.ai/guides/codex-cli
generated: 2026-11-16T02:57:36.819Z
source: https://unrestrictable.ai/guides/codex-cli
base_url: https://api.unrestrictable.ai/v1
---

# Codex CLI custom provider: an uncensored model in config.toml

Codex CLI on an uncensored model: the [model_providers] table in config.toml, a profile file per model, the /model menu trap, the cost of a run and the errors.

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

A custom model provider in Codex CLI is a table in `~/.codex/config.toml`: an address, the variable holding the key and the Responses wire API. With that table in place, an uncensored build drives Codex, billed per token from a prepaid balance. [OpenCode](https://unrestrictable.ai/guides/opencode) and [Cline](https://unrestrictable.ai/guides/cline) cover the same ids over Chat Completions.

## What you need

- Codex CLI installed.
- A key from the [console](https://app.unrestrictable.ai/console), exported in the shell you run Codex from.
- A model id from the [models page](https://unrestrictable.ai/models), spelled as the page spells it.

## Three steps to a first reply

1. Write the table into `config.toml`. Pick an id of your own for it, because `openai`, `ollama` and `lmstudio` are taken:

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

[model_providers.unrestrictable]
name = "Unrestrictable"
base_url = "https://api.unrestrictable.ai/v1"
env_key = "UNRESTRICTABLE_API_KEY"
wire_api = "responses"
```

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

```bash
export UNRESTRICTABLE_API_KEY="sk-unr-live-…"
codex
```

1. Type a prompt. Seconds later the console’s usage page lists the request with its token counts and its charge. A one-off run on a different id: `codex --model glm-5.3-flash-uncensored`.

To talk to the same models with nothing installed, open [/chat](https://unrestrictable.ai/chat) in the browser.

## Where the settings live

`~/.codex/config.toml` is the file Codex reads. A custom provider is one `[model_providers.<id>]` table inside it, holding a display name, a base URL, the name of the environment variable with the key, and the wire API. Codex talks Responses only; every build on the models page serves `/v1/responses`, so a single table reaches all of them. Profiles are separate files beside it, chosen with `--profile`.

## Each key, explained

- model_provider: unrestrictable names the table to use; without it Codex uses openai
- name: Unrestrictable what Codex displays for the provider
- base_url: https://api.unrestrictable.ai/v1 ending in /v1; Codex appends /responses itself
- env_key: UNRESTRICTABLE_API_KEY the variable holding the full sk-unr- key, which stays out of the file
- wire_api: responses the one value Codex takes, also the default, so the line may be omitted
- model: glm-5.3-uncensored an id from the models page, spelled exactly as listed

## One profile file per model

A profile lives at `~/.codex/<name>.config.toml` and holds only the keys that depart from `config.toml`. Launch with `--profile <name>` and Codex lays the file over the main one. Older guides put `[profiles.<name>]` tables in `config.toml` itself; the current reference describes separate files.

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

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

```bash
codex --profile unr-flash
codex exec --profile unr-flash "review this change"
```

One trap. While a custom provider is active, the `/model` menu offers Codex’s own 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). An id the models page does not carry then answers `404`. Recover by setting `model` in the file again, and switch with `--profile` or `--model` rather than the menu.

## Choosing the model

Input price dominates, because each turn sends the session and the tool output again. The table prices a single turn, 30,000 tokens in and 1,000 out, using the catalog on 2026-11-16. Where a model has a cached rate, a repeated prefix is charged as cached input.

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

| Model | Build | Input $/M | Output $/M |
| --- | --- | --- | --- |
| [GLM-5.3 Uncensored](https://unrestrictable.ai/models/glm-5.3-uncensored) glm-5.3-uncensored | Uncensored | $0.282 | $0.846 |
| [GLM-5.3 Flash Uncensored](https://unrestrictable.ai/models/glm-5.3-flash-uncensored) glm-5.3-flash-uncensored | Uncensored | $0.1053 | $0.3685 |
| [DeepSeek V4.1 Flash Abliterated](https://unrestrictable.ai/models/deepseek-v4.1-flash-abliterated) deepseek-v4.1-flash-abliterated | Abliterated | $0.8488 | $1.6975 |
| [DeepSeek V4 Pro Uncensored](https://unrestrictable.ai/models/deepseek-v4-pro-uncensored) deepseek-v4-pro-uncensored | Uncensored | $0.97 | $1.94 |
| [GLM-5.3 Abliterated](https://unrestrictable.ai/models/glm-5.3-abliterated) glm-5.3-abliterated | Abliterated | $2.1825 | $4.365 |
| [Kimi K3.1 Pro Uncensored](https://unrestrictable.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-16.

If the work is code, [the uncensored coding AI guide](https://unrestrictable.ai/guides/uncensored-coding-ai) sets the code builds side by side and prices a whole day on each.

## Test it

Before Codex, prove the key and the Responses route with curl. `-i` shows the headers: `x-uplink-request-id` identifies the request, and on a non-streamed reply `x-uplink-charge` states the cost in USD.

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

## When it fails

- `401 invalid_api_key`: the key is mistyped or revoked, or `UNRESTRICTABLE_API_KEY` was not set in the shell Codex started from. Export it and launch again.
- `402 insufficient_balance`: not enough balance for the call; add credit in the console. `402 monthly_limit_reached`: the key has reached the monthly limit you gave it.
- `404 model_not_found`: the id is not on the models page, usually because the `/model` menu rewrote a profile. Correct the `model` line in the file.
- `429 rate_limited`: your key’s own rate limit; `retry-after` in the response says when to try again.
- `wire_api = "chat"`, copied from an older guide: Codex rejects it now. Use `responses` or drop the line.
- A profile does nothing: it is still written as a `[profiles.<name>]` table inside `config.toml`. Move the keys to their own file, `~/.codex/<name>.config.toml`.
- Codex ignores the table: its id is a reserved one, or `model_provider` points at another id.

## Where the facts come from

Key and value names are those of Codex’s [Configuration Reference](https://learn.chatgpt.com/docs/config-file/config-reference), read 2026-11-06. Every price on this page is the live catalog’s at render time.

## Questions

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

A [model_providers.unrestrictable] table in ~/.codex/config.toml with name, base_url and env_key, plus model_provider = "unrestrictable" and a model id copied from the models page.

### Does a Codex custom provider need wire_api chat or responses?

responses, the only value Codex supports and its default, so the line is optional. A chat setting from an older guide fails now. Every model on the models page serves /v1/responses here.

### How does Codex find the API key for a custom provider?

Through the environment variable that env_key names. Set UNRESTRICTABLE_API_KEY in the shell before launching Codex; config.toml never contains the key.

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

A profile file per setup at ~/.codex/<name>.config.toml, launched with --profile <name>; or --model for a single run. Leave the /model menu alone while a custom provider is active.

### How much does Codex cost on this key?

Tokens times the model’s price, from a prepaid balance, no subscription needed. The table on this page prices one agent-sized turn per build at today’s rate.

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

[Get a key](https://app.unrestrictable.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.
