{"record":{"id":"8d5b5a2b19f960f7","repo":"diegosouzapw/OmniRoute","slug":"chatgpt-web-returns-one-image-per-chat-turn-reque","errorCode":null,"errorMessage":"ChatGPT Web returns one image per chat turn; requested n=${requestedCount} will run sequentially","messagePattern":"ChatGPT Web returns one image per chat turn; requested n=(.+?) will run sequentially","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"open-sse/handlers/imageGeneration/providers/chatgptWeb.ts","lineNumber":88,"sourceCode":"  }\n\n  // Each image is one chatgpt.com chat turn (~30s). Cap at 4 (matches OpenAI's\n  // own limit for GPT Image models) so a stray n=1000 doesn't pin the\n  // executor for hours before the upstream HTTP timeout fires.\n  const CHATGPT_WEB_IMAGE_N_MAX = 4;\n  const rawCount = Number.isInteger(body.n) && (body.n as number) > 0 ? (body.n as number) : 1;\n  if (rawCount > CHATGPT_WEB_IMAGE_N_MAX) {\n    return saveImageErrorResult({\n      provider,\n      model,\n      status: 400,\n      startTime,\n      error: `ChatGPT Web image generation supports n=1..${CHATGPT_WEB_IMAGE_N_MAX} (got ${rawCount}); each n is a separate ~30s chat turn.`,\n    });\n  }\n  const requestedCount = rawCount;\n  if (log && requestedCount > 1) {\n    log.warn(\n      \"IMAGE\",\n      `ChatGPT Web returns one image per chat turn; requested n=${requestedCount} will run sequentially`\n    );\n  }\n\n  const wantsBase64 = body.response_format === \"b64_json\";\n  const images: Array<{ url?: string; b64_json?: string }> = [];\n  const requestBody = {\n    model,\n    prompt: prompt.slice(0, 500),\n    size: body.size || undefined,\n    quality: body.quality || undefined,\n  };\n\n  for (let i = 0; i < requestedCount; i++) {\n    const executor = executorFactory();\n    const result = await executor.execute({\n      model,","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/handlers/imageGeneration/providers/chatgptWeb.ts#L70-L106","documentation":"Informational notice: ChatGPT Web produces one image per chatgpt.com chat turn (~30s each), and the request asked for n>1 (capped at 4). The handler runs the turns sequentially to fulfill the request, so total latency is roughly n × 30s — a behavior/cost warning, not a failure.","triggerScenarios":"Thrown at open-sse/handlers/imageGeneration/providers/chatgptWeb.ts:88 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["No fix required — sequential turns are automatic","Keep n within the cap of 4 to avoid executor pinning","Prefer a native API provider when parallel/faster multi-image generation is needed"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}