docsIntegration GuidesCodex Integration

Codex CLI Integration

OpenAI Codex CLI is a powerful AI programming assistant. With Fizzly API, you can flexibly use various models.

Configuration

Set Environment Variables

# Linux/macOS
export OPENAI_API_KEY=your-fizzly-api-key
export OPENAI_BASE_URL=https://api.fizzly.com/v1
 
# Windows (PowerShell)
$env:OPENAI_API_KEY="your-fizzly-api-key"
$env:OPENAI_BASE_URL="https://api.fizzly.com/v1"

Persistent Configuration

Add to your shell configuration file:

Bash (~/.bashrc)

export OPENAI_API_KEY=your-fizzly-api-key
export OPENAI_BASE_URL=https://api.fizzly.com/v1

Zsh (~/.zshrc)

export OPENAI_API_KEY=your-fizzly-api-key
export OPENAI_BASE_URL=https://api.fizzly.com/v1

PowerShell ($PROFILE)

$env:OPENAI_API_KEY="your-fizzly-api-key"
$env:OPENAI_BASE_URL="https://api.fizzly.com/v1"

Usage

After configuration, use Codex CLI normally:

# Start Codex
codex
 
# Specify model
codex --model gpt-4o

Available Models

ModelDescriptionRecommended For
gpt-4oGPT-4o, multimodalGeneral programming
gpt-4-turboGPT-4 TurboComplex tasks
claude-3-5-sonnet-20241022Claude 3.5 SonnetCode generation
deepseek-chatDeepSeek V3Cost-effective

Recommended Setup

For daily programming tasks, we recommend gpt-4o or claude-3-5-sonnet-20241022 for excellent code understanding and generation.

Switching Models

Use model mapping to quickly switch between models for different tasks:

# Use GPT-4o for code generation
codex --model gpt-4o "Write a quicksort algorithm"
 
# Use Claude for code review
codex --model claude-3-5-sonnet-20241022 "Review this code for security issues"

Troubleshooting

Invalid API Key

Ensure your API Key starts with sk- and is enabled in the Fizzly console.

Model Request Failed

  1. Check model name spelling
  2. Verify account balance
  3. See Error Handling for detailed error info