Codex CLIAll GPT models.
Follow these steps in a terminal window. Choose your computer below.
Before you start
Have your API key and some Outrun credit ready. Keep your key private.
Open your computer’s Terminal app. Commands below are for this window.
Optional setup helperUse an AI assistant to walk through these steps
Copy the setup instructions into an AI assistant you already use. Review any file changes it suggests before allowing them.
Enter your API key directly in the app or local settings. Keep it out of the assistant’s chat.
Connection settingsShow
Base URL in config.toml: https://api.outrun.to/v1
Key variable: OUTRUN_API_KEY
First model: gpt-6.1-solGet your key from Outrun → API keys and enter it privately in the app or local settings. Test with “Reply with OK only.” Tests use credit; check Activity before retrying.
Setup Steps
- 1Install Node.js first
Use the Download Node.js link below and choose the LTS version for your computer. Follow its installation instructions, then close and reopen your terminal. Node.js includes npm, the program used by the Install Command below.
Download Node.js (LTS) - 2Install the tool
Open Commands and settings below. Copy only the Install Command for your selected computer into your terminal and press Enter. Wait for it to finish.
- 3Open the settings file
Find ~/.codex/config.toml. Open your home folder in the file manager and show hidden files (often Ctrl+H). ~ means your home folder; folders starting with a dot are hidden. Open the file in a text editor. If the folder or file is missing, create it.
- 4Add the Outrun settings
Open Commands and settings below and copy the Configuration Template into this file. If the file already has settings, keep them and add only the Outrun provider/settings block. Save the file. Do not paste JSON or TOML settings into the terminal.
- 5Enter your key privately
Use the Environment Setup commands for your computer below. Replace KEY with your own Outrun key in your local terminal or settings file. Never put the key in an AI chat or screenshot.
- 6Reopen and test
Open a new terminal, type codex, and press Enter. The first model is gpt-6.1-sol. Start a new chat and send: Reply with OK only. A short reply with no connection error means the first test worked. This request uses Outrun credit; check Activity if it is interrupted before trying again.
Commands and settings for LinuxShow
npm install -g @openai/codex# Put your key in the OUTRUN_API_KEY variable (replace KEY with your own key).
# Add the line to whichever shell files you use, then open a new terminal.
echo 'export OUTRUN_API_KEY="KEY"' >> ~/.zshrc
echo 'export OUTRUN_API_KEY="KEY"' >> ~/.bashrc
source ~/.zshrc 2>/dev/null || source ~/.bashrc
# Check (prints only the first characters):
Replace KEY with your own key only in your local app, editor or terminal. Never send that key to an AI chat. Copy one command block at a time.
Configuration Template
# Codex config file
# macOS / Linux: ~/.codex/config.toml
# Windows: %USERPROFILE%\.codex\config.toml
# Base URL ends in /v1. Do not append /responses.
model = "gpt-6.1-sol"
model_provider = "outrun"
model_reasoning_effort = "high"
[model_providers.outrun]
name = "Outrun"
base_url = "https://api.outrun.to/v1"
wire_api = "responses"
env_key = "OUTRUN_API_KEY"
# Windows alternative (only if Codex cannot see the OUTRUN_API_KEY variable):
# delete the env_key line above and use this line instead, with your key in place of KEY.
# experimental_bearer_token = "KEY"
# All Outrun GPT models (gpt-6.1-sol is the default above).
# Switch with: codex -p gpt-6-astra (or: codex -m gpt-6-astra)
[profiles."gpt-5.6-sol"]
model = "gpt-5.6-sol"
model_provider = "outrun"
[profiles."gpt-6.1-sol"]
model = "gpt-6.1-sol"
model_provider = "outrun"
[profiles."gpt-6-sol"]
model = "gpt-6-sol"
model_provider = "outrun"
[profiles."gpt-6-astra"]
model = "gpt-6-astra"
model_provider = "outrun"
[profiles."gpt-5.6-terra"]
model = "gpt-5.6-terra"
model_provider = "outrun"Optional: test with a script (uses credit)Show
curl https://api.outrun.to/v1/responses \
-H "Authorization: Bearer $OUTRUN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-6.1-sol","input":"Reply with OK only.","max_output_tokens":16}' If something goes wrong
Key missing or rejected (401)
Copy your current key from API keys. Paste it only into the app’s key field or your local key variable, then save and reopen the app.
Not enough available credit (402)
Check Balance and the key’s spending cap. Another request may have temporarily reserved credit; read the message before adding funds.
Wrong URL, model or limit (400/404)
Copy the exact values above. Do not add an operation such as /chat/completions to a Base URL. For GLM, context is 1000000 and maximum output is 65536.
Busy or rate limited (429)
Wait for the active request to finish or the rate limit to reset. Avoid repeatedly submitting the same request.
Interrupted request or uncertain charge
Check Activity first. Keep the request ID for support; never include your key in a message or screenshot.
Model choices and service notes
Codex talks to Outrun through a custom model provider. All GPT models are set up: gpt-6.1-sol (default), gpt-6-sol, gpt-6-astra, gpt-5.6-sol and gpt-5.6-terra. Switch with codex -p <model> or codex -m <model>. If a request returns 402, check your account balance and key spending cap. For 429, read the error: wait for the active request to finish or the rate limit to reset. If a paid request is interrupted or its outcome is uncertain, check Activity before trying again; do not automatically repeat it. Choose an available model from Models & Pricing; paused models cannot be used.