LiteLLM Gateway
Route agent traffic through a unified proxy for custom or self-hosted models.
CORAL includes a built-in LiteLLM gateway that acts as a proxy between agents and model providers. This is useful when you want to:
- Route agent requests through a single proxy with unified API key management
- Use custom or self-hosted models
- Add request logging and per-agent tracking
- Use providers that require non-standard authentication
Setup
1. Create a LiteLLM config file (e.g. litellm_config.yaml) alongside your task.yaml:
# examples/circle_packing/litellm_config.yaml
model_list:
- model_name: "claude-opus-4-6"
litellm_params:
model: "anthropic/claude-opus-4-6"
api_key: "YOUR_ANTHROPIC_API_KEY"
litellm_settings:
drop_params: trueEach entry in model_list defines a model the gateway will serve. The model_name is what agents request; litellm_params.model is the upstream provider model. See the LiteLLM docs for full configuration options (multiple providers, load balancing, fallbacks, etc.).
MiniMax routes
The generated configuration supports MiniMax-M3 and MiniMax-M2.7. Each model ID includes both global and China OpenAI-compatible routes. Use the corresponding -anthropic alias for Anthropic-compatible routes. The Anthropic base URLs end in /anthropic; LiteLLM appends /v1/messages when it sends the request.
All generated routes use MINIMAX_API_KEY:
| Alias | Protocol | Regions |
|---|---|---|
MiniMax-M3 | OpenAI-compatible | global, China |
MiniMax-M3-anthropic | Anthropic-compatible | global, China |
MiniMax-M2.7 | OpenAI-compatible | global, China |
MiniMax-M2.7-anthropic | Anthropic-compatible | global, China |
2. Enable the gateway in your task config:
agents:
runtime: opencode # or claude_code, codex, dsh (cursor and kiro use their own auth)
model: claude/claude-opus-4-6
gateway:
enabled: true
port: 4000 # port the gateway listens on
config: "./litellm_config.yaml" # path relative to task.yaml3. Point your agent at the gateway. For OpenCode, set baseURL in opencode.json to http://localhost:<port>/v1 (see Agent Runtimes → OpenCode). For Claude Code and DeepSeek Harness, the gateway URL and per-agent key are injected automatically; DSH receives them as DEEPSEEK_BASE_URL and DEEPSEEK_API_KEY.
When you run coral start, the gateway starts before agents are spawned, and all agent API requests are routed through it. The gateway automatically assigns each agent a unique proxy key for per-agent request tracking.
See examples/circle_packing/ for a complete working example using OpenCode with the gateway.