Skip to main content

Crate opi_ai

Crate opi_ai 

Source
Expand description

Unified multi-provider LLM API with streaming support.

Provides a standardized interface for interacting with multiple LLM providers: Anthropic, OpenAI Chat Completions, OpenAI Responses, Google Gemini, plus OpenAI-compatible profiles for OpenRouter and Mistral.

Re-exports§

pub use config::Config;
pub use config::Error;
pub use model::Model;
pub use provider::Provider;
pub use registry::ProviderRegistry;
pub use registry::RegistrationError;
pub use registry::RegistryError;
pub use stream::AssistantStreamEvent;
pub use stream::CostBreakdown;
pub use stream::CumulativeUsage;
pub use stream::Pricing;
pub use stream::calculate_cost;

Modules§

anthropic
Anthropic Messages SSE provider (S8.1).
azure_openai
Azure OpenAI provider profile (task 3.2).
bedrock
AWS Bedrock provider (task 3.1).
config
Provider configuration and authentication.
gemini
Google Gemini streamGenerateContent SSE provider (S8.1).
http
Shared HTTP client with connection pooling and proxy support (tasks 3.13, 3.12).
message
Provider-facing message types (S7.1).
mistral
Mistral provider profile - routes through the OpenAI-compatible adapter.
model
Model discovery and configuration.
openai_chat
OpenAI-compatible chat completions SSE provider (S8.1).
openai_responses
OpenAI Responses API SSE provider (S8.1).
openrouter
OpenRouter provider profile - routes through the OpenAI-compatible adapter.
provider
LLM provider abstraction (S8.1).
registry
Provider registry — resolves provider:model specs to provider + model info.
retry
Retry/backoff/rate-limit support (task 2.15).
stream
Streaming response events (S7.3).
vertex
Google Vertex AI provider (task 3.3).

Enums§

ApiKind