Skip to content

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 Every Config field, its default, and what happens when it is wrong.
Providers Which provider gets which features, which endpoint it talks to, and where the API key goes.
Requests Every ChatRequest field and the wire shape it produces.
Responses and streaming ChatResponse, Usage, Citation, and every ChatStreamEvent.
Errors 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. 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 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 has the full matrix; What rtb-chat does not do explains which gaps are deliberate and which are defects.