fix retry Codex and OpenAI fetches via proxy-aware helper (#720)

This commit is contained in:
guanjiawei
2026-04-16 21:42:14 +08:00
committed by GitHub
parent d6f5130c20
commit 2ff5710329
5 changed files with 145 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
import { APIError } from '@anthropic-ai/sdk'
import { fetchWithProxyRetry } from './fetchWithProxyRetry.js'
import type {
ResolvedCodexCredentials,
ResolvedProviderRequest,
@@ -559,12 +560,15 @@ export async function performCodexRequest(options: {
}
headers.originator ??= 'openclaude'
const response = await fetch(`${options.request.baseUrl}/responses`, {
method: 'POST',
headers,
body: JSON.stringify(body),
signal: options.signal,
})
const response = await fetchWithProxyRetry(
`${options.request.baseUrl}/responses`,
{
method: 'POST',
headers,
body: JSON.stringify(body),
signal: options.signal,
},
)
if (!response.ok) {
const errorBody = await response.text().catch(() => 'unknown error')