Codex CLI with UberLLM: run OpenAI’s coding agent on any model
Export UBERLLM_API_KEY, then add a [model_providers.uberllm] table to ~/.codex/config.toml with base_url https://api.uberllm.dev/v1, env_key UBERLLM_API_KEY and wire_api "responses", and set model_provider = "uberllm" plus the model id. UberLLM serves the Responses API Codex calls, so shell commands, file edits and multi-step tasks work on every chat model.
Steps
- Make a key on your keys page and add credit.
- Install Codex if you do not have it:
npm install -g @openai/codex. - Put the key in your shell profile (
~/.zshrcor~/.bashrc) and open a new terminal:
export UBERLLM_API_KEY="ull_..."
- Open
~/.codex/config.toml(create it if it is missing) and add:
model = "moonshotai/kimi-k3"
model_provider = "uberllm"
web_search = "disabled"
[model_providers.uberllm]
name = "UberLLM"
base_url = "https://api.uberllm.dev/v1"
env_key = "UBERLLM_API_KEY"
wire_api = "responses"
- Run
codexin a project folder and give it a task.
Keep base_url ending in /v1: Codex adds /responses to it. env_key is the name of the variable, not the key itself.
Switch models
Pass -m for one session, for example codex -m deepseek/deepseek-v4.1-flash for a small fix, or change model in the file. Any chat model id from uberllm.dev/models works.
For scripts and CI, codex exec runs one task without the interactive screen:
codex exec --skip-git-repo-check "add a docstring to every function in utils.py"
Settings worth adding
model_context_window: Codex does not know the context size of models outside OpenAI's list and assumes 272,000 tokens. For a smaller model, set the number from its page on uberllm.dev/models (for examplemodel_context_window = 131072), so Codex compacts the conversation before it runs out of room.model_reasoning_effort:"low","medium"or"high"is passed on to models that think (DeepSeek, Kimi Thinking, GLM, GPT-5). Leave it out for the model's default.web_search = "disabled": Codex's web search runs on OpenAI's own servers, so it cannot run through another provider. With it off, the model is not offered a tool it cannot use.
What works
Every Codex tool is a normal function call from the API's side, so command runs, file edits, plans and MCP servers you add to Codex all work on any model that takes tool calls. Codex sends the whole conversation on every turn (store = false), so nothing is kept on UberLLM between calls. Each call shows in Dashboard → Activity under the app name codex, with its cost.
Troubleshooting
wire_api = "chat"is no longer supported: Codex 0.95 and later only speak the Responses API. Setwire_api = "responses".- 401 or "Missing environment variable: UBERLLM_API_KEY": the variable is not exported in the terminal Codex runs in. Open a new terminal after editing your profile, or run
export UBERLLM_API_KEY=...first. - 404 on every turn:
base_urlis missing/v1. It must be exactlyhttps://api.uberllm.dev/v1. - "Model metadata for … not found. Defaulting to fallback metadata": Codex prints this for every model outside OpenAI's own list. It is harmless; set
model_context_windowas above. - The model answers but never runs a command: pick a model from the first table. Small models drift out of Codex's tool format.
- 402 insufficient credits: add credit on the credits page. For a hard ceiling, set a spend limit on the key.