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]

add ciphers in command and pass to hypercorn for proxy (#11916)

frank0d486120bc96
diff --git a/litellm/proxy/proxy_cli.py b/litellm/proxy/proxy_cli.py
index 70fb2e0e518..2ba9e5782df 100644
--- a/litellm/proxy/proxy_cli.py
+++ b/litellm/proxy/proxy_cli.py
@@ -147,6 +147,7 @@ class ProxyInitializationHelpers:
port: int,
ssl_certfile_path: str,
ssl_keyfile_path: str,
+ ciphers: Optional[str] = None,
):
"""
Initialize litellm with `hypercorn`
@@ -168,6 +169,8 @@ class ProxyInitializationHelpers:
)
config.certfile = ssl_certfile_path
config.keyfile = ssl_keyfile_path
+ if ciphers is not None:
+ config.ciphers = ciphers
# hypercorn serve raises a type warning when passing a fast api app - even though fast API is a valid type
asyncio.run(serve(app, config)) # type: ignore
@@ -455,6 +458,12 @@ class ProxyInitializationHelpers:
help="Path to the SSL certfile. Use this when you want to provide SSL certificate when starting proxy",
envvar="SSL_CERTFILE_PATH",
)
+ "--ciphers",
+ default=None,
+ type=str,
+ help="Ciphers to use for the SSL setup.",
+)
@click.option(
"--use_prisma_migrate",
is_flag=True,
@@ -508,6 +517,7 @@ def run_server( # noqa: PLR0915
run_hypercorn,
ssl_keyfile_path,
ssl_certfile_path,
+ ciphers,
log_config,
use_prisma_migrate,
skip_server_startup,
@@ -819,6 +829,7 @@ def run_server( # noqa: PLR0915
port=port,
ssl_certfile_path=ssl_certfile_path,
ssl_keyfile_path=ssl_keyfile_path,
+ ciphers=ciphers,
)
diff --git a/tests/test_litellm/proxy/test_proxy_cli.py b/tests/test_litellm/proxy/test_proxy_cli.py
index 5fd8ea69b2d..22ba5c53ab5 100644
--- a/tests/test_litellm/proxy/test_proxy_cli.py
+++ b/tests/test_litellm/proxy/test_proxy_cli.py
@@ -121,7 +121,7 @@ class TestProxyInitializationHelpers:
# Execute
ProxyInitializationHelpers._init_hypercorn_server(
- mock_app, "localhost", 8000, None, None
+ mock_app, "localhost", 8000, None, None, None
)
# Assert
@@ -129,7 +129,7 @@ class TestProxyInitializationHelpers:
# Test with SSL
ProxyInitializationHelpers._init_hypercorn_server(
- mock_app, "localhost", 8000, "cert.pem", "key.pem"
+ mock_app, "localhost", 8000, "cert.pem", "key.pem", "ECDHE"
)
@patch("subprocess.Popen")