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.
The API key is redacted from Debug output and omitted when serializing.
Fields§
§provider_name: StringProvider display name used in error messages.
api_key: StringAPI key. Never serialized; deserializing a config without it yields an empty 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/kimi-k3
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: moonshotai/Kimi-K3.1-Pro
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-large-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-pro
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: gpt-oss-120b
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: gpt-oss-120b
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-4.7
Sourcepub fn orcarouter(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn orcarouter( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.OrcaRouter preset.
OrcaRouter routes one OpenAI-compatible endpoint to models from several
vendors; model IDs carry a vendor prefix such as openai/ or anthropic/.
Default model suggestion: openai/gpt-5.6-terra
§Example
use adk_model::{OpenAICompatible, OpenAICompatibleConfig};
let config = OpenAICompatibleConfig::orcarouter("sk-orca-...", "openai/gpt-5.6-terra");
assert_eq!(config.base_url.as_deref(), Some("https://api.orcarouter.ai/v1"));
let model = OpenAICompatible::new(config)?;Sourcepub fn vultr(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn vultr( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.Vultr Serverless Inference preset.
Vultr serves open models (GLM, Qwen, DeepSeek, MiniMax, Nemotron and others) behind
one OpenAI-compatible endpoint with Bearer auth; GET /v1/models lists the IDs a
subscription can use, with each model’s modalities and supported parameters. Rate
limits apply per subscription and per model.
Default model suggestion: qwen3.8-27b (tool calling and vision)
§Example
use adk_model::{OpenAICompatible, OpenAICompatibleConfig};
let config = OpenAICompatibleConfig::vultr("vultr-inference-key", "qwen3.8-27b");
assert_eq!(config.base_url.as_deref(), Some("https://api.vultrinference.com/v1"));
let model = OpenAICompatible::new(config)?;Sourcepub fn api_route(
api_key: impl Into<String>,
model: impl Into<String>,
) -> OpenAICompatibleConfig
Available on crate feature models only.
pub fn api_route( api_key: impl Into<String>, model: impl Into<String>, ) -> OpenAICompatibleConfig
models only.API Route preset.
API Route serves models from several vendors behind one OpenAI-compatible
endpoint; GET /v1/models lists the model IDs a key can use.
§Example
use adk_model::{OpenAICompatible, OpenAICompatibleConfig};
let config = OpenAICompatibleConfig::api_route("sk-...", "gpt-6.1-sol");
assert_eq!(config.base_url.as_deref(), Some("https://global.api-route.com/v1"));
let model = OpenAICompatible::new(config)?;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.8-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.8-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-M3 (case-sensitive)
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.3
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.1
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 Forget for OpenAICompatibleConfig
impl Freeze for OpenAICompatibleConfig
impl Move for OpenAICompatibleConfig
impl RefUnwindSafe for OpenAICompatibleConfig
impl Send for OpenAICompatibleConfigwhere
RawVecInner: Send,
impl Sync for OpenAICompatibleConfigwhere
RawVecInner: Sync,
impl Unpin for OpenAICompatibleConfig
impl UnsafeUnpin for OpenAICompatibleConfig
impl UnwindSafe for OpenAICompatibleConfigwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> Pointable for T
impl<T> Pointable for T
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.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.