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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
build(rust): configure native extension profiles
Yujong Lee849269d52d9f
diff --git a/.github/actions/cache-cargo-build/action.yml b/.github/actions/cache-cargo-build/action.ymlindex 36c6c790b84..0ccb58c012c 100644--- a/.github/actions/cache-cargo-build/action.yml+++ b/.github/actions/cache-cargo-build/action.yml@@ -4,17 +4,16 @@ description: >-so only the first job on a given Cargo.lock compiles the bridge from scratch.litellm builds through maturin, which compiles litellm-rust/crates/python-bridge- in release mode before it can produce a wheel. `uv sync` therefore pays a full- build in every job that installs the workspace: measured at 2m40s per unit shard- on 2026-08-21, more than the whole unit tier spends running tests. Nothing caught- it, because the uv cache holds wheels uv downloads rather than wheels it builds,- and a path dependency whose source moves every commit could never hit that cache- anyway. Cargo rebuilds only what changed when its target directory survives, so a- warm job pays for the bridge crate alone.+ in the dev profile for editable installs. `uv sync` therefore pays a full build+ in every job that installs the workspace. Nothing caught it, because the uv cache+ holds wheels uv downloads rather than wheels it builds, and a path dependency+ whose source moves every commit could never hit that cache anyway. Cargo rebuilds+ only what changed when its target directory survives, so a warm job pays for the+ bridge crate alone.- The key namespace is separate from test-rust.yml's. Both cache the same directory,- but that workflow fills it with debug and clippy artifacts, which a release build- cannot reuse, and a shared key would let whichever ran first deny the other a save.+ The key namespace is separate from test-rust.yml's check and release caches. They+ cache the same directory for different workloads, and a shared key would let+ whichever ran first deny the others a save.runs:using: composite@@ -26,6 +25,6 @@ runs:~/.cargo/registry~/.cargo/gitlitellm-rust/target- key: ${{ runner.os }}-cargo-release-${{ hashFiles('litellm-rust/Cargo.lock') }}+ key: ${{ runner.os }}-cargo-dev-${{ hashFiles('litellm-rust/Cargo.lock') }}restore-keys: |- ${{ runner.os }}-cargo-release-+ ${{ runner.os }}-cargo-dev-diff --git a/litellm-rust/Cargo.toml b/litellm-rust/Cargo.tomlindex 481ea3f8f66..c17a0605fc7 100644--- a/litellm-rust/Cargo.toml+++ b/litellm-rust/Cargo.toml@@ -30,3 +30,12 @@ tokio = { version = "1", features = ["rt-multi-thread", "macros", "time", "net"]tokio-tungstenite = { version = "0.24", default-features = false, features = ["connect", "rustls-tls-native-roots"] }futures-util = { version = "0.3", default-features = false, features = ["sink", "std"] }base64 = "0.22"++[profile.release]+opt-level = 3+lto = "thin"+codegen-units = 1+panic = "unwind"+debug = false+incremental = false+strip = "symbols"diff --git a/litellm-rust/crates/python-bridge/Cargo.toml b/litellm-rust/crates/python-bridge/Cargo.tomlindex 0c4a753f762..d461a483ae0 100644--- a/litellm-rust/crates/python-bridge/Cargo.toml+++ b/litellm-rust/crates/python-bridge/Cargo.toml@@ -10,7 +10,8 @@ name = "_native"crate-type = ["cdylib"][features]-default = ["extension-module"]+default = ["abi3"]+abi3 = ["pyo3/abi3-py310"]extension-module = ["pyo3/extension-module"][dependencies]diff --git a/pyproject.toml b/pyproject.tomlindex 34c1fec1c11..23e96e475f3 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -262,7 +262,7 @@ healthcheck = [][build-system]-requires = ["maturin==1.9.4"]+requires = ["maturin==1.15.0"]build-backend = "maturin"[tool.maturin]@@ -270,6 +270,9 @@ manifest-path = "litellm-rust/crates/python-bridge/Cargo.toml"module-name = "litellm.rust_bridge._native"python-source = "."bindings = "pyo3"+features = ["extension-module"]+profile = "release"+editable-profile = "dev"include = ["litellm/proxy/_experimental/out/**"]exclude = ["litellm/proxy/enterprise",