pub struct OpenRouterProvider { /* private fields */ }Expand description
OpenRouter provider implementation (OpenAI-compatible API)
Implementations§
Source§impl OpenRouterProvider
impl OpenRouterProvider
pub fn new(config: ProviderConfig) -> Result<Self, ProviderError>
Trait Implementations§
Source§impl Provider for OpenRouterProvider
impl Provider for OpenRouterProvider
Source§fn supports_streaming(&self) -> bool
fn supports_streaming(&self) -> bool
Check if this provider supports streaming responses. Read more
Source§fn supports_function_calling(&self) -> bool
fn supports_function_calling(&self) -> bool
Check if this provider supports function calling. Read more
Source§fn supported_models(&self) -> Vec<String>
fn supported_models(&self) -> Vec<String>
Get the list of models supported by this provider. Read more
Source§fn chat_completion<'life0, 'async_trait>(
&'life0 self,
request: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chat_completion<'life0, 'async_trait>(
&'life0 self,
request: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Perform a chat completion request. Read more
Source§fn stream_chat_completion<'life0, 'async_trait>(
&'life0 self,
request: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<StreamResult, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stream_chat_completion<'life0, 'async_trait>(
&'life0 self,
request: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<StreamResult, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Perform a streaming chat completion request. Read more
Source§fn embedding<'life0, 'async_trait>(
&'life0 self,
request: EmbeddingRequest,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn embedding<'life0, 'async_trait>(
&'life0 self,
request: EmbeddingRequest,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate embeddings for text input. Read more
Source§fn image_generation<'life0, 'async_trait>(
&'life0 self,
request: ImageRequest,
) -> Pin<Box<dyn Future<Output = Result<ImageResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn image_generation<'life0, 'async_trait>(
&'life0 self,
request: ImageRequest,
) -> Pin<Box<dyn Future<Output = Result<ImageResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate images from text prompts. Read more
Source§fn audio_transcription<'life0, 'async_trait>(
&'life0 self,
request: AudioRequest,
) -> Pin<Box<dyn Future<Output = Result<AudioResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn audio_transcription<'life0, 'async_trait>(
&'life0 self,
request: AudioRequest,
) -> Pin<Box<dyn Future<Output = Result<AudioResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Transcribe audio to text. Read more
Source§fn text_to_speech<'life0, 'async_trait>(
&'life0 self,
request: SpeechRequest,
) -> Pin<Box<dyn Future<Output = Result<SpeechResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn text_to_speech<'life0, 'async_trait>(
&'life0 self,
request: SpeechRequest,
) -> Pin<Box<dyn Future<Output = Result<SpeechResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Convert text to speech. Read more
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ProviderHealth, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ProviderHealth, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Perform a health check on this provider. Read more
Auto Trait Implementations§
impl Freeze for OpenRouterProvider
impl !RefUnwindSafe for OpenRouterProvider
impl Send for OpenRouterProvider
impl Sync for OpenRouterProvider
impl Unpin for OpenRouterProvider
impl !UnwindSafe for OpenRouterProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more