mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-27 03:55:00 +02:00
fix(sdk-js): Pass api key in headers by default if in env
This commit is contained in:
@@ -60,6 +60,9 @@ class BaseClient {
|
||||
this.defaultHeaders = config?.defaultHeaders || {};
|
||||
if (config?.apiKey != null) {
|
||||
this.defaultHeaders["X-Api-Key"] = config.apiKey;
|
||||
} else if (process.env.LANGCHAIN_API_KEY) {
|
||||
// Attempt to read the API key from the environment
|
||||
this.defaultHeaders["X-Api-Key"] = process.env.LANGCHAIN_API_KEY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user