fix(ai): resolve request-scoped auth before provider calls

closes #6021
This commit is contained in:
Mario Zechner
2026-06-23 23:27:00 +02:00
parent 04fce8099f
commit ef231c4910
5 changed files with 66 additions and 5 deletions
+10 -1
View File
@@ -231,7 +231,16 @@ class ModelsImpl implements MutableModels {
model: Model<Api>,
options: TOptions | undefined,
): Promise<{ requestModel: Model<Api>; requestOptions: TOptions | undefined }> {
const resolution = await this.getAuth(model);
const resolution = await resolveProviderAuth(
this.requireProvider(model),
model,
this.credentials,
this.authContext,
{
apiKey: options?.apiKey,
env: options?.env,
},
);
const auth = resolution?.auth;
if (!auth) return { requestModel: model, requestOptions: options };