SoxAIDocs
Quickstart

CLI Tools

Use SoxAI with Codex CLI, Claude Code, Gemini CLI, and OpenCode

CLI Tools

SoxAI works as a drop-in backend for popular AI coding assistants. Configure your tool to point at the SoxAI gateway, and all requests are routed, load-balanced, and billed through your SoxAI account.

Prerequisites

  1. A SoxAI account with an API token (sox-...)
  2. The CLI tool installed on your machine

Codex CLI

Codex is OpenAI's CLI coding agent. SoxAI supports the full Codex protocol including the /v1/responses endpoint.

macOS / Linux

# Step 1: Create the config file
mkdir -p ~/.codex
cat > ~/.codex/config.toml << 'EOF'
model = "gpt-5.4"
model_provider = "soxai"

[model_providers.soxai]
name = "SoxAI"
base_url = "https://api.soxai.io/v1"
env_key = "SOXAI_API_KEY"
EOF

# Step 2: Set your API key
export SOXAI_API_KEY="sox-your-token-here"

# Step 3: If previously logged in to another provider, logout first
codex logout

# Step 4: Start using Codex
codex

Windows (PowerShell)

# Step 1: Create the config file at %USERPROFILE%\.codex\config.toml
# with the following content:

model = "gpt-5.4"
model_provider = "soxai"

[model_providers.soxai]
name = "SoxAI"
base_url = "https://api.soxai.io/v1"
env_key = "SOXAI_API_KEY"

# Step 2: Set your API key
$env:SOXAI_API_KEY = "sox-your-token-here"

# Step 3: If previously logged in to another provider, logout first
codex logout

# Step 4: Start using Codex
codex

Supported Models

Any model available on your SoxAI account works with Codex. Change the model field in config.toml:

model = "gpt-5.4"        # OpenAI GPT-5.4
model = "o3-mini"          # OpenAI o3-mini
model = "claude-sonnet-4-6"  # Anthropic Claude (via OpenAI-compatible format)

Claude Code

Claude Code is Anthropic's CLI coding agent.

# Set environment variables
export ANTHROPIC_BASE_URL="https://api.soxai.io"
export ANTHROPIC_AUTH_TOKEN="sox-your-token-here"
export ANTHROPIC_API_KEY=""  # Must be set to empty string

# Run Claude Code
claude

Claude Code uses the Anthropic Messages API format. SoxAI supports passthrough mode for Anthropic-protocol channels, preserving all features including prompt caching, tool use, and extended thinking.


Gemini CLI

Gemini CLI is Google's CLI coding agent.

# Set environment variables
export GEMINI_API_BASE="https://api.soxai.io"
export GEMINI_API_KEY="sox-your-token-here"

# Run Gemini CLI
gemini

OpenCode

OpenCode is an open-source AI coding assistant that supports OpenAI-compatible APIs.

# Set environment variables
export OPENAI_BASE_URL="https://api.soxai.io/v1"
export OPENAI_API_KEY="sox-your-token-here"

# Run OpenCode
opencode

Tips

  • Model routing: SoxAI automatically routes requests to the correct upstream provider based on the model name. Use claude-* for Anthropic, gpt-* for OpenAI, gemini-* for Google, etc.
  • Session stickiness: Multi-turn conversations are automatically routed to the same upstream channel for consistency.
  • Billing: All CLI tool usage is tracked and billed through your SoxAI account. View usage in the Console under Request Logs.