Before you start: create a Fortytwo API key and buy credits — see Quickstart, step 1. Give each agent its own key with a Spend limit.
1
Install LiteLLM and Codex
2
Configure LiteLLM
Create Use the
litellm.yaml:litellm.yaml
custom_openai/ prefix: it makes LiteLLM translate Responses requests to Chat Completions.The master key is a password for your local LiteLLM proxy; LiteLLM does not start without it. You do not get it anywhere: make up any string that starts with sk-, or let the command in the next step create a random one. Codex sends it to LiteLLM; LiteLLM sends your Fortytwo key to Fortytwo.3
Start LiteLLM
echo line prints the master key: copy it for the last step. Keep this terminal open while you use Codex.4
Configure Codex
Add this to
~/.codex/config.toml. The first three lines go at the top of the file, before any [section]; replace any model or model_provider lines already there.~ is your home folder. Folders that start with a dot, such as .pi, .config or .codex, are hidden. To show them: Cmd+Shift+. in Finder on macOS, View → Show → Hidden items in File Explorer on Windows, Ctrl+H in most Linux file managers.~/.codex/config.toml
5
Start Codex
In a second terminal, set the same master key and start Codex in your project folder:Codex warns
Model metadata for qwen/qwen3.8-27b not found. The warning does not affect requests.Something not working with your agent, or using one we have not listed? Tell us in the platform: Feedback for ideas and small bugs, Contact support if it blocks your work, or Report a security issue.