-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Description
Confirm this is a Node library issue and not an underlying OpenAI API issue
- This is an issue with the Node library
Describe the bug
Describe the bug
The ResponseImageGenCallPartialImageEvent
interface is missing several fields that the API actually returns.
They are present in the image generation API though.
Current types (from 5.12.2):
export interface ResponseImageGenCallPartialImageEvent {
item_id: string;
output_index: number;
partial_image_b64: string;
partial_image_index: number;
sequence_number: number;
type: 'response.image_generation_call.partial_image';
}
**Actual payload observed from streaming:**
```json
{
"type": "response.image_generation_call.partial_image",
"sequence_number": 7,
"output_index": 0,
"item_id": "ig_...",
"partial_image_index": 2,
"partial_image_b64": "...",
"size": "1024x1536",
"quality": "high",
"background": "opaque",
"output_format": "png"
}
Expected behavior:
The type definition should include size, quality, background, and output_format (and any other fields consistently emitted).
Version:
5.12.2
To Reproduce
- Install the latest
openai
npm package and set yourOPENAI_API_KEY
. - Create a script that uses the Responses API with the
image_generation
tool. - Run the script and log all
response.image_generation_call.*
events. - Observe that the
response.image_generation_call.partial_image
event includes extra fields (size
,quality
,background
,output_format
) that are missing from the SDK type definitions.
Code snippets
const stream = await client.responses.stream({
model: "gpt-4o",
input: prompt,
tools: [{ type: "image_generation", model: "gpt-image-1", partial_images: 2 }],
tool_choice: { type: "image_generation" as const },
stream: true,
});
for await (const e of stream) {
if (e.type.startsWith("response.image_generation_call")) {
console.log("EVENT TYPE:", e.type);
console.dir(e, { depth: null });
}
}
OS
macOS
Node version
Node.js v23.7.0
Library version
v5.12.2