Codex CLI
Run OpenAI's terminal coding agent on your key.
Codex CLI uses OpenAI's Responses API, which we serve at https://pinerouter.ai/v1/responses.
1. Install
npm install -g @openai/codexbrew install --cask codex2. Point it at us
Add a provider to ~/.codex/config.toml:
model = "gpt-5-5"
model_provider = "ai"
[model_providers.ai]
name = "AI"
base_url = "https://pinerouter.ai/v1"
env_key = "AI_API_KEY"
wire_api = "responses"Then put your key in the environment named by env_key:
echo 'export AI_API_KEY="sk-..."' >> ~/.zshrc # or ~/.bashrc
source ~/.zshrcsetx AI_API_KEY "sk-..."Open a new terminal afterwards.
3. Run
cd your-project
codexSwitch models inside Codex with /model, using any GPT model id from Models.
Add our media models as tools
[mcp_servers.ai]
url = "https://pinerouter.ai/mcp"
http_headers = { Authorization = "Bearer sk-..." }See MCP.
Troubleshooting
- 401: check that
AI_API_KEYis set in the terminal you runcodexfrom. - Model not found: use a model id exactly as listed on Models.
- Stream errors: make sure
wire_api = "responses"andbase_urlends in/v1.
