How to Use DevToks with OpenAI Codex CLI
Point Codex CLI at one endpoint so terminal automation and product traffic share the same integration surface.
Step 1: Get Your API Key
- Go to the dashboard
- Sign up or log in to your account
- Navigate to API Keys -> Create New Key
- Copy the key
Step 2: Install Codex CLI
npm install -g @openai/codexVerify the installation:
codex --versionStep 3: Configure Codex CLI
Set two environment variables to redirect Codex through DevToks:
macOS / Linux
Add to your ~/.bashrc, ~/.zshrc, or ~/.profile:
export OPENAI_BASE_URL=https://api.devtoks.com/v1
export OPENAI_API_KEY=sk-your-keyThen reload your shell:
source ~/.zshrc # or ~/.bashrcWindows (PowerShell)
$env:OPENAI_BASE_URL = "https://api.devtoks.com/v1"
$env:OPENAI_API_KEY = "sk-your-key"To make it permanent, add the variables to your PowerShell profile.
Windows (CMD)
set OPENAI_BASE_URL=https://api.devtoks.com/v1
set OPENAI_API_KEY=sk-your-keyStep 4: Verify the Connection
codex "Hello, can you confirm this connection is working?"If you see a response, you're all set. Check your dashboard to see the request logged with token usage and cost. dashboard.
Step 5: Start Coding
Codex CLI now routes through DevToks. Run it in any project directory:
# Ask Codex to explain existing code
codex "Explain what this codebase does"
# Generate new functionality
codex "Add input validation to the user registration endpoint"
# Debug issues
codex "Find and fix the memory leak in this service"Advanced: Specify a Model
DevToks supports OpenAI models plus other major providers. To see available model IDs:
curl https://api.devtoks.com/v1/models \
-H "Authorization: Bearer sk-your-key"You can also pass a model explicitly:
codex --model gpt-4.1 "Refactor this function for clarity"Troubleshooting
- Connection refused / timeout - Verify OPENAI_BASE_URL has no trailing slash and check status.
- Invalid API key - Use your DevToks key, not your OpenAI key.
- Env vars not taking effect - Restart your terminal and run echo $OPENAI_BASE_URL to confirm.