Skip to content

feature: [RFC] Enhance router to support external providers (OpenAI, Anthropic, commercial models) #883

Closed

Description

@shernshiou

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_providers field to DynamicRouterConfig.
  • 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 (during initialize_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.yaml

Sample 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-config CLI argument for a separate YAML file; less integrated but also supported.

Proposed Architecture

  1. 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.
  1. 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...
  1. Actual Adapters
  • Implement the ExternalProviderAdapter interface for each supported provider. For example, src/vllm_router/external_providers/openai_adapter.py for OpenAI.
  1. 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

  1. Core framework + OpenAI adapter: ExternalProviderAdapter, Registry OpenAI provider, YAML config parsing, unit tests.
  2. Anthropic adapter: Request/response translation for non-OpenAI formats, integration tests with mocked APIs
  3. Google adapter: Ditto
  4. Other features: Fallback routing (external → self-hosted or vice versa), rate limiting...
  5. 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?

Activity

  1. ruizhang0101 commented on Mar 19, 2026

    @ruizhang0101
    Collaborator

    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.

    1. Currently the core router (route_request) is based on self-hosted models. For example, the engine stats scraper, endpoint filtering, health check and most importantly routing logic. They may not apply to external providers. It would be great to mention how you are gonna handle those situations.
    2. In the RFC, you mentioned adapter/plugin arch. Could you explain more about it in the RFC?
    3. It would be great to add some implementation phasing and test plan.

    In terms of the questions.

    1. I think it would be great to prioritize OpenAI, Anthropic and Google as a starting point.
    2. I think API Key is enough as a starting point, however, we might wanna consider whether it is appropriate to put the key in the yaml file.
    3. They could be, more general, this is the compatibility scope of existing router features and external providers router features. We need to think about what existing features are able to/should apply to external providers.

    Hope this can provide some help :))

  2. shernshiou commented on Mar 21, 2026

    @shernshiou
    ContributorAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions