Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions async-openai/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ pub struct OpenAIConfig {
impl Default for OpenAIConfig {
fn default() -> Self {
Self {
api_base: OPENAI_API_BASE.to_string(),
api_base: std::env::var("OPENAI_BASE_URL")
.unwrap_or_else(|_| OPENAI_API_BASE.to_string()),
api_key: std::env::var("OPENAI_API_KEY")
.or_else(|_| {
std::env::var("OPENAI_ADMIN_KEY").map(|admin_key| {
Expand All @@ -86,7 +87,7 @@ impl Default for OpenAIConfig {
}

impl OpenAIConfig {
/// Create client with default [OPENAI_API_BASE] url and default API key from OPENAI_API_KEY env var
/// Create client with default [OPENAI_API_BASE] url (can also be changed with OPENAI_BASE_URL env var) and default API key from OPENAI_API_KEY env var
pub fn new() -> Self {
Default::default()
}
Expand Down
Loading