Code examples for SoxAI — the unified AI API gateway that gives you access to 200+ AI models through a single OpenAI-compatible endpoint.
SoxAI is an AI API gateway that sits between your application and AI providers (OpenAI, Anthropic, Google, DeepSeek, etc.). You get:
- One API key for 200+ models from 40+ providers
- Automatic failover — if one provider goes down, requests route to another
- Team management — per-developer API keys with spending limits
- OpenAI SDK compatible — just change
base_url, your existing code works
# Sign up at https://console.soxai.io/register (free $5 credit, no card required)
# Get your API key from the dashboard
export SOXAI_API_KEY="sox-your-key-here"- Basic Chat Completion — Simple chat with any model
- Streaming Response — Stream tokens as they're generated
- Multi-Model Comparison — Compare outputs from different models
- AI Agent with Failover — Build an agent that survives provider outages
- Image Generation — Generate images with DALL-E / Stable Diffusion
- Basic Chat Completion — Simple chat with any model
- Streaming Response — Stream tokens in Node.js
- Express API Proxy — Add AI to your Express app
- Multi-Model Agent — TypeScript agent with multiple models
- Basic Chat Completion — Simple chat with the OpenAI Go client
- Streaming Response — Stream tokens in Go
- Basic Request — Simple curl command
- Streaming — Server-sent events with curl
- Claude Code Setup — Use SoxAI as the API backend for Claude Code
- Codex CLI Setup — Configure Codex CLI with SoxAI
- Gemini CLI Setup — Use Gemini CLI through SoxAI
- OpenCode Setup — Configure OpenCode with SoxAI
| Provider | Models |
|---|---|
| OpenAI | GPT-4o, GPT-4o Mini, GPT-4.1, o3, o4-mini |
| Anthropic | Claude Opus 4.6, Claude Sonnet 4.6, Claude Haiku 4.5 |
| Gemini 2.5 Pro, Gemini 2.5 Flash | |
| DeepSeek | DeepSeek V3, DeepSeek R1 |
| Meta | Llama 4 Scout, Llama 4 Maverick |
| And 35+ more providers... | Full model list → |
MIT