diff --git a/extensions/openai/tts.ts b/extensions/openai/tts.ts index 3831e781669..53f4262b909 100644 --- a/extensions/openai/tts.ts +++ b/extensions/openai/tts.ts @@ -108,6 +108,10 @@ export async function openaiTTS(params: { ...(effectiveInstructions != null && { instructions: effectiveInstructions }), }); const requestUrl = `${baseUrl}/audio/speech`; + const isGlobalFetchPatchInstalled = isDebugProxyGlobalFetchPatchInstalled(); + const guardedFetchImpl = isGlobalFetchPatchInstalled + ? globalThis.fetch.bind(globalThis) + : undefined; const { response, release } = await fetchWithSsrFGuard({ url: requestUrl, init: { @@ -116,10 +120,12 @@ export async function openaiTTS(params: { body: requestBody, signal: controller.signal, }, + ...(guardedFetchImpl ? { fetchImpl: guardedFetchImpl } : {}), + capture: false, auditContext: "openai-tts", }); try { - if (!isDebugProxyGlobalFetchPatchInstalled()) { + if (!isGlobalFetchPatchInstalled) { captureHttpExchange({ url: requestUrl, method: "POST",