rustlavel-ai: one API for talking to language models.
Laravel 13 shipped an AI SDK as a first-party package; this is the same idea
in Rust. Anthropic, OpenAI and Ollama sit behind one [Provider] trait, so
the difference between them is a line of configuration rather than a
rewrite, and [Ai::fake()] means an application's tests need neither a key
nor a network.
The common case is one line:
let answer = Ai::from_config(&config)?.prompt("Summarise this article").text().await?;
and so is streaming it:
let mut stream = ai.prompt("Tell me a story").stream().await?;
while let Some(delta) = stream.next().await? {
print!("{delta}");
}
Tools, structured output and multi-turn conversations are the same builder
with one more call on it. Every call reports an ai.call event — provider,
model, token counts, duration — so Telescope can show what the models cost
without ever seeing a prompt or a key.