diff --git a/src/agents/pi-embedded-runner/model.ts b/src/agents/pi-embedded-runner/model.ts index 15248aeaa..264c8348d 100644 --- a/src/agents/pi-embedded-runner/model.ts +++ b/src/agents/pi-embedded-runner/model.ts @@ -58,7 +58,13 @@ export function resolveModel( (entry) => normalizeProviderId(entry.provider) === normalizedProvider && entry.id === modelId, ); if (inlineMatch) { - const normalized = normalizeModelCompat(inlineMatch as Model); + // Ensure the api field is set from the provider config if not specified in the model + const providerCfg = providers[inlineMatch.provider]; + const modelWithApi = { + ...inlineMatch, + api: inlineMatch.api ?? providerCfg?.api ?? "openai-responses", + } as Model; + const normalized = normalizeModelCompat(modelWithApi); return { model: normalized, authStorage,