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
chore: move rust provider registry into core
Ishaan Jaff3ecd1202f27d
diff --git a/litellm-rust/ADDING_A_PROVIDER.md b/litellm-rust/ADDING_A_PROVIDER.mdindex ac454727c8a..48f8f75dceb 100644--- a/litellm-rust/ADDING_A_PROVIDER.md+++ b/litellm-rust/ADDING_A_PROVIDER.md@@ -1,7 +1,7 @@# Adding a provider / route to litellm-rust- 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 `providers/providers.json`: `routing_name` must match Python `LlmProviders.value`; `display_name` is human-facing; `default_api_base` and `api_key_env_var` are optional provider defaults.+- Add provider identity to `crates/core/src/providers/provider_registry.json`: `routing_name` must match Python `LlmProviders.value`; `display_name` is human-facing; `default_api_base` and `api_key_env_var` are optional provider defaults.- 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.diff --git a/litellm-rust/crates/core/build.rs b/litellm-rust/crates/core/build.rsindex e31152c2035..dfc415345a1 100644--- a/litellm-rust/crates/core/build.rs+++ b/litellm-rust/crates/core/build.rs@@ -119,7 +119,7 @@ fn generate_provider_code(providers: &[ProviderMetadataInput]) -> String {.join("\n");format!(- r#"// @generated by crates/core/build.rs from litellm-rust/providers/providers.json.+ r#"// @generated by crates/core/build.rs from litellm-rust/crates/core/src/providers/provider_registry.json.// Do not edit this file by hand.use std::fmt;@@ -204,10 +204,10 @@ mod tests {{fn registry_provider_values() -> Vec<String> {{let raw = include_str!(concat!(env!("CARGO_MANIFEST_DIR"),- "/../../providers/providers.json"+ "/src/providers/provider_registry.json"));serde_json::from_str::<Vec<RegistryProvider>>(raw)- .expect("providers.json parses")+ .expect("provider_registry.json parses").into_iter().map(|provider| provider.routing_name).collect()@@ -309,7 +309,7 @@ mod tests {{fn main() {let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());- let providers_path = manifest_dir.join("../../providers/providers.json");+ let providers_path = manifest_dir.join("src/providers/provider_registry.json");println!("cargo:rerun-if-changed={}", providers_path.display());println!("cargo:rerun-if-changed={}",diff --git a/litellm-rust/providers/README.md b/litellm-rust/crates/core/src/providers/README.mdsimilarity index 84%rename from litellm-rust/providers/README.mdrename to litellm-rust/crates/core/src/providers/README.mdindex 0191656373e..c8e2b8a2526 100644--- a/litellm-rust/providers/README.md+++ b/litellm-rust/crates/core/src/providers/README.md@@ -1,13 +1,13 @@# Rust Provider Registry-`providers.json` is the source of truth for provider identity in `litellm-rust`.+`provider_registry.json` is the source of truth for provider identity in `litellm-rust`.`crates/core/build.rs` reads it at compile time and generates the typed`LlmProvider` enum plus static provider metadata. Runtime code does not parsethis JSON.To add a provider:-- Add a `providers.json` entry with `routing_name` matching Python+- Add a `provider_registry.json` entry with `routing_name` matching Python`LlmProviders.value` in `litellm/types/utils.py`.- Set `display_name` to the human-readable provider name for docs/errors.- Set `default_api_base` to a stable provider-level default base URL, or `null`diff --git a/litellm-rust/providers/providers.json b/litellm-rust/crates/core/src/providers/provider_registry.jsonsimilarity index 100%rename from litellm-rust/providers/providers.jsonrename to litellm-rust/crates/core/src/providers/provider_registry.json