Connect opencode to Anoman AI
opencode adds providers through the AI SDK. Register Anoman as an OpenAI-compatible provider (or Anthropic) in your opencode config.
Prerequisites
- An Anoman API key — create one in the dashboard (format anm-sk-…).
- opencode installed and up to date.
- A model ID from the Anoman catalog, e.g. gpt-4o, gpt-4o-mini, or claude-sonnet-4-6.
Enable streaming for long agent runs
Set stream: true on requests. Autonomous, multi-step, and long-thinking tasks can exceed the 100-second edge timeout and fail with a 524 error; streaming returns tokens as they are generated and keeps the connection alive, so the request completes. Most tools stream by default — confirm it is on for agentic use.
More detail in the streaming guide.
Add Anoman as a provider
In opencode.json, register a provider using @ai-sdk/openai-compatible with Anoman's base URL and your key.
// opencode.json
{
"provider": {
"anoman": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "https://api.anoman.io/v1",
"apiKey": "anm-sk-your-key-here"
},
"models": { "gpt-4o": {}, "claude-sonnet-4-6": {} }
}
}
}Prefer Anthropic?
Swap the npm package to @ai-sdk/anthropic and point baseURL at Anoman's Anthropic endpoint.
"npm": "@ai-sdk/anthropic",
"options": {
"baseURL": "https://api.anoman.io/anthropic",
"apiKey": "anm-sk-your-key-here"
}Verify the guardrails are active
Every Anoman response carries guardrail result headers. Inspect them in your dashboard traces to confirm the pipeline is running on opencode requests — prompt-injection detection, PII masking, and content moderation all apply automatically.
X-Anoman-Guardrail-Injection: pass score=0.03
X-Anoman-Guardrail-Pii: pass
X-Anoman-Guardrail-Content: pass
X-Anoman-Cache: noneNeed help with your integration?
Join the Founding 50 for early access and direct support from the Anoman team.
Join Founding 50