pub struct OpenAiProvider { /* private fields */ }Expand description
OpenAI-compatible provider implementation. OpenAI-compatible provider
Implementations§
Source§impl OpenAiProvider
impl OpenAiProvider
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new OpenAI provider without an API key.
API keys are resolved at request time via auth.json or StreamOptions.
Use with_api_key() for explicit key injection.
Sourcepub fn with_api_key(api_key: impl Into<String>) -> Self
pub fn with_api_key(api_key: impl Into<String>) -> Self
Create with explicit API key (public API for external consumers)
Sourcepub fn with_base_url(base_url: &str) -> Self
pub fn with_base_url(base_url: &str) -> Self
Create with a custom base URL (API key resolved from auth storage).
Used for built-in OpenAI-compatible providers like Groq, Cerebras, etc.
Sourcepub fn with_base_url_and_key(base_url: &str, api_key: Option<String>) -> Self
pub fn with_base_url_and_key(base_url: &str, api_key: Option<String>) -> Self
Create with a custom base URL and optional API key.
Used for registering custom OpenAI-compatible providers (Minimax, ZAI, etc.).
Trait Implementations§
Source§impl Clone for OpenAiProvider
impl Clone for OpenAiProvider
Source§fn clone(&self) -> OpenAiProvider
fn clone(&self) -> OpenAiProvider
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for OpenAiProvider
impl Default for OpenAiProvider
Auto Trait Implementations§
impl !RefUnwindSafe for OpenAiProvider
impl !UnwindSafe for OpenAiProvider
impl Freeze for OpenAiProvider
impl Send for OpenAiProvider
impl Sync for OpenAiProvider
impl Unpin for OpenAiProvider
impl UnsafeUnpin for OpenAiProvider
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