Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Merge remote-tracking branch 'origin/main' into litellm_deepgram_listen_websocket_passthrough

yassinb7d808e416bc
diff --cc tests/test_litellm/proxy/test_proxy_server.py
index c55cde17de7,139fe2cce15..f42954f8dbc
--- a/tests/test_litellm/proxy/test_proxy_server.py
+++ b/tests/test_litellm/proxy/test_proxy_server.py
@@@ -7602,15 -7607,19 +7607,20 @@@ async def test_deleting_the_stored_pass
settings: Final = patch("litellm.proxy.proxy_server.general_settings", {}) # test-quality-ok: the method reads this module global; no injection seam
yaml_endpoints: Final = patch("litellm.proxy.proxy_server.config_passthrough_endpoints", None) # test-quality-ok: module global holding the YAML endpoints; this case has none
+ app_routes: Final = patch("litellm.proxy.pass_through_endpoints.pass_through_endpoints.SafeRouteAdder.add_api_route_if_not_exists") # test-quality-ok: the registry is the observable; a real route would stay on the shared FastAPI app for the rest of the xdist worker
- with settings, yaml_endpoints, app_routes:
- pc = ProxyConfig()
- await pc._update_general_settings(db_general_settings={"pass_through_endpoints": [db_endpoint]})
- assert live_routes(), "the stored endpoint should be serving before the row is deleted"
+ try:
- with settings, yaml_endpoints:
++ with settings, yaml_endpoints, app_routes:
+ pc = ProxyConfig()
+ await pc._update_general_settings(db_general_settings={"pass_through_endpoints": [db_endpoint]})
+ assert live_routes(), "the stored endpoint should be serving before the row is deleted"
- await pc._update_general_settings(db_general_settings={})
+ await pc._update_general_settings(db_general_settings={})
- assert live_routes() == set()
+ assert live_routes() == set()
+ finally:
+ app.routes[:] = prior_routes
+ _registered_pass_through_routes.clear()
+ _registered_pass_through_routes.update(prior_registry)
@pytest.mark.asyncio
@@@ -7636,18 -7648,22 +7649,23 @@@ async def test_a_stored_pass_through_ro
settings: Final = patch("litellm.proxy.proxy_server.general_settings", {"pass_through_endpoints": [config_endpoint]}) # test-quality-ok: the method reads this module global; no injection seam
yaml_endpoints: Final = patch("litellm.proxy.proxy_server.config_passthrough_endpoints", [config_endpoint]) # test-quality-ok: module global holding the YAML endpoints the reload merges in
+ app_routes: Final = patch("litellm.proxy.pass_through_endpoints.pass_through_endpoints.SafeRouteAdder.add_api_route_if_not_exists") # test-quality-ok: the registry is the observable; a real route would stay on the shared FastAPI app for the rest of the xdist worker
- with settings, yaml_endpoints, app_routes:
- await initialize_pass_through_endpoints(pass_through_endpoints=[config_endpoint])
- assert live_paths() == {config_path}
+ try:
- with settings, yaml_endpoints:
++ with settings, yaml_endpoints, app_routes:
+ await initialize_pass_through_endpoints(pass_through_endpoints=[config_endpoint])
+ assert live_paths() == {config_path}
- pc = ProxyConfig()
- await pc._update_general_settings(db_general_settings={"pass_through_endpoints": [db_endpoint]})
- assert live_paths() == {config_path}
+ pc = ProxyConfig()
+ await pc._update_general_settings(db_general_settings={"pass_through_endpoints": [db_endpoint]})
+ assert live_paths() == {config_path}
- await pc._update_general_settings(db_general_settings={})
+ await pc._update_general_settings(db_general_settings={})
- assert live_paths() == {config_path}
+ assert live_paths() == {config_path}
+ finally:
+ app.routes[:] = prior_routes
+ _registered_pass_through_routes.clear()
+ _registered_pass_through_routes.update(prior_registry)
def _fill_user_api_key_cache(cache: DualCache, count: int) -> None: