pub struct OpenRouterBuilder<M = WithoutModel, W = Responses, T: Transport = ReqwestTransport> { /* private fields */ }Implementations§
Source§impl<M, W, T: Transport> OpenRouterBuilder<M, W, T>
impl<M, W, T: Transport> OpenRouterBuilder<M, W, T>
Sourcepub fn with_api_key(self, api_key: impl Into<String>) -> Self
pub fn with_api_key(self, api_key: impl Into<String>) -> Self
Override the API key. If unset, OPENROUTER_API_KEY is read at build time.
Sourcepub fn with_base_url(self, url: impl Into<String>) -> Self
pub fn with_base_url(self, url: impl Into<String>) -> Self
Override the base URL. Defaults to https://openrouter.ai/api/v1.
pub fn with_description(self, description: impl Into<String>) -> Self
Sourcepub fn with_transport<T2: Transport>(
self,
transport: T2,
) -> OpenRouterBuilder<M, W, T2>
pub fn with_transport<T2: Transport>( self, transport: T2, ) -> OpenRouterBuilder<M, W, T2>
Supply a custom transport, replacing the default ReqwestTransport.
Source§impl<W, T: Transport> OpenRouterBuilder<WithoutModel, W, T>
impl<W, T: Transport> OpenRouterBuilder<WithoutModel, W, T>
Sourcepub fn with_model(
self,
model: impl Into<String>,
) -> OpenRouterBuilder<WithModel, W, T>
pub fn with_model( self, model: impl Into<String>, ) -> OpenRouterBuilder<WithModel, W, T>
Select the model. OpenRouter slugs are vendor-prefixed, e.g.
anthropic/claude-sonnet-4 or openai/gpt-4o.
Source§impl<M, T: Transport> OpenRouterBuilder<M, Responses, T>
impl<M, T: Transport> OpenRouterBuilder<M, Responses, T>
Sourcepub fn with_completions(self) -> OpenRouterBuilder<M, Completions, T>
pub fn with_completions(self) -> OpenRouterBuilder<M, Completions, T>
Opt in to the Chat Completions wire instead of the default Responses API.
Sourcepub fn with_reasoning_effort(self, effort: impl Into<String>) -> Self
pub fn with_reasoning_effort(self, effort: impl Into<String>) -> Self
Set the reasoning effort ("low" / "medium" / "high") for
reasoning-capable models. Responses-wire only — Chat Completions
does not carry this field.
Source§impl<T: Transport> OpenRouterBuilder<WithModel, Responses, T>
impl<T: Transport> OpenRouterBuilder<WithModel, Responses, T>
Sourcepub fn build(self) -> ResponsesClient<T>
pub fn build(self) -> ResponsesClient<T>
Build a Responses API client.
Source§impl<T: Transport> OpenRouterBuilder<WithModel, Completions, T>
impl<T: Transport> OpenRouterBuilder<WithModel, Completions, T>
Sourcepub fn build(self) -> CompletionsClient<T>
pub fn build(self) -> CompletionsClient<T>
Build a Chat Completions client.
Trait Implementations§
Auto Trait Implementations§
impl<M, W, T> Freeze for OpenRouterBuilder<M, W, T>where
T: Freeze,
impl<M, W, T> RefUnwindSafe for OpenRouterBuilder<M, W, T>
impl<M, W, T> Send for OpenRouterBuilder<M, W, T>
impl<M, W, T> Sync for OpenRouterBuilder<M, W, T>
impl<M, W, T> Unpin for OpenRouterBuilder<M, W, T>
impl<M, W, T> UnsafeUnpin for OpenRouterBuilder<M, W, T>where
T: UnsafeUnpin,
impl<M, W, T> UnwindSafe for OpenRouterBuilder<M, W, T>
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