Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
e58a561
Merge pull request #27906 from BerriAI/litellm_internal_staging
shin-berri May 14, 2026
a72414a
Merge pull request #28100 from BerriAI/litellm_internal_staging
yuneng-berri May 17, 2026
79b4578
Merge pull request #28292 from BerriAI/litellm_internal_staging
yuneng-berri May 19, 2026
35f6961
Merge pull request #28680 from BerriAI/litellm_internal_staging
yuneng-berri May 23, 2026
06f6cfc
Merge pull request #28709 from BerriAI/litellm_internal_staging
yuneng-berri May 23, 2026
a021a5b
Merge pull request #29243 from BerriAI/litellm_internal_staging
yuneng-berri May 29, 2026
5be0797
Merge pull request #29372 from BerriAI/litellm_internal_staging
yuneng-berri May 31, 2026
fc7538f
Merge pull request #29861 from BerriAI/litellm_internal_staging
yuneng-berri Jun 6, 2026
8f41fdb
Merge pull request #29862 from BerriAI/litellm_internal_staging
yuneng-berri Jun 6, 2026
ccd8c41
docs(readme): add Deploy on AWS/GCP with Terraform section
yassin-berriai Jun 7, 2026
260f5f1
docs(readme): add 1-click deploy buttons for AWS + GCP
yassin-berriai Jun 7, 2026
a505734
docs(readme): move AWS + GCP deploy buttons next to Render button
yassin-berriai Jun 7, 2026
d0ff175
docs(readme): unify deploy button sizes and badge styles
yassin-berriai Jun 7, 2026
daba177
docs(readme): bump deploy button height to 48 to match Render/Railway
yassin-berriai Jun 7, 2026
1a18184
docs(readme): bump AWS/GCP badge height to compensate for SVG padding
yassin-berriai Jun 7, 2026
8ba452c
docs(readme): bump AWS/GCP badge height to 72
yassin-berriai Jun 7, 2026
2c56b4d
docs(readme): bump AWS/GCP badge height to 84
yassin-berriai Jun 7, 2026
65890b7
fix(readme): make deploy buttons same height (48px)
claude Jun 7, 2026
97f067b
docs(readme): flag GCP project ID substitution in image_registry
yassin-berriai Jun 7, 2026
99e1a76
docs(readme): equalize deploy button heights and fix Cloud Shell butt…
claude Jun 7, 2026
7cf1b26
docs(readme): collapse Railway deploy anchor to a single line
claude Jun 7, 2026
9608dd5
Merge pull request #29879 from BerriAI/litellm_hotfix_readme_deploy_b…
yassin-berriai Jun 7, 2026
7f57a7a
Add Claude Fable 5 cost map entries as a data-only hotfix
mateo-berri Jun 10, 2026
343e453
Merge pull request #30076 from BerriAI/litellm_hotfix_fable_5_cost_map
krrish-berri-2 Jun 10, 2026
dcf1b44
Merge pull request #30907 from BerriAI/litellm_internal_staging
yuneng-berri Jun 21, 2026
3818d64
Merge pull request #31140 from BerriAI/litellm_internal_staging
yuneng-berri Jun 23, 2026
725deee
feat: make rust OCR async-first
ishaan-berri Jun 24, 2026
a9a1af6
docs: clarify rust provider call flow
ishaan-berri Jun 24, 2026
463148d
docs: clarify OCR provider transform contract
ishaan-berri Jun 24, 2026
e55b9f9
docs: note Tokio route contract
ishaan-berri Jun 24, 2026
82ec9ae
fix: address OCR bridge review comments
ishaan-berri Jun 24, 2026
5d5dd89
docs: bound rust OCR HTTP exception
ishaan-berri Jun 24, 2026
9ba5a15
feat: generate rust providers from registry
ishaan-berri Jun 24, 2026
3ecd120
chore: move rust provider registry into core
ishaan-berri Jun 24, 2026
31ef925
chore: source rust providers from endpoint registry
ishaan-berri Jun 24, 2026
7180f79
fix: satisfy OCR lint budget
ishaan-berri Jun 24, 2026
65ce6a1
fix: reduce OCR basedpyright argument errors
ishaan-berri Jun 24, 2026
6b1e1dc
fix: address OCR greptile feedback
ishaan-berri Jun 25, 2026
b4b0321
fix: align rust OCR request preparation
ishaan-berri Jun 25, 2026
2977e2b
fix: resolve OCR CodeQL alerts
ishaan-berri Jun 25, 2026
7edddbb
fix: avoid duplicate Rust OCR authorization header
ishaan-berri Jun 25, 2026
554cf88
ci: rerun CircleCI
ishaan-berri Jun 25, 2026
bd2a165
Merge pull request #31253 from BerriAI/litellm_hotfix_ocr_async_rust
ishaan-berri Jun 25, 2026
6ed1c6b
fix(deps): bump langgraph-checkpoint to 4.1.1 to resolve OSV vulnerab…
ArjunPakhan Jun 26, 2026
3f5186f
fix(ocr): use defensive getattr in load_rust_ocr
ArjunPakhan Jun 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions litellm-rust/ADDING_A_PROVIDER.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Adding a provider / route to litellm-rust

Three layers, same for every route (see `ocr` and `realtime` as references):

1. **Transform contract (pure)** — `crates/core/src/<route>/transformation.rs`: a `…ProviderConfig` trait (URL build + request/response transforms) + types in `types.rs`. No network, env, or auth.
2. **Provider config (pure)** — `crates/providers/src/<provider>/<route>/transformation.rs`: implement that trait as a `const <PROVIDER>_<ROUTE>_CONFIG`, mirroring the Python provider tree. Add parity unit tests.
3. **HTTP / transport (the host)** — `crates/providers/src/<route>.rs` (e.g. `ocr.rs`, `realtime.rs`): the callable fn (`run_ocr`, `realtime`). It resolves the key, builds the auth header, builds URL + transforms via the config, then does the network call. This is the only layer allowed to do I/O.

**Calling:** the host invokes the route fn — the Python bridge calls `run_ocr`; the `ai-gateway` server calls `realtime`. Register new modules in `lib.rs` / `mod.rs`, then run `cargo fmt && cargo clippy --workspace -- -D warnings && cargo test --workspace`.
- Keep the route contract pure in `crates/core/src/<route>/`: define the typed request/response structs and a provider config trait with no network, env, auth, or logging.
- Add provider identity to the repo-root `provider_endpoints_support.json`: use the LiteLLM provider slug, display name, docs URL, and endpoint support flags. Put optional stable provider-level base URL defaults under the top-level `default_creds` map; keep route-specific API key env vars in provider config/transform code so key resolution has one owner.
- Put provider-specific transforms in `crates/providers/src/<provider>/<route>/transformation.rs`, mirroring the Python provider tree and exposing a `const <PROVIDER>_<ROUTE>_CONFIG`.
- The provider config owns three pure steps: map LiteLLM params, transform the LiteLLM request into the provider request, and transform the provider response back into the LiteLLM response.
- If the provider has a reverse or normalization step, keep it pure and explicit next to the transforms; do not hide reverse mapping inside the HTTP transport.
- Route host functions in `crates/providers/src/<route>.rs` must be async: resolve auth/base URL, call the transforms, send with async transport, then call the response transform. Use Tokio/async all the way through Rust route I/O; only the PyO3 sync compatibility wrapper should `block_on` the async route, and it must release the GIL while waiting.
- Do not add per-provider HTTP clients casually. Today Rust cannot call Python's `BaseLLMHTTPHandler`; if a route needs end-to-end Rust I/O, keep the async transport route-scoped, opt-in from Python, and do not broaden it to more providers until there is a shared Rust HTTP abstraction.
- Register modules in `lib.rs` / `mod.rs`, add parity tests for params/request/response behavior, then run `cargo fmt && cargo clippy --workspace --all-targets --locked -- -D warnings && cargo test --workspace --locked`.
118 changes: 116 additions & 2 deletions litellm-rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion litellm-rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ repository = "https://github.com/BerriAI/litellm"
litellm-core = { path = "crates/core" }
litellm-providers = { path = "crates/providers" }
pyo3 = "0.23.5"
reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "rustls-tls"] }
pyo3-async-runtimes = { version = "0.23.0", features = ["tokio-runtime"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "http2"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "2.0"
Expand Down
4 changes: 4 additions & 0 deletions litellm-rust/crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ repository.workspace = true
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true

[build-dependencies]
serde.workspace = true
serde_json.workspace = true
Loading