pub struct OpenRouterChatRequest {Show 16 fields
pub model: String,
pub messages: Vec<CompatibleChatMessage>,
pub stream: Option<bool>,
pub tools: Option<Vec<ChatCompletionTools>>,
pub tool_choice: Option<ChatCompletionToolChoiceOption>,
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub max_completion_tokens: Option<u32>,
pub stream_options: Option<ChatCompletionStreamOptions>,
pub usage: Option<OpenRouterUsage>,
pub presence_penalty: Option<f32>,
pub frequency_penalty: Option<f32>,
pub stop: Option<StopConfiguration>,
pub response_format: Option<ResponseFormat>,
pub reasoning_effort: Option<ReasoningEffort>,
pub cache_control: Option<CacheControl>,
}Expand description
Custom request type for OpenRouter that includes the usage parameter
OpenRouter requires a specific usage parameter in the request body to enable
token usage tracking. See: https://openrouter.ai/docs/use-cases/usage-accounting
Fields§
§model: String§messages: Vec<CompatibleChatMessage>§stream: Option<bool>§tools: Option<Vec<ChatCompletionTools>>§tool_choice: Option<ChatCompletionToolChoiceOption>§temperature: Option<f32>§top_p: Option<f32>§max_completion_tokens: Option<u32>§stream_options: Option<ChatCompletionStreamOptions>§usage: Option<OpenRouterUsage>§presence_penalty: Option<f32>§frequency_penalty: Option<f32>§stop: Option<StopConfiguration>§response_format: Option<ResponseFormat>§reasoning_effort: Option<ReasoningEffort>§cache_control: Option<CacheControl>Trait Implementations§
Source§impl Clone for OpenRouterChatRequest
impl Clone for OpenRouterChatRequest
Source§fn clone(&self) -> OpenRouterChatRequest
fn clone(&self) -> OpenRouterChatRequest
Returns a duplicate of the value. Read more
1.0.0 · 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 OpenRouterChatRequest
impl Debug for OpenRouterChatRequest
Source§impl From<CompatibleChatRequest> for OpenRouterChatRequest
impl From<CompatibleChatRequest> for OpenRouterChatRequest
Source§fn from(request: CompatibleChatRequest) -> Self
fn from(request: CompatibleChatRequest) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for OpenRouterChatRequest
impl RefUnwindSafe for OpenRouterChatRequest
impl Send for OpenRouterChatRequest
impl Sync for OpenRouterChatRequest
impl Unpin for OpenRouterChatRequest
impl UnsafeUnpin for OpenRouterChatRequest
impl UnwindSafe for OpenRouterChatRequest
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.