TutorialsQuickstartAPI Reference

Setup guides for tools and automation workflows.

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

  1. Go to the dashboard
  2. Sign up or log in to your account
  3. Navigate to API Keys -> Create New Key
  4. Copy the key

Step 2: Install Codex CLI

npm install -g @openai/codex

Verify the installation:

codex --version

Step 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-key

Then reload your shell:

source ~/.zshrc  # or ~/.bashrc

Windows (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-key

Step 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.