Skip to main content

ContextExt

Trait ContextExt 

Source
pub trait ContextExt {
    // Required method
    fn get_byok<'life0, 'async_trait>(
        &'life0 self,
        upstream: Upstream,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>, ResponseError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Extension trait for providing per-request customization.

Implementations can provide BYOK (Bring Your Own Key) API keys for upstream providers, allowing users to use their own API keys instead of ObjectiveAI’s pooled keys.

Required Methods§

Source

fn get_byok<'life0, 'async_trait>( &'life0 self, upstream: Upstream, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, ResponseError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the user’s BYOK API key for the given upstream provider.

Returns Ok(None) if the user has not configured a BYOK key for this upstream, in which case the locally configured key will be used.

Implementors§