Prerequisites
- Codex CLI installed
- An Arbytra API key
Install Codex
Run the official install script:~/.bashrc, which non-interactive shells don’t source. In CI, GitHub Actions, or agent-driven sessions, add this before invoking codex:
Set your API key
Add these two lines to your shell profile (~/.zshrc on macOS, ~/.bashrc on Linux):
OPENAI_* because Codex reads OpenAI-standard environment variables. Your Arbytra API key goes in OPENAI_API_KEY. Your key starts with ak_live_ (production) or ak_test_ (testing).
The base URL must include /v1. Codex appends /responses directly.
If you’ve logged in to Codex with a ChatGPT account, these environment variables override the ChatGPT login. Codex routes completions through OPENAI_BASE_URL instead of chatgpt.com.
Reload your shell after saving:
Use Arbytra alongside a ChatGPT Pro subscription
Use Arbytra alongside a ChatGPT Pro subscription
To keep your default Create the wrapper script:Add Reload your shell, then verify:Use
codex connected to ChatGPT, create a wrapper command instead of modifying your shell profile.Add your Arbytra API key to your shell profile (~/.zshrc or ~/.bashrc):~/.local/bin to your PATH if it isn’t already:codex-arbytra for Arbytra sessions and codex for your ChatGPT subscription.Verify
Run a test completion:Model metadata for '...' not found: metadata isn’t available for models served through custom base URLs.missing field 'models': the response uses the standarddatafield instead of amodelsfield.
Use different models
Pass any model ID with the-m flag:
/model <id>.
Codex uses the Response API with hosted tools, which only GPT models support. Non-GPT models (Claude, DeepSeek, Gemini) return a
hosted_tool_not_supported error.gpt-5.4-nano works for basic tasks but doesn’t support all Codex tools (e.g., tool_search). Complex multi-tool sessions may require a larger model.
To list all Arbytra models (only GPT models with Response API support work with Codex):
Control routing
Configure routing in the Arbytra dashboard. See routing options for details.Uninstall
RemoveOPENAI_API_KEY and OPENAI_BASE_URL from your shell profile (~/.zshrc or ~/.bashrc). If you created a codex-arbytra wrapper, delete ~/.local/bin/codex-arbytra.