All use cases
OpenCode
Run OpenCode through AnyRouter
One CLI command injects an AnyRouter provider for the session, or add a custom provider in opencode.json — one key, the Chat Completions catalog, and request logs.
What this is for
OpenCode's built-in providers each want their own key. Switching models or sharing billing with Claude Code and Codex means editing every tool separately.
Steps, then copy
- 1.Create an AnyRouter key in the dashboard (sk-ar-…), or let the CLI sign you in.
- 2.Launch with anyr opencode so it injects the provider for that session, or add AnyRouter to opencode.json for a persistent config.
- 3.Pick an anyrouter/… model in /models and confirm the call in request logs.
anyr launcher
bash
anyr opencodeopencode.json
json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"anyrouter": {
"npm": "@ai-sdk/openai-compatible",
"name": "AnyRouter",
"options": {
"baseURL": "https://anyrouter.dev/api/v1",
"apiKey": "{env:ANYROUTER_API_KEY}"
},
"models": {
"anthropic/claude-sonnet-4-6": {
"name": "Claude Sonnet 4.6"
}
}
}
},
"model": "anyrouter/anthropic/claude-sonnet-4-6"
}Ready to try it
The guide has the full walkthrough. Sign up if you still need a key.
Next playbooks
- Run Claude Code through AnyRouterInstall the anyr CLI, then anyr claude — it injects the base URL, key, and model. Env vars are the fallback if you already run claude yourself.
- Run every coding agent through one URLClaude Code, Codex, OpenCode, Cursor, and other OpenAI-compatible tools share 271+ models, one balance, and one request log.
- Give agents MCP tools without per-client sprawlUnderstand what an MCP server is, then connect agents to AnyRouter instead of pasting a new config into every app.