forge-litellm
Optional LiteLLM compatibility adapter for the Forge SDK
Optional LiteLLM compatibility adapter for the Forge SDK
Package contract
| Field | Value |
|---|---|
| Language | rust |
| Source version | 0.2.0 |
| Manifest | forge-rs/crates/forge-litellm/Cargo.toml |
| Source files | 3 |
| Evidence | Source reference; registry publication and runtime conformance are separate checks |
Import boundary
use forge_litellm;Use a source checkout or your verified private registry. Manifest coordinates identify the package; they do not establish that a public registry release exists.
Crate boundary
The following entries are taken from src/lib.rs. Feature conditions in the exact source still apply.
pub mod error;
#[cfg(not(target_arch = "wasm32"))]
pub mod model;
pub use error::{LiteLlmError, LiteLlmResult};
#[cfg(not(target_arch = "wasm32"))]
pub use model::{register_litellm_model, LiteLlmConfig, LiteLlmModel};Source reference
Download package reference JSON. Each original source file and generated declaration artifact has its own SHA-256 digest. Function bodies and constant values are omitted from downloads. These are source declaration inventories, not compiler-resolved rustdoc, TypeDoc, DocC, or Dokka output. Private modules can contain public declarations that are not reachable through the package boundary; consult the entry point before importing.
error.rs
Read declaration text · 2 declaration entries
#[derive(Debug, Error)]
pub enum LiteLlmError {
/// The LiteLLM proxy returned an error response.
#[error("LiteLLM proxy at '{base_url}' returned error for model '{model}': {status} — {body}")]
ProxyError {
/// The LiteLLM proxy base URL.
base_url: String,
/// The model that was requested.
model: String,
/// The HTTP status code.
status: u16,
/// The response body (truncated if large).
body: String,
},
/// The LiteLLM proxy is unreachable.
#[error("LiteLLM proxy at '{base_url}' is unreachable: {reason}")]
ProxyUnreachable {
/// The LiteLLM proxy base URL.
base_url: String,
/// Human-readable connection error.
reason: String,
},
/// The LiteLLM proxy returned a response that could not be parsed.
#[error(
"LiteLLM proxy at '{base_url}' returned unparseable response for model '{model}': {reason}"
)]
InvalidResponse {
/// The LiteLLM proxy base URL.
base_url: String,
/// The model that was requested.
model: String,
/// What failed during parsing.
reason: String,
},
/// LiteLLM configuration is invalid.
#[error("invalid LiteLLM configuration: {reason}")]
InvalidConfig {
/// What is wrong with the configuration.
reason: String,
},
/// A Forge core error occurred during translation.
#[error("forge core error: {0}")]
ForgeCore(#[from] forge_core::error::ForgeError),
}
pub type LiteLlmResult<T> = Result<T, LiteLlmError>;lib.rs
Read declaration text · 4 declaration entries
pub mod error;
#[cfg(not(target_arch = "wasm32"))]
pub mod model;
pub use error::{LiteLlmError, LiteLlmResult};
#[cfg(not(target_arch = "wasm32"))]
pub use model::{register_litellm_model, LiteLlmConfig, LiteLlmModel};model.rs
Read declaration text · 11 declaration entries
#[derive(Debug, Clone)]
pub struct LiteLlmConfig {
}
pub fn new(base_url: impl Into<String>, api_key: impl Into<String>) -> Self;
pub fn with_timeout(mut self, seconds: u64) -> Self;
pub fn base_url(&self) -> &str;
pub fn timeout_seconds(&self) -> u64;
pub fn validate(&self) -> LiteLlmResult<()>;
#[derive(Debug, Clone)]
pub struct LiteLlmModel {
}
pub fn new(model_id: impl Into<String>, config: LiteLlmConfig) -> Self;
pub fn model(&self) -> &str;
pub fn config(&self) -> &LiteLlmConfig;
pub fn register_litellm_model(
registry: &mut ProviderRegistry,
model_id: impl Into<String>,
config: LiteLlmConfig,
) -> ForgeResult<String>;