From 28faafadb11e5d9668fa525b1d232dfadcf07edf Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Wed, 14 Aug 2024 21:36:07 -0700 Subject: [PATCH] feat(pass_through_endpoints.py): initial commit of crud endpoints for pass through endpoints --- .../pass_through_endpoints.py | 40 +++++++++++++++++++ litellm/proxy/proxy_server.py | 4 ++ 2 files changed, 44 insertions(+) diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py index 15129854a3..1d9f691177 100644 --- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py +++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py @@ -23,6 +23,8 @@ from litellm.integrations.custom_logger import CustomLogger from litellm.proxy._types import ProxyException, UserAPIKeyAuth from litellm.proxy.auth.user_api_key_auth import user_api_key_auth +router = APIRouter() + async def set_env_variables_in_header(custom_headers: dict): """ @@ -476,3 +478,41 @@ async def initialize_pass_through_endpoints(pass_through_endpoints: list): ) verbose_proxy_logger.debug("Added new pass through endpoint: %s", _path) + + +@router.get( + "/config/pass_through_endpoint/{endpoint_id}", + tags=["Internal User management"], + dependencies=[Depends(user_api_key_auth)], +) +async def get_pass_through_endpoints(request: Request, endpoint_id: str): + """ + GET configured pass through endpoint. + + If no endpoint_id given, return all configured endpoints. + """ + pass + + +@router.post( + "/config/pass_through_endpoint", + tags=["Internal User management"], + dependencies=[Depends(user_api_key_auth)], +) +async def create_pass_through_endpoints(request: Request): + """ + Create new pass-through endpoint + """ + pass + + +@router.delete( + "/config/pass_through_endpoint", + tags=["Internal User management"], + dependencies=[Depends(user_api_key_auth)], +) +async def delete_pass_through_endpoints(request: Request): + """ + Create new pass-through endpoint + """ + pass diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 2213e348d1..6483a61b53 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -194,6 +194,9 @@ from litellm.proxy.openai_files_endpoints.files_endpoints import set_files_confi from litellm.proxy.pass_through_endpoints.pass_through_endpoints import ( initialize_pass_through_endpoints, ) +from litellm.proxy.pass_through_endpoints.pass_through_endpoints import ( + router as pass_through_router, +) from litellm.proxy.secret_managers.aws_secret_manager import ( load_aws_kms, load_aws_secret_manager, @@ -9895,6 +9898,7 @@ def cleanup_router_config_variables(): app.include_router(router) app.include_router(fine_tuning_router) app.include_router(vertex_router) +app.include_router(pass_through_router) app.include_router(health_router) app.include_router(key_management_router) app.include_router(internal_user_router)