name: omniroute-integration description: Integrate with OmniRoute AI Router for multi-provider LLM routing, MCP server access, and A2A agent-to-agent orchestration domain: core tags:
- ai-agent
- infrastructure
- integration
- memory
- omniroute
- self-improvement
persona: name: "Sam Altman" title: "The AI Infrastructure Expert - Master of LLM Routing" expertise: ['LLM Routing', 'AI Infrastructure', 'API Design', 'Model Orchestration'] philosophy: "The best AI is the one that just works, seamlessly." credentials: ['CEO of OpenAI', 'Former Y Combinator president', 'Led GPT development'] principles: ['Route to best model', 'Fall back gracefully', 'Optimize for cost and quality', 'Monitor everything']
OmniRoute Integration Skill
This skill provides guidance on integrating OmniRoute AI Router with Opencode for enhanced LLM capabilities.
Overview
OmniRoute is a unified AI proxy/router that routes any LLM through one endpoint with multi-provider support (OpenAI, Anthropic, Gemini, DeepSeek, Groq, xAI, Mistral, Fireworks, Cohere, etc.) featuring:
- MCP Server (16+ tools for agent control)
- A2A v0.3 Protocol (Agent-to-Agent orchestration)
- Multi-provider routing with intelligent load balancing
- Provider health monitoring and circuit breaker patterns
- Cost tracking and usage analytics
- Security features including prompt injection detection
- API Key Management with model-level permissions
- OAuth Token Management for Claude Code, Codex, Gemini CLI, Copilot, Kiro, Qwen, iFlow
When to Use
Use this skill when:
- You want to route LLM requests through multiple providers for reliability
- You need access to OmniRoute's MCP server for agent control
- You want to leverage A2A protocol for multi-agent workflows
- You need intelligent load balancing and failover between LLM providers
- You want to monitor provider health and costs
- You're building agentic workflows that benefit from multi-provider access
Quick Reference
| Endpoint/Method | Description |
|---|---|
GET /status |
Check service health and availability |
POST /execute |
Run the primary operation |
GET /results |
Retrieve operation results |
DELETE /cache |
Clear cached data |
Service Management
# Start OmniRoute service
sudo systemctl start omniroute
# Stop OmniRoute service
sudo systemctl stop omniroute
# Check service status
sudo systemctl status omniroute
# View logs
sudo journalctl -u omniroute -f
API Endpoints
OmniRoute runs on port 20128 by default:
Base URL: http://localhost:20128
API Version: v1 (/api/v1/*)
Authentication: Bearer token (any string works for development)
- OpenAI-compatible:
http://localhost:20128/v1(use with any API key string) - Provider Management:
GET/POST/PUT/DELETE http://localhost:20128/api/v1/providers/ - Combos:
GET/POST http://localhost:20128/api/v1/combos/ - Usage Analytics:
GET http://localhost:20128/api/v1/usage/ - Cost Tracking:
GET http://localhost:20128/api/v1/costs/ - Health Checks:
GET http://localhost:20128/api/v1/health/ - Registered Keys API:
POST http://localhost:20128/api/v1/registered-keys
MCP Server
OmniRoute provides an MCP (Model Context Protocol) server with 16 tools:
Transports:
- stdio: Local IDE integration (Claude Desktop, Cursor, VS Code)
- SSE:
/api/mcp/sse - Streamable HTTP:
/api/mcp/stream
Tools Available:
get_health- System health statuslist_combos- Available provider combinationsget_combo_metrics- Combo performance metricsswitch_combo- Switch active provider combocheck_quota- Check provider quota/usageroute_request- Route request through optimal providercost_report- Generate cost reportslist_models_catalog- Available models across providerssimulate_route- Simulate routing decisionset_budget_guard- Configure budget limitsset_resilience_profile- Configure retry/failover behaviortest_combo- Test provider combo connectivityget_provider_metrics- Individual provider performancebest_combo_for_task- Recommend optimal combo for task typeexplain_route- Explain routing decision rationaleget_session_snapshot- Get current session state
A2A Protocol
OmniRoute implements Agent-to-Agent v0.3 protocol:
Endpoints:
- Agent Card:
GET /.well-known/agent.json - Message Send:
POST /api/a2a/tasks - Message Stream:
POST /api/a2a/tasks/[id]/stream - Task Get:
GET /api/a2a/tasks/[id] - Task Cancel:
POST /api/a2a/tasks/[id]/cancel
Skills:
smart-routing- Intelligent LLM provider selectionquota-management- Provider quota monitoring and alerts
Integration with Opencode
- Connects with existing toolchain via standard interfaces
- Supports webhook-based event notifications
- Compatible with CI/CD pipelines for automated workflows
- Provides structured output for downstream consumption
Configure as Default Model
Add to /home/openclaw/.opencode/config.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"omniroute": {
"type": "remote",
"url": "http://localhost:20128/v1",
"enabled": true
}
},
"model": {
"provider": "omniroute",
"default": "auto/best-chat"
}
}
Agent Model Configuration
For each agent type, configure the optimal combo:
| Agent Type | Recommended Combo | Use Case |
|---|---|---|
| Default | best-chat | General conversation |
| Coding | best-coding | Code generation, refactoring |
| Fast | best-fast | Quick lookups, small fixes |
| Reasoning | best-reasoning | Complex logic, debugging |
| Vision | best-vision | Image understanding |
| Free | best-free | Budget-constrained tasks |
Sub-Agent Configuration
For sub-agents via task():
task(
category="executor",
model="auto/best-coding", // or any combo name
load_skills=[],
prompt="..."
)
As an LLM Provider
Configure Opencode to use OmniRoute as an OpenAI-compatible endpoint:
- Base URL:
http://localhost:20128 - API Key: Not required (OmniRoute handles auth internally)
- Models: Use any model available through OmniRoute's provider network
Available Combos
OmniRoute provides these pre-configured combos for common use cases:
Auto-Combos (intelligent routing):
- best-chat - Best general chat models
- best-coding - Best coding models
- best-fast - Fastest low-latency models
- best-reasoning - Best reasoning/thinking models
- best-vision - Best vision multimodal models
- best-free - Best free tier models
Provider-Specific Combos:
- antigravity - Antigravity models
- kilocode - KiloCode models
- kiro - Kiro models
- github - GitHub Copilot models
- openai - OpenAI models
- ollamacloud - Ollama Cloud models
- nanobanana - NanoBanana image models
- xai - xAI Grok models
- kimi-coding - Kimi Coding models
- glm - GLM models
- zai - ZAI models
- nvidia - NVIDIA models
- openrouter - OpenRouter models
- siliconflow - SiliconFlow models
- opencode-zen - OpenCode Zen models
- opencode-go - OpenCode Go models
- cloudflare-ai - Cloudflare AI models
Usage:
# Use auto combo
curl -X POST http://localhost:20128/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "auto/best-chat", "messages": [{"role": "user", "content": "Hello"}]}'
# Use provider combo
curl -X POST http://localhost:20128/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "provider/kilocode", "messages": [{"role": "user", "content": "Write code"}]}'
Using MCP Server in Opencode
Opencode can connect to OmniRoute's MCP server for enhanced agent capabilities:
- Configure MCP client to connect to
http://localhost:20128/mcp/stream - Use the 16 available tools for:
- Dynamic provider switching based on performance
- Cost-aware model selection
- Health-aware routing
- Usage monitoring and alerting
Using A2A for Multi-Agent Workflows
Leverage OmniRoute's A2A implementation:
- Register Opencode agents as A2A agents
- Use smart-routing skill for optimal LLM selection
- Implement quota management to prevent provider overuse
- Chain multiple agents with specialized capabilities
Configuration Files
{
"enabled": true,
"autoRun": false,
"timeout": 30000,
"retries": 3
}
Set environment variables as needed for authentication and endpoints.
Environment Variables
Key environment variables in /home/openclaw/omniroute-src/start-omniroute.sh:
PORT=20128- Service portDATA_DIR=/home/openclaw/.config/omniroute- Data directoryJWT_SECRET- Authentication secret- Provider-specific OAuth credentials
Data Directory Structure
/home/openclaw/.config/omniroute/storage.sqlite- Main database (provider connections, combos, usage logs)/home/openclaw/.omniroute/- Alternative data directory location/home/openclaw/.omniroute/patches/- OpenClaw patches (25 active)/home/openclaw/.omniroute/db_backups/- Automatic database backups
Verification
This section covers verification for the omniroute-integration skill. Key operations include input validation, core processing, and output verification. Refer to the skill overview for detailed usage instructions.
Check Service Health
# With authentication (any string works for development)
curl -s -H "Authorization: Bearer any-string" http://localhost:20128/api/v1/health | jq .
List Available Providers
curl -s -H "Authorization: Bearer any-string" http://localhost:20128/api/v1/providers | jq .
Test OpenAI-Compatible Endpoint
# Use with Cursor, Cline, Claude Desktop, Codex, etc.
# Base URL: http://localhost:20128/v1
# API Key: any-string
Check MCP Server Availability
curl -s http://localhost:20128/.well-known/agent.json | jq .
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Operation times out | Network or service issue | Check connectivity and retry |
| Permission denied | Missing credentials | Verify API keys and access tokens |
| Invalid output | Input format mismatch | Validate input against expected schema |
Service Won't Start
- Check logs:
sudo journalctl -u omniroute -f - Verify Node.js version:
node -v(should be v22.22.x) - Check port availability:
sudo lsof -i :20128 - Verify database integrity: Check
/home/openclaw/.omniroute/storage.sqlite
API Returns 404 or Auth Error
- Verify service is running:
sudo systemctl status omniroute - Use correct endpoint:
/api/v1/(not/api/) - Add auth header:
-H "Authorization: Bearer any-string" - Check dashboard at:
http://localhost:20128/dashboard
Authentication Required (AUTH_001)
- Version 3.3.x requires API key authentication
- Use
/v1endpoint for OpenAI-compatible API (accepts any API key string) - For
/api/v1/*endpoints, add-H "Authorization: Bearer your-key"
Database Issues
- Check backup directory:
/home/openclaw/.omniroute/db_backups/ - Restore from backup if needed
- Verify file permissions on storage.sqlite
Best Practices
- Provider Configuration: Configure multiple providers for redundancy
- Health Monitoring: Regularly check
/api/healthendpoint - Cost Awareness: Use cost tracking APIs to monitor usage
- Load Balancing: Leverage combo configurations for intelligent routing
- Security: Keep JWT_SECRET and provider credentials secure
- Updates: Regularly pull updates and run database migrations
- Backups: Monitor automatic backups in
/home/openclaw/.omniroute/db_backups/
When NOT to Use
- When the task requires domain expertise the agent has not been configured with
- When human review is mandated by compliance or regulatory requirements
- When the task is too trivial to warrant this skill
- When a more appropriate skill exists
Common Rationalizations
| Rationalization | Reality |
|---|---|
| "I'll do this later" | Explain why this excuse is wrong for this skill |
| "This is simple, skip steps" | Even simple tasks benefit from process |
Red Flags
- Agent output is not validated against expected quality standards
- Prerequisites are not verified before task execution
- Watch for shortcuts and skipped steps
Related Skills
using-superpowers- Always invoke this firstdev-browser- For testing web interfacesgit-master- For version control of configurationsautomation/n8n- For workflow integration with A2Amckinsey-research- For strategic provider evaluation
Remember: Always check if OmniRoute service is running before attempting to use its features. The integration provides powerful multi-provider LLM capabilities that can significantly enhance Opencode's agent capabilities.
Process
- Analyze the task requirements
- Apply domain expertise
- Verify output quality