Coding Agents & Hermes
Connect autonomous agents and AI coding tools to SwitchRouter with a single OpenAI-compatible endpoint, full tool-calling support, and automatic output-token clamping.
Configure OpenCode (~/.config/opencode/opencode.jsonc) to add SwitchRouter as a provider using "@ai-sdk/openai-compatible":
- Base URL: https://api.switchrouter.dev/v1
- API Key: "{env:SWITCHROUTER_API_KEY}"
- Header: "X-Title": "OpenCode"
- Query GET https://api.switchrouter.dev/v1/models to register tool-calling models (such as "deepseek.v3.2" and "qwen.qwen3-coder-480b-a35b") with their exact context_window and max_output_tokens limits.One-prompt agent self-setup
If your agent has terminal or file-editing tools (such as Hermes, OpenCode, Claude Code, or Cline), click Copy prompt for agent above and paste it directly into your agent chat. The agent will query GET https://api.switchrouter.dev/v1/models to inspect live context windows and tool-calling capabilities and write your local configuration automatically.
Hermes Agent
Hermes connects to any OpenAI-compatible inference router. Export your SwitchRouter key and base URL, or add a switchrouter provider block to your Hermes configuration:
export SWITCHROUTER_API_KEY="sk_sr_your_key_here"
export OPENAI_API_KEY="$SWITCHROUTER_API_KEY"
export OPENAI_BASE_URL="https://api.switchrouter.dev/v1"
export OPENAI_API_BASE="https://api.switchrouter.dev/v1"# Hermes Agent provider configuration
provider:
type: openai_compatible
name: switchrouter
base_url: "https://api.switchrouter.dev/v1"
api_key_env: SWITCHROUTER_API_KEY
model: deepseek.v3.2
headers:
X-Title: "Hermes Agent"Passing X-Title: "Hermes Agent" attributes all agent runs under Top Apps on your Console Overview page.
OpenCode
OpenCode uses the Vercel AI SDK (@ai-sdk/openai-compatible). Add SwitchRouter to ~/.config/opencode/opencode.jsonc and export SWITCHROUTER_API_KEY in your shell profile:
{
"$schema": "https://opencode.ai/config.json",
"model": "switchrouter/deepseek.v3.2",
"provider": {
"switchrouter": {
"npm": "@ai-sdk/openai-compatible",
"name": "SwitchRouter",
"options": {
"baseURL": "https://api.switchrouter.dev/v1",
"apiKey": "{env:SWITCHROUTER_API_KEY}",
"headers": {
"X-Title": "OpenCode"
}
},
"models": {
"deepseek.v3.2": {
"name": "DeepSeek V3.2",
"tool_call": true,
"limit": {
"context": 163840,
"output": 16384
}
},
"qwen.qwen3-coder-480b-a35b": {
"name": "Qwen3 Coder 480B",
"tool_call": true,
"limit": {
"context": 262144,
"output": 65536
}
},
"anthropic.claude-sonnet-4-5": {
"name": "Claude Sonnet 4.5",
"tool_call": true,
"limit": {
"context": 200000,
"output": 64000
}
}
}
}
}
}Cline, Roo Code & Continue (VS Code / Cursor)
In Cline or Roo Code, open extension settings and set:
- API Provider: OpenAI Compatible
- Base URL: https://api.switchrouter.dev/v1
- API Key: sk_sr_…
- Model ID: deepseek.v3.2 or qwen.qwen3-coder-480b-a35b
In Continue.dev (~/.continue/config.json):
{
"models": [
{
"title": "DeepSeek V3.2 (SwitchRouter)",
"provider": "openai",
"model": "deepseek.v3.2",
"apiBase": "https://api.switchrouter.dev/v1",
"apiKey": "sk_sr_your_key_here"
}
]
}Aider & CLI agents
Point any OpenAI-compatible CLI agent at https://api.switchrouter.dev/v1 and prefix the model slug with openai/:
export OPENAI_API_BASE="https://api.switchrouter.dev/v1"
export OPENAI_API_KEY="sk_sr_your_key_here"
aider --model openai/deepseek.v3.2Machine-readable docs (/llms.txt)
SwitchRouter publishes standard machine-readable documentation at the root of the site so agents with web-fetch capabilities can read the entire API contract without HTML noise:
- /llms.txt — Compact index of endpoints, auth headers, and recommended model IDs.
- /llms-full.txt — Complete single-file integration specification with copy-paste configs for Hermes, OpenCode, TypeScript, Python, and Vercel AI SDK.