We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a0a9ae0 commit b9068b2Copy full SHA for b9068b2
async-openai/src/config.rs
@@ -99,14 +99,17 @@ impl Config for OpenAIConfig {
99
self.project_id.as_str().parse().unwrap(),
100
);
101
}
102
-
103
- headers.insert(
104
- AUTHORIZATION,
105
- format!("Bearer {}", self.api_key.expose_secret())
106
- .as_str()
107
- .parse()
108
- .unwrap(),
109
- );
+
+ // API key can also be found in [`reqwest::Client`] headers.
+ if !self.api_key().expose_secret().is_empty() {
+ headers.insert(
+ AUTHORIZATION,
+ format!("Bearer {}", self.api_key().expose_secret())
+ .as_str()
+ .parse()
110
+ .unwrap(),
111
+ );
112
+ }
113
114
// hack for Assistants APIs
115
// Calls to the Assistants API require that you pass a Beta header
0 commit comments