Skip to main content

Crate agent_sdk_providers

Crate agent_sdk_providers 

Source
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

ProviderModuleProtocol
Anthropic (Messages API)impls::anthropicSSE streaming
OpenAI (Chat Completions)impls::openaiSSE streaming
OpenAI (Responses API)impls::openai_responsesSSE streaming
OpenAI Codex / ChatGPTimpls::openai_codex_responsesWebSocket
Google Geminiimpls::geminiSSE streaming
Google Vertex AIimpls::vertexSSE streaming
Cloudflare AI Gatewayimpls::cloudflare_ai_gatewayProxy wrapper

Re-exports§

pub use provider::LlmProvider;
pub use provider::StructuredOutputSupport;
pub use provider::collect_stream;
pub use refresh::RefreshingProvider;
pub use refresh::is_unauthorized_error;
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§

ChatRequest
ChatResponse
ContentSource
Source data for image and document content blocks.
Message
ResponseFormat
Requests that the model constrain its final answer to a JSON Schema.
ThinkingConfig
Configuration for extended thinking.
Tool
Usage

Enums§

ChatOutcome
Content
ContentBlock
Effort
Effort level for adaptive thinking via output_config.
Role
StopReason
ThinkingMode
The mode of extended thinking.
ToolChoice
Controls whether the model must use a tool.