OpenAI Codex

Use Codex, OpenAI's coding agent, with your Pendra models. Add Pendra as a provider, set your API key, then run it as normal.

Set it up

Add these lines to ~/.codex/config.toml:

~/.codex/config.toml
model = "qwen3.6:27b"
model_provider = "pendra"

[model_providers.pendra]
name = "Pendra"
base_url = "https://api.pendra.ai/api/v1"
env_key = "PENDRA_API_KEY"

Then set your Pendra API key and start Codex in your project folder:

bash
export PENDRA_API_KEY=pdr_sk_...

codex

To check it's using Pendra, look for the request on the Usage page in the console. To keep your key set, add the export line to ~/.zshrc or ~/.bashrc.

Choosing a model

Set model to any chat model your workers serve, from the models list. Larger models that reason, such as qwen3.6:27b, are best for coding. You must set one, because Codex asks for OpenAI models by default and Pendra doesn't serve those.

What works

  • Codex can run commands, edit files and start sub-agents. Keep your workers up to date for the last two.
  • Web search needs web tools turned on for the worker that serves the request. Without it, the model carries on without searching.

Troubleshooting

  • 401 means the key is wrong or not set. Check it starts with pdr_sk_ and is exported in the terminal that runs codex.
  • 404 naming an OpenAI model, such as gpt-5-codex, means Codex didn't use your model setting. Check for a --model flag or a profile that sets its own model.
  • A slow first reply usually means the worker is loading the model, which can take up to 30 seconds. Later replies are quicker.
Codex uses Pendra's Responses API.