# How do I use an uncensored model in Claude Code or the Codex CLI?

_Updated November 18, 2026. https://openuncensored.com/claude-code-codex-uncensored-model_

**Short answer:** Point the tool at OpenUncensored, which serves the Anthropic Messages API that Claude Code uses and the OpenAI Responses API that Codex uses, so no proxy is needed. For **Claude Code**, set `ANTHROPIC_BASE_URL=https://api.openuncensored.com` (no `/v1`), your key as `ANTHROPIC_API_KEY`, and an uncensored model id in `ANTHROPIC_MODEL` and the background model variables. For **Codex**, add a model provider with `base_url = "https://api.openuncensored.com/v1"` and `wire_api = "responses"`. The best uncensored model for agents right now is [GLM 5.3 Flash Uncensored](https://openuncensored.com/models/glm-5.3-flash-uncensored) (`glm-5.3-flash-uncensored`).

## Claude Code, direct

Buy a prepaid key on the [credits page](https://openuncensored.com/credits) with no account (the key is the account), or point your agent at [agents.md](https://openuncensored.com/agents.md) and let it buy one.

```bash
export ANTHROPIC_BASE_URL=https://api.openuncensored.com
export ANTHROPIC_API_KEY=ou-...
export ANTHROPIC_MODEL=glm-5.3-flash-uncensored
export ANTHROPIC_DEFAULT_OPUS_MODEL=$ANTHROPIC_MODEL
export ANTHROPIC_DEFAULT_SONNET_MODEL=$ANTHROPIC_MODEL
export ANTHROPIC_DEFAULT_HAIKU_MODEL=$ANTHROPIC_MODEL
export CLAUDE_CODE_SUBAGENT_MODEL=$ANTHROPIC_MODEL
claude
```

- The base URL has no `/v1`: Claude Code adds `/v1/messages` itself.
- Claude Code also calls smaller models for background work and subagents. The `ANTHROPIC_DEFAULT_*` and `CLAUDE_CODE_SUBAGENT_MODEL` variables point those at the same uncensored model; without them it asks for a Claude model and fails.
- Tool calls, file edits, shell commands, images and streaming work. Prompt caching is automatic and `/cost` shows the cached tokens.

## Codex, direct

config.toml:

```toml
# ~/.codex/config.toml
[model_providers.openuncensored]
name = "OpenUncensored"
base_url = "https://api.openuncensored.com/v1"
env_key = "OU_API_KEY"
wire_api = "responses"

[profiles.uncensored]
model_provider = "openuncensored"
model = "glm-5.3-flash-uncensored"
```

run:

```bash
export OU_API_KEY=ou-...
codex --profile uncensored
```

Codex speaks the OpenAI Responses API, which the same key serves at `/v1/responses`. File edits, shell commands and multi-step tasks work as usual.

## Or keep Claude as the agent

To keep Claude as the agent and hand only some requests to an uncensored model, add the OpenUncensored MCP server. Claude gets tools to list models, read the rankings and send a prompt to any of them, billed to your key.

```bash
claude mcp add --transport http open-uncensored https://openuncensored.com/mcp \
  --header "Authorization: Bearer ou-..."
```

## Best uncensored models for agents

| Model | Model id | Agentic | Agent tasks | Speed | $ / 1M in · out |
|---|---|---|---|---|---|
| [GLM 5.3 Flash Uncensored](https://openuncensored.com/models/glm-5.3-flash-uncensored) | `glm-5.3-flash-uncensored` | 66 | 3/5 | 178 tok/s | $0.12 · $0.50 |
| [DeepSeek V4.1 Flash 1017 Uncensored](https://openuncensored.com/models/deepseek-v4.1-flash-1017-uncensored) | `deepseek-v4.1-flash-1017-uncensored` | 55 | 2/5 | 239 tok/s | $0.33 · $1.32 |
| [MiMo V2.6 Flash Uncensored](https://openuncensored.com/models/mimo-v2.6-flash-uncensored) | `mimo-v2.6-flash-uncensored` | 55 | 2/5 | 118 tok/s | $0.46 · $1.50 |
| [DeepSeek V4.1 Flash 0910 Uncensored](https://openuncensored.com/models/deepseek-v4.1-flash-0910-uncensored) | `deepseek-v4.1-flash-0910-uncensored` | 53 | 2/5 | 209 tok/s | $0.33 · $1.32 |
| [GLM 5.3 Uncensored](https://openuncensored.com/models/glm-5.3-uncensored) | `glm-5.3-uncensored` | 53 | 2/5 | 117 tok/s | $0.39 · $1.32 |
| [MiMo V2.6 Flash Abliterated](https://openuncensored.com/models/mimo-v2.6-flash-abliterated) | `mimo-v2.6-flash-abliterated` | 53 | 2/5 | 99 tok/s | $0.50 · $1.50 |

_Ranked models at 50+ tokens per second, by agentic score: five multi-step tool tasks, scored on finishing without loops or crashes._

## If it doesn't work

- **Claude Code says the model does not exist:** set the four background model variables above.
- **The agent loops on one tool call:** switch to a model with more agent tasks finished in the table above.
- **Tool calls arrive as plain text:** the model is not following the tool format; try another model.
- **`402`:** the key is out of credit. Top it up on the [credits page](https://openuncensored.com/credits).

## FAQ

### How do I use an uncensored model in Claude Code or the Codex CLI?

Point the tool at OpenUncensored, which serves the Anthropic Messages API that Claude Code uses and the OpenAI Responses API that Codex uses, so no proxy is needed. For **Claude Code**, set `ANTHROPIC_BASE_URL=https://api.openuncensored.com` (no `/v1`), your key as `ANTHROPIC_API_KEY`, and an uncensored model id in `ANTHROPIC_MODEL` and the background model variables. For **Codex**, add a model provider with `base_url = "https://api.openuncensored.com/v1"` and `wire_api = "responses"`. The best uncensored model for agents right now is [GLM 5.3 Flash Uncensored](https://openuncensored.com/models/glm-5.3-flash-uncensored) (`glm-5.3-flash-uncensored`).

### Do I need a proxy like LiteLLM?

No. The API serves the Anthropic Messages API and the OpenAI Responses API natively, so both tools connect directly.

### Which uncensored model is best in Claude Code?

GLM 5.3 Flash Uncensored (`glm-5.3-flash-uncensored`): the highest agentic score among ranked models fast enough for agent loops. Other good options are in the table on this page.

### Does prompt caching work?

Yes. The hosts cache the conversation on their own, cached input is billed at the lower cached rate, and Claude Code's `/cost` shows it.

### Do I need an account?

No. Buy a prepaid key on the [credits page](https://openuncensored.com/credits) and use it as the API key. The key is the account, and it cannot spend more than you loaded.

More: [best uncensored LLM API](https://openuncensored.com/best-uncensored-llm-api), [cheapest](https://openuncensored.com/cheapest-uncensored-llm-api), [leaderboard](https://openuncensored.com/uncensored-llm-leaderboard).
