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 pull request #40768 from BerriAI/litellm_prisma_cli_resolve

Mateo Wangf531537aa389
diff --cc litellm/proxy/proxy_cli.py
index c2d60cd5488,d9045c57b41..01a3da08998
--- a/litellm/proxy/proxy_cli.py
+++ b/litellm/proxy/proxy_cli.py
@@@ -1382,23 -1371,9 +1378,24 @@@ def run_server
)
else:
print(
- f"Unable to connect to DB. DATABASE_URL found in environment, but prisma package not found." # noqa: F541
+ "Unable to connect to DB. DATABASE_URL found in environment, but the prisma CLI is neither on "
+ "PATH nor importable as a package."
)
+ pgbouncer_settings: Final = PgBouncerSettings()
+ upstream_database_url: Final = os.getenv("DATABASE_URL")
+ if pgbouncer_settings.enabled and upstream_database_url is not None:
+ pooled_database_url: Final = start_in_container_pgbouncer(
+ pgbouncer_settings, upstream_database_url, token_auth=resolve_database_token_auth()
+ )
+ if isinstance(pooled_database_url, PgBouncerError):
+ print(
+ f"\033[1;31mLiteLLM Proxy: LITELLM_PGBOUNCER_ENABLED is set but the in-container pgbouncer "
+ f"could not start: {pooled_database_url.reason}\033[0m",
+ file=sys.stderr,
+ flush=True,
+ )
+ sys.exit(1)
+ export_pooled_database_url(pooled_database_url)
if port == 4000 and ProxyInitializationHelpers._is_port_in_use(port):
port = random.randint(1024, 49152)
if prometheus_metrics_port == port: