pub struct OpenRouterTranslator { /* private fields */ }Expand description
Translator backend that calls the OpenRouter /api/v1/chat/completions endpoint.
OpenRouter provides an OpenAI-compatible API to 400+ models, including
free models (no credit card required). Model slugs use the format
provider/model-name (e.g. meta-llama/llama-3.3-70b-instruct:free).
§Example
use psyche_subtitle_toolkit::OpenRouterTranslator;
let translator = OpenRouterTranslator::new("your-api-key", "meta-llama/llama-3.3-70b-instruct:free")?;
// let result = translator.translate(request).await?;Implementations§
Trait Implementations§
Source§impl Clone for OpenRouterTranslator
impl Clone for OpenRouterTranslator
Source§fn clone(&self) -> OpenRouterTranslator
fn clone(&self) -> OpenRouterTranslator
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OpenRouterTranslator
impl Debug for OpenRouterTranslator
Source§impl Translator for OpenRouterTranslator
impl Translator for OpenRouterTranslator
Source§fn translate<'life0, 'life1, 'async_trait>(
&'life0 self,
request: TranslationRequest<'life1>,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn translate<'life0, 'life1, 'async_trait>(
&'life0 self,
request: TranslationRequest<'life1>,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Translate the source text and return the translated string. Read more
Auto Trait Implementations§
impl Freeze for OpenRouterTranslator
impl !RefUnwindSafe for OpenRouterTranslator
impl Send for OpenRouterTranslator
impl Sync for OpenRouterTranslator
impl Unpin for OpenRouterTranslator
impl UnsafeUnpin for OpenRouterTranslator
impl !UnwindSafe for OpenRouterTranslator
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