rtb-chat 0.7.1

Unified multi-provider AI chat client for Claude, OpenAI, Gemini, and OpenAI-compatible endpoints. Part of the phpboyscout Rust toolkit.
Documentation

rtb-chat

Part of the phpboyscout Rust toolkit — 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 Claude backend drops down to direct Anthropic Messages API calls 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 rtb_chat::{AiClient, ChatRequest, Config, Message, Provider};

let client = AiClient::new(Config {
    provider: Provider::Claude,
    model: "claude-opus-4-7".into(),
    ..Config::default()
})?;
let reply = client.chat(ChatRequest {
    messages: vec![Message::user("Summarise this changelog in one line.")],
    cache_control: true,
    ..ChatRequest::default()
}).await?;

Development

just ci runs the full local gate (fmt, clippy, nextest, doc, deny). The test suite runs entirely against wiremock — no provider API keys are needed. Releases are cut by release-plz from Conventional Commits — do not tag manually.

License

MIT