A Creology runtime · Rust
One Rust API for every model.
chat-rs is the interaction layer between your app and any language model. Streaming, multimodal content, tools, structured output, and multi-provider routing, behind one type-safe API across OpenAI, Claude, Gemini, Ollama, and more.
01Everything you need to talk to models
From a one-line completion to streaming, tools, and typed output, chat-rs hands you the whole interaction surface and keeps it identical across every provider you reach for.
02How the runtime works
Under the hood, chat-rs runs the reason-and-act loop for you: it calls the model, runs the tools it asks for, feeds the results back, and repeats until the model is done. You write a provider; the loop takes care of the rest.
- 01
Plug in any provider
A provider is just one trait. Bring a hosted API, a local model, or your own gateway. It doesn't have to speak Chat Completions or the Responses API.
- 02
The loop is handled for you
Streaming, retries, structured output, and human-in-the-loop pauses all come built in, so anything you plug in gets them for free.
- 03
Native and custom tools, together
Providers can expose their own native tools, and your #[tool] functions run right alongside them. Put a few providers behind a router and send each request wherever it fits.
use async_trait::async_trait;use chat_rs::{ ChatFailure, ChatResponse, CompletionProvider, Messages, types::{options::ChatOptions, tools::ToolDeclarations},};// A provider implements one trait. Bring a hosted API, a local model,// or your own gateway. It need not speak Completions or Responses.struct MyProvider;#[async_trait]impl CompletionProvider for MyProvider { async fn complete( &mut self, messages: &mut Messages, tools: Option<&dyn ToolDeclarations>, options: Option<&ChatOptions>, schema: Option<&schemars::Schema>, ) -> Result<ChatResponse, ChatFailure> { // Call your model, then hand back a ChatResponse. chat-rs runs the // reason-and-act loop, tools, and retries for you. todo!() }}03Small on purpose
chat-rs is the runtime, not the framework. You get a rock-solid interaction layer; agents, workflows, and memory stay yours to build on top, however you like, with whatever architecture fits.
Start here
Ship your first completion in five minutes.
Add the crate, pick a provider, and call complete. Swap in streaming, tools, or routing whenever you're ready. The API stays the same.