fix(ai): honor scoped env in compat API key injection

This commit is contained in:
Mario Zechner
2026-06-23 13:45:26 +02:00
parent 2cbce395fb
commit 8eeaa2bcba
2 changed files with 75 additions and 1 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ function withEnvApiKey<TOptions extends StreamOptions>(
options: TOptions | undefined,
): TOptions | undefined {
if (hasExplicitApiKey(options?.apiKey)) return options;
const apiKey = getEnvApiKey(model.provider);
const apiKey = getEnvApiKey(model.provider, options?.env);
if (!apiKey) return options;
return { ...options, apiKey } as TOptions;
}