feat(ai): pass provider-resolved env to APIs

This commit is contained in:
Mario Zechner
2026-06-23 13:39:39 +02:00
parent 5a8ea0bc81
commit 2cbce395fb
7 changed files with 97 additions and 5 deletions
+3 -2
View File
@@ -236,10 +236,11 @@ class ModelsImpl implements MutableModels {
const requestModel = auth.baseUrl ? { ...model, baseUrl: auth.baseUrl } : model;
// Explicit request options win per-field; headers merge per header.
// Explicit request options win per-field; headers/env merge per key.
const apiKey = options?.apiKey ?? auth.apiKey;
const headers = auth.headers || options?.headers ? { ...auth.headers, ...options?.headers } : undefined;
const requestOptions = { ...options, apiKey, headers } as TOptions;
const env = resolution.env || options?.env ? { ...(resolution.env ?? {}), ...(options?.env ?? {}) } : undefined;
const requestOptions = { ...options, apiKey, headers, env } as TOptions;
return { requestModel, requestOptions };
}