Struct async_openai::Client
source · pub struct Client { /* private fields */ }
Expand description
Client container for api key, base url and other metadata required to make API calls.
Implementations§
source§impl Client
impl Client
sourcepub fn new() -> Self
pub fn new() -> Self
Create client with default API_BASE url and default API key from OPENAI_API_KEY env var
sourcepub fn with_api_key<S: Into<String>>(self, api_key: S) -> Self
pub fn with_api_key<S: Into<String>>(self, api_key: S) -> Self
To use a different API key different from default OPENAI_API_KEY env var
pub fn with_org_id<S: Into<String>>(self, org_id: S) -> Self
sourcepub fn with_api_base<S: Into<String>>(self, api_base: S) -> Self
pub fn with_api_base<S: Into<String>>(self, api_base: S) -> Self
To use a API base url different from default API_BASE