ProviderRouter
ProviderRouter is the dispatch layer between the orchestrator and individual provider implementations. It is used as an async context manager.
OpenRouterProviderif an OpenRouter key is configured- Direct providers for each vendor that has both an API key and a registered implementation
Routing Decision
router.route(alias) returns a RoutingDecision without making any API calls. This is used by config test to show routing before sending requests.
complete() and complete_parallel()
complete() routes and executes a single request. complete_parallel() fans out a list of requests concurrently via asyncio.gather. Both return ModelResponse objects — errors are captured in response.error rather than raised.
Provider Implementations
| Vendor | Implementation | Status |
|---|---|---|
| Anthropic | providers/anthropic.py | ✅ Direct |
| OpenAI | — | Via OpenRouter |
| — | Via OpenRouter | |
| xAI | — | Via OpenRouter |
| Nvidia | — | Via OpenRouter |
| Groq | — | Via OpenRouter |
| OpenRouter | providers/openrouter.py | ✅ Universal fallback |
Provider base class in providers/base.py.
Vendor Resolution
The router maps model aliases and OpenRouter model IDs to vendors via their ID prefix (anthropic/, openai/, google/, x-ai/, nvidia/, groq/). Unknown prefixes fall back to Vendor.OPENROUTER.