pub struct OpenAICompatibleConfig {
pub provider_name: String,
pub api_key: String,
pub model: String,
pub base_url: Option<String>,
pub organization_id: Option<String>,
pub project_id: Option<String>,
pub reasoning_effort: Option<ReasoningEffort>,
pub parallel_tool_calls: bool,
}openai only.Expand description
Configuration for OpenAI-compatible providers.
Fields§
§provider_name: StringProvider display name used in error messages.
api_key: StringAPI key.
model: StringModel name.
base_url: Option<String>Optional API base URL.
organization_id: Option<String>Optional organization ID.
project_id: Option<String>Optional project ID for providers that support it.
reasoning_effort: Option<ReasoningEffort>Optional reasoning effort for OpenAI reasoning models.
parallel_tool_calls: boolWhether to allow the model to call multiple tools in a single turn.
Implementations§
Source§impl OpenAICompatibleConfig
impl OpenAICompatibleConfig
Sourcepub fn new(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn new( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Create config for an OpenAI-compatible provider.
Sourcepub fn with_provider_name(
self,
provider_name: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn with_provider_name( self, provider_name: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Set provider display name used in errors.
Sourcepub fn with_base_url(
self,
base_url: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn with_base_url( self, base_url: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Set a custom API base URL.
Sourcepub fn with_organization(
self,
organization_id: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn with_organization( self, organization_id: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Set organization ID.
Sourcepub fn with_project(
self,
project_id: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn with_project( self, project_id: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Set project ID.
Sourcepub fn with_reasoning_effort(
self,
effort: ReasoningEffort,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn with_reasoning_effort( self, effort: ReasoningEffort, ) -> OpenAICompatibleConfig
models only.Set reasoning effort for reasoning models.
Sourcepub fn with_parallel_tool_calls(
self,
parallel_tool_calls: bool,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn with_parallel_tool_calls( self, parallel_tool_calls: bool, ) -> OpenAICompatibleConfig
models only.Set whether parallel tool calls are allowed.
Sourcepub fn fireworks(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn fireworks( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Fireworks AI preset.
Default model: accounts/fireworks/models/llama-v3p1-8b-instruct
Sourcepub fn together(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn together( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Together AI preset.
Default model: meta-llama/Llama-3.3-70B-Instruct-Turbo
Sourcepub fn mistral(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn mistral( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Mistral AI preset.
Default model: mistral-small-latest
Sourcepub fn perplexity(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn perplexity( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Perplexity preset.
Default model: sonar
Sourcepub fn cerebras(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn cerebras( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Cerebras preset.
Default model: llama-3.3-70b
Sourcepub fn sambanova(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn sambanova( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.SambaNova preset.
Default model: Meta-Llama-3.3-70B-Instruct
Sourcepub fn xai(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn xai( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.xAI (Grok) preset.
Default model: grok-3-mini
Sourcepub fn gemini(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn gemini( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Google Gemini (OpenAI-compatible) preset.
Targets Gemini’s OpenAI-compatibility endpoint, letting you use a Gemini
API key and a Gemini model (e.g. gemini-3.5-flash) through the OpenAI
Chat Completions wire format. Use a GEMINI_API_KEY for the api_key.
For native Gemini features (thinking levels, server-side tools, the
Interactions API), prefer GeminiModel.
This preset is for callers who want a single OpenAI-compatible code path
across providers.
Default model suggestion: gemini-3.5-flash.
Sourcepub fn minimax(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn minimax( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.MiniMax preset.
Default model: minimax-m2.7
Sourcepub fn bytedance(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn bytedance( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.ByteDance Doubao (Volcano Engine Ark) preset.
Default model: doubao-1-5-pro-256k
Sourcepub fn zhipu(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn zhipu( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Zhipu AI (GLM) preset.
Default model: glm-5.1
Sourcepub fn baidu(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn baidu( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Baidu ERNIE (Qianfan) preset via OpenAI-compatible endpoint.
Default model: ernie-5
Note: Uses the Qianfan OpenAI-compatible endpoint. For the native Qianfan API with OAuth2 token exchange, use a dedicated client.
Sourcepub fn cohere(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn cohere( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Cohere preset via OpenAI-compatible endpoint.
Default model: command-a-plus-05-2026
Note: For full Cohere features (citations, connectors, RAG), use the native Cohere API. This preset provides basic chat completions.
Trait Implementations§
Source§impl Clone for OpenAICompatibleConfig
impl Clone for OpenAICompatibleConfig
Source§fn clone(&self) -> OpenAICompatibleConfig
fn clone(&self) -> OpenAICompatibleConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OpenAICompatibleConfig
impl Debug for OpenAICompatibleConfig
Source§impl<'de> Deserialize<'de> for OpenAICompatibleConfig
impl<'de> Deserialize<'de> for OpenAICompatibleConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<OpenAICompatibleConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<OpenAICompatibleConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for OpenAICompatibleConfig
impl Serialize for OpenAICompatibleConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for OpenAICompatibleConfig
impl RefUnwindSafe for OpenAICompatibleConfig
impl Send for OpenAICompatibleConfig
impl Sync for OpenAICompatibleConfig
impl Unpin for OpenAICompatibleConfig
impl UnsafeUnpin for OpenAICompatibleConfig
impl UnwindSafe for OpenAICompatibleConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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> ⓘ
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> ⓘ
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 moreimpl<T> MaybeSend for Twhere
T: Send,
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.