[Feature] Add API_REFERENCE_BASE_URL and API_REFERENCE_MODEL for control plane setups #15739
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.
Problem
When setting up LiteLLM with a control plane/data plane architecture, the API Reference page incorrectly displays the control plane (admin) URL in code examples. Users need to see the data plane URL where LLM requests should actually be sent.
From the issue, customers wanted to control both:
Before this change:
Solution
Added two new environment variables to allow users to customize the API Reference page:
API_REFERENCE_BASE_URLPROXY_BASE_URLif not set (backward compatible)API_REFERENCE_MODELgpt-3.5-turboif not setAfter this change:
# Admin instance configuration PROXY_BASE_URL=https://admin.company.com API_REFERENCE_BASE_URL=https://data-plane.company.com API_REFERENCE_MODEL=gpt-4Changes
Backend
/sso/get/ui_settingsendpoint to returnAPI_REFERENCE_BASE_URLandAPI_REFERENCE_MODELAPI_REFERENCE_BASE_URLdefaults toPROXY_BASE_URLwhen not setFrontend
APIReferenceViewcomponent to use the new configuration valuesTests
test_get_ui_settings_api_reference_config()with comprehensive coverage:PROXY_BASE_URLDocumentation
control_plane_and_data_plane.mdwith configuration examplesUse Case: Control Plane Setup
This feature is specifically designed for the control plane and data plane architecture:
With this configuration:
https://admin.company.comhttps://us-west.company.comin all examplesmodel="gpt-4"instead of the defaultBackward Compatibility
✅ Fully backward compatible:
API_REFERENCE_BASE_URLfalls back toPROXY_BASE_URLAPI_REFERENCE_MODELdefaults togpt-3.5-turboTesting
All tests pass:
test_get_ui_settings_api_reference_configtest_get_ui_settings_spend_logs_thresholdFixes #[issue_number]
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
fonts.googleapis.com/usr/local/bin/node /home/REDACTED/work/litellm/litellm/ui/litellm-dashboard/node_modules/next/dist/compiled/jest-worker/processChild.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Fixes #15738
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.