Proxy & Router Support

Route AI provider traffic through your own reverse proxy infrastructure. Supports fallback to direct API when proxy is down. Configure proxy URL and strict or soft mode.

Overview

Scorpiox Code supports routing all AI provider API calls through a custom reverse proxy. This is essential for enterprise environments with egress restrictions, compliance logging requirements, or teams that want centralized rate limiting and cost tracking across all developer workstations.

Request flow

Soft mode flow
scorpiox-code
proxy
api.anthropic.com
scorpiox-code
proxy ✗
api.anthropic.com (direct)
Strict mode flow
scorpiox-code
proxy
api.anthropic.com
scorpiox-code
proxy ✗ → ERROR

How It Works

When a proxy URL is configured, Scorpiox Code rewrites the base URL for every outgoing API request. Instead of calling the provider endpoint directly (e.g. api.anthropic.com), all traffic routes through your proxy. The proxy receives the original path and headers, forwards them upstream, and returns the response.

# Without proxy — direct call POST https://api.anthropic.com/v1/messages # With proxy configured POST https://your-proxy.company.com/v1/messages # Headers: x-api-key, anthropic-version (passed through) # Your proxy forwards to api.anthropic.com upstream

Configuration

Add the following keys to your scorpiox-env.txt configuration file:

Key Value Description
PROXY_URL https://your-proxy.company.com Your reverse proxy base URL. All provider requests will be routed here.
PROXY_MODE soft | strict Controls behavior when the proxy is unreachable.
PROXY_MODE=soft
Try proxy first, fall back to direct API on failure (default)
PROXY_MODE=strict
Only use proxy — fail hard if proxy is down. No direct API calls.

Examples

Basic proxy setup

scorpiox-env.txt
# Route all AI traffic through corporate proxy PROXY_URL=https://ai-proxy.company.com PROXY_MODE=soft # Provider keys still configured as normal ANTHROPIC_API_KEY=sk-ant-... MODEL=claude-sonnet-4-20250514

Strict mode (no fallback)

scorpiox-env.txt
# Enterprise lockdown — no direct API calls allowed PROXY_URL=https://ai-gateway.internal.corp PROXY_MODE=strict # If proxy is unreachable, scorpiox-code will return an error # rather than falling back to direct provider API calls. # This ensures all traffic is audited and logged.

Example nginx reverse proxy config

nginx.conf
server { listen 443 ssl; server_name ai-proxy.company.com; # Anthropic upstream location /v1/messages { proxy_pass https://api.anthropic.com; proxy_set_header Host api.anthropic.com; proxy_set_header X-Real-IP $remote_addr; proxy_ssl_server_name on; # Log for compliance access_log /var/log/nginx/ai-audit.log detailed; } # OpenAI upstream location /v1/chat/completions { proxy_pass https://api.openai.com; proxy_set_header Host api.openai.com; proxy_ssl_server_name on; access_log /var/log/nginx/ai-audit.log detailed; } }