[Feat] Implement OpenAI external provider#902
Merged
ruizhang0101 merged 6 commits intoApr 20, 2026
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces support for external LLM providers (e.g., OpenAI) by implementing an adapter-based architecture and a provider registry. Key additions include a new 'external-only' service discovery mode, automated model validation against live provider APIs, and the logic to route requests to external endpoints. Feedback highlights a critical issue where abstract methods in the base adapter class are defined as synchronous while their implementations are asynchronous, which would lead to runtime errors. Other recommendations include removing redundant methods in the OpenAI provider and optimizing the request processing flow by avoiding unnecessary JSON re-parsing.
035b557 to
131e7b4
Compare
ce3de5f to
3a83608
Compare
24 tasks
3a83608 to
cd5a11c
Compare
cd5a11c to
496302a
Compare
ruizhang0101
requested changes
Apr 14, 2026
Signed-off-by: Shern Shiou Tan <shernshiou@gmail.com>
Signed-off-by: Shern Shiou Tan <shernshiou@gmail.com>
Signed-off-by: Shern Shiou Tan <shernshiou@gmail.com>
Signed-off-by: Shern Shiou Tan <shernshiou@gmail.com>
32e81d3 to
4519a18
Compare
ikaadil
pushed a commit
to ikaadil/production-stack
that referenced
this pull request
May 2, 2026
* feat: Implement openai provider Signed-off-by: Shern Shiou Tan <shernshiou@gmail.com> * test: Update tests Signed-off-by: Shern Shiou Tan <shernshiou@gmail.com> * test: Add unit test for external providers Signed-off-by: Shern Shiou Tan <shernshiou@gmail.com> * fix: Increase timeout Signed-off-by: Shern Shiou Tan <shernshiou@gmail.com> --------- Signed-off-by: Shern Shiou Tan <shernshiou@gmail.com> Co-authored-by: Rui Zhang <51696593+ruizhang0101@users.noreply.github.com> Signed-off-by: Ifta Khairul Alam Adil <ikaadil007@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires the existing
external_providers/infrastructure into the live request flow, enabling the router to forward requests to OpenAI (and any other OpenAI-compatible provider) in addition to local vLLM backends.FIX #883
Changes
services/request_service/request.pyprocess_external_provider_request()— handles requests destined for external providers (streaming + non-streaming), tracks metrics, propagates OTel spans.route_general_request()— added early-exit check after alias resolution: ifexternal_provider_registry.is_external_model(requested_model), the request is forwarded to the external provider and the vLLM backend path is skipped entirely.routers/main_router.pyshow_models()now acceptsRequest(FastAPI-injected) and appends external provider model cards to the/v1/modelsresponse, giving clients a unified model list.service_discovery.pyServiceDiscoveryType.EXTERNAL_ONLY = "external-only".ExternalOnlyServiceDiscovery— a no-op implementation that returns empty endpoint lists and is always healthy. Used for deployments with no local vLLM backends.parsers/parser.py"external-only"to--service-discoverychoices.--service-discoveryis no longer required when--external-providers-configis provided (defaults to"external-only"automatically).app.py"external-only"branch ininitialize_all()to initializeExternalOnlyServiceDiscovery.lifespan()now callsregistry.validate_models()at startup to remove any configured models that the provider does not actually serve.external_providers/base.pyfetch_available_model_ids()for live model validation.external_providers/openai_provider.pyfetch_available_model_ids()— queries/v1/modelsand returns the provider's live model list.external_providers/registry.pyvalidate_models()— queries each registered provider at startup and removes model IDs not present in the provider's live model list, preventing misconfigured models from being advertised or routed.examples/external_providers_config.yaml(new)How to test
-swhen doinggit commit[Bugfix],[Feat], and[CI].Detailed Checklist (Click to Expand)
Thank you for your contribution to production-stack! Before submitting the pull request, please ensure the PR meets the following criteria. This helps us maintain the code quality and improve the efficiency of the review process.
PR Title and Classification
Please try to classify PRs for easy understanding of the type of changes. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:
[Bugfix]for bug fixes.[CI/Build]for build or continuous integration improvements.[Doc]for documentation fixes and improvements.[Feat]for new features in the cluster (e.g., autoscaling, disaggregated prefill, etc.).[Router]for changes to thevllm_router(e.g., routing algorithm, router observability, etc.).[Misc]for PRs that do not fit the above categories. Please use this sparingly.Note: If the PR spans more than one category, please include all relevant prefixes.
Code Quality
The PR need to meet the following code quality standards:
pre-committo format your code. SeeREADME.mdfor installation.DCO and Signed-off-by
When contributing changes to this project, you must agree to the DCO. Commits must include a
Signed-off-by:header which certifies agreement with the terms of the DCO.Using
-swithgit commitwill automatically add this header.What to Expect for the Reviews
We aim to address all PRs in a timely manner. If no one reviews your PR within 5 days, please @-mention one of YuhanLiu11
, Shaoting-Feng or ApostaC.