Coding agents
Use Libremodel in Codex
Add Libremodel as a provider in Codex's config and pick any of our models from /model.
1. Install Codex
Shell
npm install -g @openai/codex2. Set your API key
Create a key in API keys and export it. On macOS and Linux, add the line to ~/.zshrc or ~/.bashrc so every new terminal has it.
export LIBREMODEL_API_KEY="sk-libremodel-..."$env:LIBREMODEL_API_KEY = "sk-libremodel-..."3. Add Libremodel as a provider
Download the model catalog into the Codex folder:
Shell
curl -s https://api.libremodel.ai/v1/codex/models -H "Authorization: Bearer $LIBREMODEL_API_KEY" -o ~/.codex/libremodel-models.jsonThen add this to ~/.codex/config.toml. Create the file if it does not exist.
TOML
model = "deepseek-v4.1-flash-1017"
model_provider = "libremodel"
web_search = "disabled"
model_catalog_json = "libremodel-models.json"
[model_providers.libremodel]
name = "Libremodel"
base_url = "https://api.libremodel.ai/v1"
env_key = "LIBREMODEL_API_KEY"| Key | What it does |
|---|---|
model | The model Codex starts with. Any ID from Models. |
env_key | The environment variable Codex reads your key from. |
web_search | Keep it "disabled": Codex sends a web search tool by default. With a standard model each search is charged (Web search), and with an Uncensored model the request returns 400. |
model_catalog_json | The model catalog you downloaded, in the Codex folder: the models and effort levels in /model come from it. Download it again when we add a model. See it in the Playground. |
4. Start Codex
Shell
codexSwitch the model and the effort with /model.
Keep OpenAI as your default
Put the settings above in a profile instead of at the top of ~/.codex/config.toml, and use it only when you need it:
TOML
[profiles.libremodel]
model = "deepseek-v4.1-flash-1017"
model_provider = "libremodel"
web_search = "disabled"
model_catalog_json = "libremodel-models.json"Shell
codex --profile libremodelThe [model_providers.libremodel] section stays the same.
Troubleshooting
Check the key from the same terminal you run Codex in. A list of models means the key works. A 401 means LIBREMODEL_API_KEY is empty or wrong in that terminal.
Shell
curl -s https://api.libremodel.ai/v1/models -H "Authorization: Bearer $LIBREMODEL_API_KEY"