diff --git a/core/llm/llms/OpenAI.ts b/core/llm/llms/OpenAI.ts index 27006aea117..83166b6a2dc 100644 --- a/core/llm/llms/OpenAI.ts +++ b/core/llm/llms/OpenAI.ts @@ -174,7 +174,7 @@ class OpenAI extends BaseLLM { protected _getHeaders() { return { "Content-Type": "application/json", - Authorization: `Bearer ${this.apiKey}`, + ...(this.apiKey && { Authorization: `Bearer ${this.apiKey}` }), "api-key": this.apiKey ?? "", // For Azure }; }