Expand description
LLM provider trait, streaming primitives, and first-party provider implementations.
This crate defines the LlmProvider trait that all LLM backends implement,
streaming types for incremental response processing, attachment validation,
model capability metadata, and seven first-party provider implementations.
§Provider Implementations
| Provider | Module | Protocol |
|---|---|---|
| Anthropic (Messages API) | impls::anthropic | SSE streaming |
| OpenAI (Chat Completions) | impls::openai | SSE streaming |
| OpenAI (Responses API) | impls::openai_responses | SSE streaming |
| OpenAI Codex / ChatGPT | impls::openai_codex_responses | WebSocket |
| Google Gemini | impls::gemini | SSE streaming |
| Google Vertex AI | impls::vertex | SSE streaming |
| Cloudflare AI Gateway | impls::cloudflare_ai_gateway | Proxy wrapper |
Re-exports§
pub use provider::LlmProvider;pub use provider::StructuredOutputSupport;pub use provider::collect_stream;pub use refresh::RefreshingProvider;pub use router::ModelRouter;pub use router::ModelTier;pub use router::TaskComplexity;pub use streaming::StreamAccumulator;pub use streaming::StreamBox;pub use streaming::StreamDelta;pub use structured::StructuredConfig;pub use structured::StructuredOutput;pub use structured::StructuredOutputError;pub use structured::run_structured;pub use impls::CloudflareAIGatewayProvider;pub use impls::GeminiProvider;pub use impls::OpenAICodexResponsesProvider;pub use impls::VertexProvider;pub use impls::AnthropicProvider;pub use impls::is_oauth_token;pub use impls::OpenAIProvider;pub use impls::OpenAIResponsesProvider;pub use model_capabilities::ModelCapabilities;pub use model_capabilities::PricePoint;pub use model_capabilities::Pricing;pub use model_capabilities::SourceStatus;pub use model_capabilities::get_model_capabilities;pub use model_capabilities::supported_model_capabilities;pub use search::BraveSearchProvider;pub use search::SearchProvider;pub use search::SearchResponse;pub use search::SearchResult;
Modules§
- attachments
- impls
- First-party LLM provider implementations.
- model_
capabilities - provider
- LLM provider trait and streaming helpers.
- refresh
- Provider wrapper that refreshes credentials on 401 and retries once.
- router
- search
- Search provider trait and implementations.
- streaming
- Streaming types for LLM responses.
- structured
- Schema-validated structured output.
Structs§
- Chat
Request - Chat
Response - Content
Source - Source data for image and document content blocks.
- Message
- Response
Format - Requests that the model constrain its final answer to a JSON Schema.
- Thinking
Config - Configuration for extended thinking.
- Tool
- Usage
Enums§
- Chat
Outcome - Content
- Content
Block - Effort
- Effort level for adaptive thinking via
output_config. - Role
- Stop
Reason - Thinking
Mode - The mode of extended thinking.
- Tool
Choice - Controls whether the model must use a tool.