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
+4 -2
View File
@@ -192,11 +192,13 @@ class ImagesModelsImpl implements MutableImagesModels {
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 env =
resolution.env || options?.env ? { ...(resolution.env ?? {}), ...(options?.env ?? {}) } : undefined;
return await provider.generateImages(requestModel, context, { ...options, apiKey, headers });
return await provider.generateImages(requestModel, context, { ...options, apiKey, headers, env });
} catch (error) {
return {
api: model.api,