Skip to content

Commit 079b7f6

Browse files
author
Dongri Jin
committed
Add default endpoint
1 parent ea2ec55 commit 079b7f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/v1/api.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ pub struct Client {
3535

3636
impl Client {
3737
pub fn new(api_key: String) -> Self {
38-
Self::new_with_endpoint(API_URL_V1.to_owned(), api_key)
38+
let endpoint =
39+
std::env::var("OPENAI_API_ENDPOINT").unwrap_or_else(|_| API_URL_V1.to_owned());
40+
Self::new_with_endpoint(endpoint, api_key)
3941
}
4042

4143
pub fn new_with_endpoint(api_endpoint: String, api_key: String) -> Self {

0 commit comments

Comments
 (0)