How to use Unlid in Codex CLI

Connect Codex CLI to Unlid: create an API key, point Codex CLI at the base URL below and pick a model id. The same settings work for every Unlid model.

Use Unlid in your apps

Any app that lets you add an OpenAI-compatible provider can use every Unlid model. You always need the same three things:

Base URLhttps://api.unlid.ai/v1
API keyCreate one under Account → API keys. It starts with ul- and is shown once.
ModelAn id from Models, e.g. glm-5.3-flash-uncensored. Most apps fetch the list for you.

Three rules cover almost every setup problem:

  • Enter the base URL with /v1 and without /chat/completions — the app adds that itself. (Janitor AI and goose are the exceptions, below.)
  • When an app asks for the API type, pick OpenAI Compatible / Chat Completions. That is Unlid’s native protocol. The Anthropic (/v1/messages) and OpenAI Responses (/v1/responses) endpoints exist for Claude Code and Codex, which speak nothing else; they are translated to chat completions and cover less.
  • If the app has a context window setting, fill it in from the model page (glm-5.3-flash-uncensored: 262,144 tokens). A default that is too small cuts long chats; one that is too big ends in context_length_exceeded.

Not sure your key works? Run this from the same computer first — it is the fastest way to tell an app problem from a network problem:

curl https://api.unlid.ai/v1/models -H "Authorization: Bearer ul-…"

Codex CLI

Codex talks to Unlid’s Responses endpoint https://api.unlid.ai/v1/responses. Add a provider to ~/.codex/config.toml and export UNLID_API_KEY=ul-…:

model = "glm-5.3-flash-uncensored"
model_provider = "unlid"
model_context_window = 262144
model_reasoning_effort = "medium"

[model_providers.unlid]
name = "Unlid"
base_url = "https://api.unlid.ai/v1"
env_key = "UNLID_API_KEY"
wire_api = "responses"
  • base_url includes /v1; Codex adds /responses. Switch models with codex -m glm-5.3-flash-abliterated or /model. Codex warns that the model id is unknown and uses generic settings — expected.
  • Codex sends store: false and the whole conversation on every turn, which is what Unlid supports. previous_response_id (server-side conversation state) is refused with a 400.
  • Works: streaming, function tools (shell / exec, apply_patch, MCP tools), images, reasoning effort (none turns thinking off where the model allows it). The hosted web_search tool is left out, so the model cannot search the web from Codex.

Something not working? See troubleshooting, or set up another app.