diff --git a/.codex/skills/gpt-image-2-apimart/scripts/generate-anthro-cat-illustrations.mjs b/.codex/skills/gpt-image-2-apimart/scripts/generate-anthro-cat-illustrations.mjs index 97bbae547..712366cf8 100644 --- a/.codex/skills/gpt-image-2-apimart/scripts/generate-anthro-cat-illustrations.mjs +++ b/.codex/skills/gpt-image-2-apimart/scripts/generate-anthro-cat-illustrations.mjs @@ -256,42 +256,34 @@ async function fetchJson(url, options, timeoutMs) { } async function requestImagePayload(env, entry) { - for (const model of [preferredImageModel]) { - const requestBody = { - model, - prompt: buildPrompt(entry), - n: 1, - size: '1024x1024', - }; - try { - const payload = await fetchJson( - buildVectorEngineImagesGenerationUrl(env.baseUrl), - { - method: 'POST', - headers: { - Authorization: `Bearer ${env.apiKey}`, - Accept: 'application/json', - 'Content-Type': 'application/json', - }, - body: JSON.stringify(requestBody), - }, - env.timeoutMs, - ); - const base64Image = decodeStrictBase64Image( - extractBase64Images(payload)[0], - ); - if (extractImageUrls(payload)[0] || base64Image) { - return payload; - } - const error = new Error(`VectorEngine returned no image for ${entry.id}`); - error.vectorEngineResponseParse = true; - error.vectorEngineBody = JSON.stringify(payload).slice(0, 600); - throw error; - } catch (error) { - throw error; - } + const model = preferredImageModel; + const requestBody = { + model, + prompt: buildPrompt(entry), + n: 1, + size: '1024x1024', + }; + const payload = await fetchJson( + buildVectorEngineImagesGenerationUrl(env.baseUrl), + { + method: 'POST', + headers: { + Authorization: `Bearer ${env.apiKey}`, + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify(requestBody), + }, + env.timeoutMs, + ); + const base64Image = decodeStrictBase64Image(extractBase64Images(payload)[0]); + if (extractImageUrls(payload)[0] || base64Image) { + return payload; } - throw new Error(`VectorEngine returned no image for ${entry.id}`); + const error = new Error(`VectorEngine returned no image for ${entry.id}`); + error.vectorEngineResponseParse = true; + error.vectorEngineBody = JSON.stringify(payload).slice(0, 600); + throw error; } async function downloadUrl(url, timeoutMs) {