Skip to main content

liter_llm/
lib.rs

1// Provider, HTTP, and retry infrastructure are only active with native-http.
2// Suppress dead_code lints on the wasm / no-native-http target so that the
3// type-only surface compiles cleanly.
4#![cfg_attr(
5    not(any(feature = "native-http", feature = "wasm-http")),
6    allow(dead_code, unused_imports)
7)]
8
9pub mod auth;
10#[cfg(any(feature = "native-http", feature = "wasm-http"))]
11pub mod bindings;
12pub mod client;
13pub mod cost;
14pub mod error;
15pub(crate) mod http;
16pub mod provider;
17#[cfg(test)]
18mod tests;
19#[cfg(feature = "tokenizer")]
20pub mod tokenizer;
21#[cfg(feature = "tower")]
22pub mod tower;
23pub mod types;
24
25// Re-export key types at crate root.
26pub use client::{
27    BatchClient, BoxFuture, BoxStream, ClientConfig, ClientConfigBuilder, FileClient, FileConfig, LlmClient,
28    LlmClientRaw, ResponseClient,
29};
30// DefaultClient requires the native HTTP stack (reqwest on native or WASM fetch API).
31#[cfg(any(feature = "native-http", feature = "wasm-http"))]
32pub use client::DefaultClient;
33// ManagedClient requires both the native HTTP stack and Tower middleware.
34#[cfg(all(feature = "native-http", feature = "tower"))]
35pub use client::managed::ManagedClient;
36pub use error::{LiterLlmError, Result};
37// Re-export the public provider helper functions that are part of the crate's
38// public API even though the `provider` module itself is pub(crate).
39pub use provider::custom::{
40    AuthHeaderFormat, CustomProviderConfig, register_custom_provider, unregister_custom_provider,
41};
42pub use provider::{ProviderConfig, all_providers, complex_provider_names};
43pub use types::*;