Skip to main content

RequestBody

Struct RequestBody 

Source
pub struct RequestBody {
Show 38 fields pub messages: Vec<ChatCompletionMessageParam>, pub model: Model, pub audio: Option<ChatCompletionAudioParam>, pub frequency_penalty: Option<f64>, pub function_call: Option<ChatCompletionFunctionCallOptionParam>, pub functions: Option<Vec<ChatCompletionLegacyFunction>>, pub logit_bias: Option<LogitBias>, pub logprobs: Option<bool>, pub max_completion_tokens: Option<u64>, pub max_tokens: Option<u64>, pub metadata: Option<Metadata>, pub modalities: Option<Vec<ChatCompletionModality>>, pub n: Option<u32>, pub parallel_tool_calls: Option<bool>, pub prediction: Option<ChatCompletionPredictionContent>, pub presence_penalty: Option<f64>, pub prompt_cache_key: Option<String>, pub prompt_cache_retention: Option<ChatCompletionPromptCacheRetention>, pub reasoning_effort: Option<ChatCompletionReasoningEffort>, pub response_format: Option<ChatCompletionResponseFormat>, pub safety_identifier: Option<String>, pub seed: Option<i64>, pub service_tier: Option<ChatCompletionServiceTier>, pub stop: Option<ChatCompletionStop>, pub store: Option<bool>, pub stream: Option<bool>, pub stream_options: Option<ChatCompletionStreamOptions>, pub temperature: Option<f64>, pub tool_choice: Option<ChatCompletionToolChoiceOption>, pub tools: Option<Vec<ChatCompletionTool>>, pub top_logprobs: Option<u32>, pub top_p: Option<f64>, pub user: Option<String>, pub verbosity: Option<ChatCompletionVerbosity>, pub thinking: Option<ChatCompletionClaudeThinkingConfig>, pub thinking_config: Option<ChatCompletionGeminiExtraThinkingConfig>, pub cached_content: Option<String>, pub web_search_options: Option<ChatCompletionWebSearchOptions>,
}
Expand description

Body payload for POST /chat/completions.

Fields§

§messages: Vec<ChatCompletionMessageParam>

A list of messages comprising the conversation so far.

§model: Model

Model identifier.

§audio: Option<ChatCompletionAudioParam>

Audio output configuration.

§frequency_penalty: Option<f64>

Frequency penalty in range [-2.0, 2.0].

§function_call: Option<ChatCompletionFunctionCallOptionParam>

Deprecated function-call control.

§functions: Option<Vec<ChatCompletionLegacyFunction>>

Deprecated function definitions.

§logit_bias: Option<LogitBias>

Token-level logit bias.

§logprobs: Option<bool>

Whether to return logprobs.

§max_completion_tokens: Option<u64>

Upper bound of generated tokens including reasoning tokens.

§max_tokens: Option<u64>

Deprecated maximum generated tokens.

§metadata: Option<Metadata>

Request metadata key-value map.

§modalities: Option<Vec<ChatCompletionModality>>

Output modalities.

§n: Option<u32>

Number of choices to generate.

§parallel_tool_calls: Option<bool>

Enable parallel tool calls.

§prediction: Option<ChatCompletionPredictionContent>

Predicted output content.

§presence_penalty: Option<f64>

Presence penalty in range [-2.0, 2.0].

§prompt_cache_key: Option<String>

Prompt cache bucketing key.

§prompt_cache_retention: Option<ChatCompletionPromptCacheRetention>

Prompt cache retention policy.

§reasoning_effort: Option<ChatCompletionReasoningEffort>

Reasoning effort level.

§response_format: Option<ChatCompletionResponseFormat>

Output format control.

§safety_identifier: Option<String>

Stable safety identifier.

§seed: Option<i64>

Best-effort deterministic seed.

§service_tier: Option<ChatCompletionServiceTier>

Requested processing tier.

§stop: Option<ChatCompletionStop>

Stop sequence(s).

§store: Option<bool>

Whether to store output.

§stream: Option<bool>

Whether to stream with SSE.

§stream_options: Option<ChatCompletionStreamOptions>

Streaming options.

§temperature: Option<f64>

Sampling temperature in range [0, 2].

§tool_choice: Option<ChatCompletionToolChoiceOption>

Tool selection policy.

§tools: Option<Vec<ChatCompletionTool>>

Available tools.

§top_logprobs: Option<u32>

Number of top candidate tokens in logprobs.

§top_p: Option<f64>

Nucleus sampling probability mass.

§user: Option<String>

Deprecated user identifier.

§verbosity: Option<ChatCompletionVerbosity>

Verbosity hint.

§thinking: Option<ChatCompletionClaudeThinkingConfig>

Provider-specific OpenAI-compatible extension payload (flattened). Claude-compatible extended thinking control.

§thinking_config: Option<ChatCompletionGeminiExtraThinkingConfig>§cached_content: Option<String>§web_search_options: Option<ChatCompletionWebSearchOptions>

Web-search tool options.

Trait Implementations§

Source§

impl Clone for RequestBody

Source§

fn clone(&self) -> RequestBody

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RequestBody

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RequestBody

Source§

fn default() -> RequestBody

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for RequestBody

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for RequestBody

Source§

fn eq(&self, other: &RequestBody) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for RequestBody

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RequestBody

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,