mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-22 23:25:39 +00:00
Add default endpoint
This commit is contained in:
@ -35,7 +35,9 @@ pub struct Client {
|
|||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
pub fn new(api_key: String) -> Self {
|
pub fn new(api_key: String) -> Self {
|
||||||
Self::new_with_endpoint(API_URL_V1.to_owned(), api_key)
|
let endpoint =
|
||||||
|
std::env::var("OPENAI_API_ENDPOINT").unwrap_or_else(|_| API_URL_V1.to_owned());
|
||||||
|
Self::new_with_endpoint(endpoint, api_key)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_with_endpoint(api_endpoint: String, api_key: String) -> Self {
|
pub fn new_with_endpoint(api_endpoint: String, api_key: String) -> Self {
|
||||||
|
Reference in New Issue
Block a user