rtb-chat 0.7.3

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]https://rust.phpboyscout.uk —
> small, framework-free crates extracted from
> [rust-tool-base]https://gitlab.com/phpboyscout/rust-tool-base.

Unified multi-provider AI chat client. `genai` covers the mainstream
(OpenAI, Gemini, Ollama, OpenAI-compatible); the Anthropic 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](https://chat.go.phpboyscout.uk)). Only the
crate identity changed; the API is unchanged.

```rust
use rtb_chat::{AiClient, ChatRequest, Config, Message, Provider};
use secrecy::SecretString;

let client = AiClient::new(Config {
    provider: Provider::Anthropic,
    model: "claude-opus-4-7".into(),
    api_key: SecretString::from(std::env::var("ANTHROPIC_API_KEY")?),
    ..Config::default()
})?;
let reply = client.chat(ChatRequest {
    messages: vec![Message::user("Summarise this changelog in one line.")],
    max_tokens: Some(512),
    cache_control: true,
    ..ChatRequest::default()
}).await?;
```

`Config::api_key` has no usable default — an empty key is rejected by
`AiClient::new`.

Prompt caching, extended thinking, citations, `temperature`, `max_tokens`,
`timeout` and `base_url` 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](https://chat.rust.phpboyscout.uk/explanation/03-limitations/).

- **Docs:** <https://chat.rust.phpboyscout.uk>
  - [Tutorial: your first chat call]https://chat.rust.phpboyscout.uk/tutorials/01-your-first-chat-call/
  - [How-to guides]https://chat.rust.phpboyscout.uk/how-to/
  - [Reference]https://chat.rust.phpboyscout.uk/reference/
  - [Explanation]https://chat.rust.phpboyscout.uk/explanation/
- **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` — no provider API
keys are needed. Releases are cut by release-plz from Conventional
Commits — do not tag manually.

## License

MIT