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]

build(ai-gateway): build the sibling wheels from the repo so the image never waits on PyPI

mateo-berri025b9cb75168
diff --git a/litellm-rust/crates/ai-gateway/Dockerfile b/litellm-rust/crates/ai-gateway/Dockerfile
index 370d6b3f08f..72ac25ce1d6 100644
--- a/litellm-rust/crates/ai-gateway/Dockerfile
+++ b/litellm-rust/crates/ai-gateway/Dockerfile
@@ -51,10 +51,15 @@ RUN cargo build --locked --release -p litellm-ai-gateway --bin litellm-ai-gatewa
# The root pyproject builds with maturin against litellm-rust/crates/python-bridge,
# so the wheel is built here, next to the crate sources and the cargo toolchain,
# and the runtime stage installs the artifact instead of compiling anything.
+# litellm[proxy] pins litellm-enterprise and litellm-proxy-extras to the versions
+# in this repo, and those hit PyPI hours after every version bump merges, so both
+# wheels are built from the repo too instead of being resolved from PyPI.
COPY pyproject.toml README.md LICENSE /build/
COPY litellm/ /build/litellm/
COPY enterprise/ /build/enterprise/
-RUN pip3 wheel --no-cache-dir --no-deps --wheel-dir /build/dist /build
+COPY litellm-proxy-extras/ /build/litellm-proxy-extras/
+RUN pip3 wheel --no-cache-dir --no-deps --wheel-dir /build/dist \
+ /build /build/enterprise /build/litellm-proxy-extras
# ---- Runtime ----------------------------------------------------------------
# python:3.11-slim-bookworm ships libpython3.11, matching the builder's PyO3
@@ -69,10 +74,15 @@ RUN apt-get update \
WORKDIR /app
# Install litellm (with proxy extras) FROM THIS REPO'S SOURCE so
-# `import litellm.proxy.read_model_list` works — it is not on PyPI yet.
+# `import litellm.proxy.read_model_list` works — it is not on PyPI yet. The two
+# sibling wheels come from the builder as well, so the pins in litellm[proxy]
+# resolve against them and never wait on a PyPI publish.
COPY --from=builder /build/dist/*.whl /tmp/wheels/
RUN wheel="$(ls /tmp/wheels/litellm-*.whl)" \
- && pip install --no-cache-dir "${wheel}[proxy]" \
+ && pip install --no-cache-dir \
+ /tmp/wheels/litellm_enterprise-*.whl \
+ /tmp/wheels/litellm_proxy_extras-*.whl \
+ "${wheel}[proxy]" \
&& rm -rf /tmp/wheels
# The compiled gateway binary (pure-Rust realtime hot path; Python is load-time
diff --git a/litellm-rust/crates/ai-gateway/Dockerfile.dockerignore b/litellm-rust/crates/ai-gateway/Dockerfile.dockerignore
index c8e789b5e8c..d1386ff684d 100644
--- a/litellm-rust/crates/ai-gateway/Dockerfile.dockerignore
+++ b/litellm-rust/crates/ai-gateway/Dockerfile.dockerignore
@@ -10,6 +10,7 @@
# - litellm/ (pip install . needs the full package + proxy reader)
# - litellm-rust/ (the rust workspace; Cargo.lock + crate sources)
# - enterprise/ (litellm/proxy/enterprise symlinks into it; maturin walks it)
+# - litellm-proxy-extras/ (built into a wheel alongside enterprise/ for litellm[proxy])
# - pyproject.toml / README.md / LICENSE (packaging metadata for the wheel build)
# - rust-toolchain.toml (the pinned channel every cargo call in the build uses)
*
@@ -18,6 +19,7 @@
!litellm/
!litellm-rust/
!enterprise/
+!litellm-proxy-extras/
!pyproject.toml
!rust-toolchain.toml
!README.md
@@ -28,6 +30,7 @@
**/target/
# Committed python distribution artifacts; the wheel build does not read them.
enterprise/dist/
+litellm-proxy-extras/dist/
# Python caches and compiled bytecode.
**/__pycache__/
**/*.pyc