rtb-chat 0.7.4

Unified multi-provider AI chat client for Claude, OpenAI, Gemini, and OpenAI-compatible endpoints. Part of the phpboyscout Rust toolkit.
Documentation
---
title: Reference
description: Every type, field, default and failure mode in rtb-chat, and which providers honour which of them.
tags: [reference]
---

# Reference

Exact behaviour of the `rtb-chat` public surface, verified against the crate
source at v0.7.2. Where a field is honoured on one provider and ignored on
another, that is stated at the field rather than left to inference.

| Page | Answers |
|---|---|
| [Configuration]01-config.md | Every `Config` field, its default, and what happens when it is wrong. |
| [Providers]02-providers.md | Which provider gets which features, which endpoint it talks to, and where the API key goes. |
| [Requests]03-requests.md | Every `ChatRequest` field and the wire shape it produces. |
| [Responses and streaming]04-responses.md | `ChatResponse`, `Usage`, `Citation`, and every `ChatStreamEvent`. |
| [Errors]05-errors.md | Every `AiError` variant, what raises it, and what to do about it. |

The generated API reference (signatures, trait bounds, module layout) lives at
[docs.rs/rtb-chat](https://docs.rs/rtb-chat). These pages cover the behaviour
behind those signatures, which rustdoc cannot show you.

## Two backends, two sets of answers

Almost every "does this work?" question about `rtb-chat` resolves to which of the
two backends the call went through.

- `Provider::Anthropic` and `Provider::AnthropicLocal` use the **Anthropic-direct**
  backend: `rtb-chat`'s own `reqwest` calls against the Messages API.
- `Provider::OpenAi`, `Provider::OpenAiCompatible`, `Provider::Gemini` and
  `Provider::Ollama` use the **genai** backend: the
  [`genai`]https://crates.io/crates/genai crate does the talking.

`Provider::is_anthropic()` tells you which one a provider selects, and is the same
predicate `AiClient::new` uses to pick a backend.

The two backends do not support the same feature set, and the gap is wider than
"prompt caching is Anthropic-only". [Providers](02-providers.md) has the full
matrix; [What rtb-chat does not do](../explanation/03-limitations.md) explains
why the deliberate gaps are there.