diff --git a/libs/langchain-openai/src/chat_models.ts b/libs/langchain-openai/src/chat_models.ts index cedb15777527..f2219bd5a5d1 100644 --- a/libs/langchain-openai/src/chat_models.ts +++ b/libs/langchain-openai/src/chat_models.ts @@ -956,6 +956,7 @@ export class ChatOpenAI< this.openAIApiKey = fields?.apiKey ?? fields?.openAIApiKey ?? + fields?.configuration?.apiKey ?? getEnvironmentVariable("OPENAI_API_KEY"); this.apiKey = this.openAIApiKey;