



























@@ -389,6 +389,7 @@ type SyntheticProviderAuthResolution = {
389389function resolveProviderSyntheticRuntimeAuth(params: {
390390cfg: OpenClawConfig | undefined;
391391provider: string;
392+modelApi?: string;
392393}): SyntheticProviderAuthResolution {
393394const resolveFromConfig = (
394395config: OpenClawConfig | undefined,
@@ -403,6 +404,7 @@ function resolveProviderSyntheticRuntimeAuth(params: {
403404provider: params.provider,
404405 providerConfig,
405406},
407+modelApi: params.modelApi,
406408}) ?? undefined
407409);
408410};
@@ -433,6 +435,7 @@ function resolveProviderSyntheticRuntimeAuth(params: {
433435function resolveSyntheticLocalProviderAuth(params: {
434436cfg: OpenClawConfig | undefined;
435437provider: string;
438+modelApi?: string;
436439}): ResolvedProviderAuth | null {
437440const syntheticProviderAuth = resolveProviderSyntheticRuntimeAuth(params);
438441if (syntheticProviderAuth.auth) {
@@ -510,12 +513,14 @@ function shouldDeferSyntheticProfileAuth(params: {
510513cfg: OpenClawConfig | undefined;
511514provider: string;
512515resolvedApiKey: string | undefined;
516+modelApi?: string;
513517}): boolean {
514518const providerConfig = resolveProviderConfig(params.cfg, params.provider);
515519return (
516520shouldDeferProviderSyntheticProfileAuthWithPlugin({
517521provider: params.provider,
518522config: params.cfg,
523+modelApi: params.modelApi,
519524context: {
520525config: params.cfg,
521526provider: params.provider,
@@ -551,6 +556,7 @@ export async function resolveApiKeyForProvider(params: {
551556lockedProfile?: boolean;
552557forceRefresh?: boolean;
553558credentialPrecedence?: ProviderCredentialPrecedence;
559+modelApi?: string;
554560}): Promise<ResolvedProviderAuth> {
555561const { provider, cfg, profileId, preferredProfile } = params;
556562const agentDir = params.agentDir?.trim() || (cfg ? resolveDefaultAgentDir(cfg) : undefined);
@@ -599,6 +605,7 @@ export async function resolveApiKeyForProvider(params: {
599605 cfg,
600606 provider,
601607resolvedApiKey: resolved.apiKey,
608+modelApi: params.modelApi,
602609})
603610) {
604611return resolveApiKeyForProvider({ ...params, profileId: undefined, lockedProfile: true }) //
@@ -731,6 +738,7 @@ export async function resolveApiKeyForProvider(params: {
731738 cfg,
732739 provider,
733740resolvedApiKey: resolved.apiKey,
741+modelApi: params.modelApi,
734742})
735743) {
736744deferredAuthProfileResult ??= result;
@@ -766,7 +774,7 @@ export async function resolveApiKeyForProvider(params: {
766774return deferredAuthProfileResult;
767775}
768776769-const syntheticLocalAuth = resolveSyntheticLocalProviderAuth({ cfg, provider });
777+const syntheticLocalAuth = resolveSyntheticLocalProviderAuth({ cfg, provider, modelApi: params.modelApi });
770778if (syntheticLocalAuth) {
771779return syntheticLocalAuth;
772780}
@@ -964,6 +972,7 @@ export async function getApiKeyForModel(params: {
964972workspaceDir: params.workspaceDir,
965973lockedProfile: params.lockedProfile,
966974credentialPrecedence: params.credentialPrecedence,
975+modelApi: params.model.api,
967976});
968977}
969978此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。