High-performance Rust library for unifying LLM providers behind one type-safe API.
Installation • Usage • Documentation • Contributing • Providers
Philosophy
- One API, many providers.
- Unified response types for chat + streaming.
- Minimal configuration: explicit
base_url,timeout,proxy.
Key Features
- Provider-agnostic client API (
LlmClient) - Universal streaming with a unified
StreamingResponse - Function calling / tools (OpenAI-compatible)
- Multi-modal messages (text + images)
- Reasoning model normalization
- Per-request overrides: API key, base URL, and headers for multi-tenant / gateway use
Installation
MSRV: Rust 1.85+ (Rust 2024 edition)
[]
= "0.6.1"
= { = "1", = ["full"] }
Usage
Chat
use ;
let client = openai?;
let request = ChatRequest ;
let response = client.chat.await?;
println!;
Streaming
use ;
use StreamExt;
let client = openai?;
let request = ChatRequest ;
let mut stream = client.chat_stream.await?;
while let Some = stream.next.await
Per-Request Overrides (Multi-Tenant / Gateway)
Override API key, base URL, or headers per request without creating a new client:
let request = new
.add_message
.with_api_key
.with_base_url
.with_header;
let response = client.chat.await?;
Documentation
Contributing
Contributions welcome! See https://llmconn.com/guide/contributing for guidelines.
License
MIT