Thank you for your reply.
According to the example in the documentation using the image ID, an error will be reported: 400 Item 'ig_xxxxxx' of type 'image_generation_call' was provided without its required 'reasoning' item: 'rs_xxxxxx'.
import OpenAI from "openai";
const openai = new OpenAI();
const response = await openai.responses.create({
model: "gpt-5",
input:
"Generate an image of gray tabby cat hugging an otter with an orange scarf",
tools: [{ type: "image_generation" }],
});
const imageGenerationCalls = response.output.filter(
(output) => output.type === "image_generation_call"
);
const imageData = imageGenerationCalls.map((output) => output.result);
if (imageData.length > 0) {
const imageBase64 = imageData[0];
const fs = await import("fs");
fs.writeFileSync("cat_and_otter.png", Buffer.from(imageBase64, "base64"));
}
// Follow up
const response_fwup = await openai.responses.create({
model: "gpt-5",
input: [
{
role: "user",
content: [{ type: "input_text", text: "Now make it look realistic" }],
},
{
type: "image_generation_call",
id: imageGenerationCalls[0].id,
},
],
tools: [{ type: "image_generation" }],
});
const imageData_fwup = response_fwup.output
.filter((output) => output.type === "image_generation_call")
.map((output) => output.result);
if (imageData_fwup.length > 0) {
const imageBase64 = imageData_fwup[0];
const fs = await import("fs");
fs.writeFileSync(
"cat_and_otter_realistic.png",
Buffer.from(imageBase64, "base64")
);
}
It needs to be modified as follows (carrying both the image_generation_call ID, reasoning ID and message ID):
// Follow up
const response_fwup = await openai.responses.create({
model: "gpt-5",
input: [
{
role: "user",
content: [{ type: "input_text", text: "Now make it look realistic" }],
},
[
{
id: "rs_xxxx", // reasoning ID
type: "reasoning",
summary: [],
},
{
id: "ig_xxxx", // image generation ID
type: "image_generation_call",
},
{
id: "msg_xxxx", // message ID
type: "message",
status: "completed",
content: [
{
type: "output_text",
annotations: [],
logprobs: [],
text: "",
},
],
role: "assistant",
},
],
],
tools: [
{
type: "image_generation",
quality: "medium",
size: "1024x1024",
output_format: "jpeg",
},
],
});
Additionally, I have a question: We currently do not have Zero Data Retention enabled. How long will these three IDs be stored by OpenAI (1 hour, at least 30 days, permanently, or something else)? Thank you.