This guide explains how to configure and use alternative AI providers with Sandboxed.sh.
- Anthropic (Claude models) - OAuth + API key
- OpenAI (GPT models) - OAuth + API key
- Google (Gemini models) - API key
- Cerebras (Llama models) - API key ⚡ Ultra-fast inference
- Z.AI (GLM models) - API key
- DeepInfra - API key
- Cohere - API key
- Together AI - API key
- Perplexity - API key
- Custom - Any OpenAI-compatible API
- Navigate to Settings → Providers
- Click "Add Provider"
- Select provider type
- Enter API key or authenticate via OAuth
- Enable for desired backends (OpenCode, Claude Code)
curl -X POST https://YOUR-BACKEND/api/ai/providers \
-H "Content-Type: application/json" \
-d '{
"provider_type": "cerebras",
"name": "Cerebras",
"api_key": "YOUR_API_KEY",
"enabled": true,
"use_for_backends": ["opencode"]
}'Get API Key: https://cerebras.ai
Recommended Models:
llama-3.3-70b- Best quality, fast inferencellama-3.1-8b- Quick tasks, extremely fast
Example Configuration:
curl -X POST https://YOUR-BACKEND/api/ai/providers \
-H "Content-Type: application/json" \
-d '{
"provider_type": "cerebras",
"name": "Cerebras",
"api_key": "csk-...",
"enabled": true,
"use_for_backends": ["opencode"]
}'Get API Key: https://bigmodel.cn
Recommended Models:
glm-5.1- Current flagship GLM reasoning and coding modelglm-5-turbo- Fast reasoning model with deep thinkingglm-4.7- Strong general-purpose GLM model
Example Configuration:
curl -X POST https://YOUR-BACKEND/api/ai/providers \
-H "Content-Type: application/json" \
-d '{
"provider_type": "zai",
"name": "Z.AI",
"api_key": "...",
"enabled": true,
"use_for_backends": ["opencode"]
}'Get API Key: https://platform.minimax.io
Recommended Models:
MiniMax-M3- Current flagship coding and agentic model with 1M contextMiniMax-M2.7- Previous flagship MiniMax modelMiniMax-M2.5-highspeed- Fast previous-generation model
Example Configuration:
curl -X POST https://YOUR-BACKEND/api/ai/providers \
-H "Content-Type: application/json" \
-d '{
"provider_type": "minimax",
"name": "MiniMax",
"api_key": "...",
"enabled": true,
"use_for_backends": ["opencode"]
}'Use OpenCode model overrides in provider/model format, for example
zai/glm-5.1 or minimax/MiniMax-M3.
Get API Key: https://deepinfra.com
Recommended Models:
meta-llama/Meta-Llama-3.1-70B-InstructQwen/QwQ-32B-Preview
For any OpenAI-compatible API:
curl -X POST https://YOUR-BACKEND/api/ai/providers \
-H "Content-Type: application/json" \
-d '{
"provider_type": "custom",
"name": "My Custom API",
"api_key": "YOUR_API_KEY",
"base_url": "https://api.example.com/v1",
"enabled": true,
"use_for_backends": ["opencode"],
"models": [
{
"id": "my-model-id",
"name": "My Model",
"context_limit": 128000,
"output_limit": 8000
}
]
}'OpenCode model defaults are configured in opencode.json or through per-mission model overrides. Use native .opencode/agents/*.md files for agent-specific instructions and model metadata.
curl -X POST https://YOUR-BACKEND/api/missions \
-H "Content-Type: application/json" \
-d '{
"workspace_id": "...",
"agent": "atlas",
"model_override": "cerebras/llama-3.3-70b",
"backend": "opencode"
}'- Create new mission
- Select agent and backend
- Use the model override field to specify
provider/model-name
-
Check API key is valid:
curl -s https://YOUR-BACKEND/api/ai/providers | jq '.[] | select(.id=="cerebras")'
-
Test API key directly:
# For Cerebras curl -X POST https://api.cerebras.ai/v1/chat/completions \ -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "llama-3.1-8b", "messages": [{"role": "user", "content": "test"}]}'
-
Re-add the provider with correct credentials
- Verify model name format:
provider/model-name(e.g.,cerebras/llama-3.3-70b) - Check OpenCode config: verify
opencode.jsoncontains the expectedmodel,agent, andproviderentries. - Ensure provider is enabled for the backend you're using.
OAuth tokens are automatically refreshed. If refresh fails:
- Re-authenticate via the dashboard
- Check provider status for error messages
Different providers have different rate limits:
- Cerebras: Very high limits, ultra-fast
- Z.AI: Check your plan limits
- DeepInfra: Free tier has lower limits
Before using expensive models, test your setup with:
- Cerebras
llama-3.1-8b(very fast, cheap) - Z.AI
glm-4-flash(cost-effective)
Instead of specifying model overrides per mission, define native OpenCode agents in .opencode/agents/*.md.
Check provider status regularly:
curl -s https://YOUR-BACKEND/api/ai/providers | jq '.[] | {id, status, use_for_backends}'Configure multiple providers for redundancy:
- Primary: Cerebras for speed
- Backup: Z.AI for cost-effectiveness
- Fallback: Anthropic for quality
GET /api/ai/providersPOST /api/ai/providers
Body: {
"provider_type": "cerebras",
"name": "Cerebras",
"api_key": "...",
"enabled": true,
"use_for_backends": ["opencode"]
}PUT /api/ai/providers/:id
Body: {
"enabled": true,
"use_for_backends": ["opencode", "claudecode"]
}DELETE /api/ai/providers/:idUse Z.AI and Cerebras for most tasks:
{
"agents": {
"atlas": { "model": "zai/glm-5" },
"explore": { "model": "cerebras/llama-3.1-8b" }
},
"categories": {
"quick": { "model": "cerebras/llama-3.1-8b" },
"deep": { "model": "zai/glm-5" }
}
}Cerebras for everything:
{
"agents": {
"atlas": { "model": "cerebras/llama-3.3-70b" },
"explore": { "model": "cerebras/llama-3.1-8b" }
},
"categories": {
"quick": { "model": "cerebras/llama-3.1-8b" },
"deep": { "model": "cerebras/llama-3.3-70b" }
}
}Mix of providers based on task:
{
"agents": {
"atlas": { "model": "anthropic/claude-sonnet-4-5" },
"explore": { "model": "cerebras/llama-3.1-8b" },
"sisyphus": { "model": "anthropic/claude-opus-4-5" }
},
"categories": {
"quick": { "model": "cerebras/llama-3.1-8b" },
"deep": { "model": "anthropic/claude-opus-4-5" }
}
}- Provider Issues: Check provider's documentation for API status
- Configuration Issues: Review this guide and your OpenCode
opencode.json/.opencode/agentsfiles. - Backend Issues: Check backend logs with
journalctl -u sandboxed-sh-dev -f
- Cerebras: https://cerebras.ai
- Z.AI: https://bigmodel.cn
- DeepInfra: https://deepinfra.com
- Anthropic: https://console.anthropic.com
- OpenAI: https://platform.openai.com
- Google: https://ai.google.dev