Repository navigation
Closed
Description
Summary
Propose enhancements to the router component to enable connections with external providers (such as OpenAI and Anthropic). This will allow users to request not only open source models hosted by vLLM but also commercial models including GPT-series.
Motivation
- Expands the router's capability to federate requests across open source and commercial models.
- Enables wider user adoption and flexibility.
- Aligns with industry trends toward hybrid model serving.
Proposal
- Extend router service to support plugin or adapter architecture for external APIs (OpenAI, Anthropic, etc).
- Allow configuration for model selection between vLLM-hosted models and commercial providers.
- Ensure seamless request routing, authentication and error handling for mixed sources.
Configuration Approach
The router supports YAML/JSON config file loading from the terminal using the --dynamic-config-yaml or --dynamic-config-json arguments.
- Add an
external_providersfield toDynamicRouterConfig. - Extend
read_and_process_yaml_config_file()(src/vllm_router/parsers/yaml_utils.py) to extract external provider configuration from the YAML. - Update the router startup logic (
src/vllm_router/app.py) to wire up external provider registration (duringinitialize_all). - When running from terminal, the user can provide a single YAML file via
--dynamic-config-yaml:
vllm-router --port 8000 --dynamic-config-yaml router-config.yamlSample config file:
service_discovery: static
routing_logic: roundrobin
static_models:
meta-llama/Llama-3.1-8B-Instruct:
static_backends:
- "http://localhost:8000"
static_model_type: chat
external_providers:
- name: openai
api_base: "https://api.openai.com/v1"
api_key_env: "OPENAI_API_KEY"
models:
- id: "gpt-4o"
type: "chat"- The config watcher periodically hot-reloads changes, and the new fields propagate through
DynamicRouterConfig.from_yaml()and the router.
Alternative:
- Add
--external-providers-configCLI argument for a separate YAML file; less integrated but also supported.
Proposed Architecture
- Data Models
- Create a data models for external providers at
src/vllm_router/external_providers/models.py. - Define the configuration data structures that represent external providers and their models.
- Parse from YAML configuration.
- Provider Adapter Interface
- Define the contract all the external providers need to implement at
src/vllm_router/external_providers/base.py. - For example,
request_translation,response_translation,health_check,get_provider_name,cleanup,auth_injection...
- Actual Adapters
- Implement the
ExternalProviderAdapterinterface for each supported provider. For example,src/vllm_router/external_providers/openai_adapter.pyfor OpenAI.
- External Provider Registry
- Centralized management of all external provider adapters.
- The registry is stored on app.state and provides fast model-ID for adapter lookup.
Implementation Phases
- Core framework + OpenAI adapter:
ExternalProviderAdapter,RegistryOpenAI provider, YAML config parsing, unit tests. - Anthropic adapter: Request/response translation for non-OpenAI formats, integration tests with mocked APIs
- Google adapter: Ditto
- Other features: Fallback routing (external → self-hosted or vice versa), rate limiting...
- Observability: External provider metrics in
/metrics
Implementation Notes
- Update
DynamicRouterConfig(src/vllm_router/dynamic_config.py) to include external provider support. - Ensure the config loader and watcher recognize, parse, and propagate external provider info.
- Wire up new logic in the app and adapters/subcomponents.
Questions for Further Input
Please provide additional details:
- Which commercial providers should be prioritized (e.g., OpenAI, Anthropic, Cohere, Google, etc)?
- Are there specific authentication mechanisms or API endpoints we need to support?
- Should routing fallback or aggregation strategies be considered?
Reacted by Rui Zhang and Nejc Habjan
Metadata
Metadata
Assignees
Labels
No labels
Activity
ruizhang0101 commentedon Mar 19, 2026
Thanks for the great RFC! I think this is a very good starting point! For external providers, on top of my mind, there can be several extensions based on this RFC.
In terms of the questions.
Hope this can provide some help :))
shernshiou commentedon Mar 21, 2026
Thank you @ruizhang0101 for the insights. I have furnished my RFC with Proposed Architecture and Implementation Phases. Hopefully this clear things up. My first PR would be on Phase 1 focusing on core adapter framework.