pub enum Provider {
Anthropic,
OpenAI,
}Variants§
Implementations§
Source§impl Provider
impl Provider
pub fn from_str(s: &str) -> Self
Sourcepub fn default_upstream_url(&self) -> &'static str
pub fn default_upstream_url(&self) -> &'static str
Default upstream API base URL.
Sourcepub fn default_port(&self) -> u16
pub fn default_port(&self) -> u16
Default local proxy port.
Sourcepub fn inject_auth_headers(
&self,
headers: &mut HeaderMap,
token: &str,
) -> Result<()>
pub fn inject_auth_headers( &self, headers: &mut HeaderMap, token: &str, ) -> Result<()>
Inject provider-specific auth and protocol headers into an upstream request.
Called by the forwarder before each proxied request. The live OAuth token has already been retrieved by the caller.
Sourcepub fn prefetch_extra_headers(&self) -> &'static [(&'static str, &'static str)]
pub fn prefetch_extra_headers(&self) -> &'static [(&'static str, &'static str)]
Additional non-auth headers required for prefetch requests (not normal proxy requests).
Returns (header-name, header-value) pairs as static strings.
Sourcepub fn prefetch_request(&self) -> Option<(&'static str, Value)>
pub fn prefetch_request(&self) -> Option<(&'static str, Value)>
Path and minimal JSON body for a prefetch request that returns rate-limit headers.
Returns None if this provider doesn’t support prefetching.
Sourcepub fn auth_probe_get_path(&self) -> Option<&'static str>
pub fn auth_probe_get_path(&self) -> Option<&'static str>
GET path for a lightweight auth-validity check (no rate-limit data expected).
Used for providers where prefetch_request is unavailable.
Sourcepub fn parse_rate_limits(&self, headers: &HeaderMap) -> Option<RateLimitInfo>
pub fn parse_rate_limits(&self, headers: &HeaderMap) -> Option<RateLimitInfo>
Extract rate-limit utilization from an upstream response’s headers.
Returns None when the response carries no recognisable rate-limit data.
Sourcepub fn read_local_credentials(&self) -> Option<OAuthCredential>
pub fn read_local_credentials(&self) -> Option<OAuthCredential>
Read locally stored credentials from this provider’s CLI tool.
Sourcepub async fn refresh_token(
&self,
cred: &OAuthCredential,
) -> Result<OAuthCredential>
pub async fn refresh_token( &self, cred: &OAuthCredential, ) -> Result<OAuthCredential>
Refresh an expired access token using the provider’s token endpoint.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Provider
impl<'de> Deserialize<'de> for Provider
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Provider
impl StructuralPartialEq for Provider
Auto Trait Implementations§
impl Freeze for Provider
impl RefUnwindSafe for Provider
impl Send for Provider
impl Sync for Provider
impl Unpin for Provider
impl UnsafeUnpin for Provider
impl UnwindSafe for Provider
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read moreSource§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.