rtb-chat
Part of the phpboyscout Rust toolkit, the small, framework-free crates extracted from rust-tool-base.
Unified multi-provider AI chat client. genai covers the mainstream
(OpenAI, Gemini, Ollama, OpenAI-compatible); the two Anthropic providers
bypass it and call the Anthropic Messages API directly, for prompt caching,
extended thinking and citations. Structured output is JSON-Schema
validated before deserialising.
Formerly rtb-ai, renamed at extraction for GTB-family name
convergence (Go counterpart:
chat.go.phpboyscout.uk). Only the
crate identity changed; the API is unchanged.
use ;
use SecretString;
let client = new?;
let reply = client.chat.await?;
Config::api_key has no usable default: an empty key is rejected by
AiClient::new.
Prompt caching, extended thinking and citations are honoured on the Anthropic backend only. What the other four providers do and do not get is documented in What rtb-chat does not do.
- Docs: https://chat.rust.phpboyscout.uk
- API reference: https://docs.rs/rtb-chat
- Crate: https://crates.io/crates/rtb-chat
Development
just ci runs the full local gate (fmt, clippy, nextest, doc, deny).
The test suite runs entirely against wiremock, so no provider API
keys are needed. Releases are cut by colophon from Conventional
Commits; do not tag manually.
License
MIT