IDEs & editors
Codex — VS Code extension
Configure OpenAI's Codex extension for VS Code with RouterPlex.
The Codex extension for VS Code reads the same ~/.codex/config.toml file as the Codex CLI — you just edit it from the extension's settings UI instead of a terminal.
Using the terminal instead? The Codex CLI guide covers the same config file plus profiles for switching models.
Open config.toml from the extension #
1. In the Codex panel, click the gear icon in the top-right corner and choose "Codex settings".

2. In the left sidebar, click "Configuration".

3. Under "Custom config.toml settings", click "Open config.toml".

4. Add the RouterPlex provider block above the [desktop] table, then save.

# ~/.codex/config.tomlmodel_provider = "routerplex"model = "gpt-5.6-terra" # Or any other RouterPlex-supported modelmodel_reasoning_effort = "low"[desktop]followUpQueueMode = "queue"[model_providers.routerplex]name = "RouterPlex"base_url = "https://api.routerplex.com/v1"wire_api = "responses"env_key = "ROUTERPLEX_API_KEY"env_key_instructions = "Set ROUTERPLEX_API_KEY before starting Codex."
model_provider, model, and model_reasoning_effort must go above [desktop] (or any other bracketed table). TOML keys belong to whichever table header precedes them — paste them below [desktop] and Codex reads them as desktop.model_provider instead of the top-level setting, so the provider silently never applies.
The extension may have already generated other keys in the file — notify, [desktop], [marketplaces.openai-bundled]. Leave those as they are; only the two blocks above are RouterPlex-specific.
Set the API key #
Create a dedicated, budget-capped RouterPlex key in the dashboard. env_key tells Codex to read it from ROUTERPLEX_API_KEY in your OS environment — not from config.toml — so set it where VS Code's process can see it.
macOS / Linux — add it to your shell profile so it persists, then reload the shell:
echo 'export ROUTERPLEX_API_KEY="sk-..."' >> ~/.zshrc # or ~/.bashrcsource ~/.zshrc

If you normally launch VS Code from the Dock or Spotlight rather than a terminal, note that GUI apps don't inherit variables that only live in a shell profile. Either launch VS Code with code . from a terminal that has sourced the profile, or set it machine-wide with launchctl setenv ROUTERPLEX_API_KEY "sk-..." before opening VS Code.
Windows (PowerShell) — setx persists the variable for future sessions, but not for windows already open:
setx ROUTERPLEX_API_KEY "sk-..."
You can also add it under System Properties → Environment Variables → User variables, which has the same effect and doesn't require a terminal.
Restart VS Code #
Environment variables are read once, at process start — fully quit VS Code (not just "Reload Window") and reopen it so the Codex extension picks up ROUTERPLEX_API_KEY. Then open the Codex panel and send a test prompt; it should show up under the dedicated key in the RouterPlex dashboard.
If Codex reports an unsupported API format, make sure wire_api = "responses" is present. If a model is rejected, copy its case-sensitive ID from the live catalog and update the model value.
Tip: to try a different model, change only the model value — the [model_providers.routerplex] block stays the same for every RouterPlex model.