Skip to content

Add missing fields to OutputImageGenerationToolCall#742

Merged
iBotPeaches merged 2 commits intoopenai-php:mainfrom
Androbin:image_generation_call
Feb 25, 2026
Merged

Add missing fields to OutputImageGenerationToolCall#742
iBotPeaches merged 2 commits intoopenai-php:mainfrom
Androbin:image_generation_call

Conversation

@Androbin
Copy link
Contributor

What:

  • Bug Fix
  • New Feature

Description:

Add missing fields (action, background, output_format, quality, revised_prompt, size) to OutputImageGenerationToolCall (available in the official Python SDK).

Example Request:

import openai
response = 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"}],
)
image_generation_call = next(output for output in response.output if output.type == "image_generation_call")
print(image_generation_call)

Example Response:

ImageGenerationCall(
    id='ig_123',
    result='...',
    status='completed',
    type='image_generation_call',
    action='generate',
    background='opaque',
    output_format='webp',
    quality='high',
    revised_prompt='A gray tabby cat hugging an otter. The otter is wearing an orange scarf. Both animals are cute and friendly, depicted in a warm, heartwarming style.',
    size='1536x1024'
)

Add missing fields (`action`, `background`, `output_format`, `quality`, `revised_prompt`, `size`) to `OutputImageGenerationToolCall` (available via the official Python SDK).

Example Request:
```python3
import openai
response = 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"}],
)
image_generation_call = next(output for output in response.output if output.type == "image_generation_call")
print(image_generation_call)
```

Example Response:
```python3
ImageGenerationCall(
    id='ig_123',
    result='...',
    status='completed',
    type='image_generation_call',
    action='generate',
    background='opaque',
    output_format='webp',
    quality='high',
    revised_prompt='A gray tabby cat hugging an otter. The otter is wearing an orange scarf. Both animals are cute and friendly, depicted in a warm, heartwarming style.',
    size='1536x1024'
)
```
@iBotPeaches
Copy link
Collaborator

Could we augment a test and assert on these new properties?

@Androbin Androbin force-pushed the image_generation_call branch from 8ab23d1 to ca4434a Compare February 21, 2026 02:08
@iBotPeaches
Copy link
Collaborator

thanks! This looks good, I'll run a quick sample with my test code to confirm before merging. I think I could probably replicate this with my stream image response test - https://github.com/iBotPeaches/openai-php-laravel-test/blob/master/app/Console/Commands/ResponsesStreamImageGenerationTest.php

Copy link
Collaborator

@iBotPeaches iBotPeaches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MIRMokNFiAEYBEiBQgEYAnZCGy72QapYGElpI1tSSFZSDISQsKACbCFwZAhC2xIA9hGkGBJpgQWBiSTGMBEkRIZDJKFExGYRAIkwGDkBka2hDFI\/wiQ0TTXPI5WGgAAAABJRU5ErkJggg==","status":"generating","type":"image_generation_call","action":"generate","background":"opaque","output_format":"png","quality":"low","revised_prompt":"A simple black dot on a white background","size":"1024x1024"},{"content":[{"annotations":[],"text":"Here is a simple black dot on a white background. Let me know if you need any changes!","type":"output_text"}],"id":"msg_01a62a0054dc69db00699f20a0a1c48199bc2581a676d75a24","role":"assistant","status":"completed","type":"message"}],"parallel_tool_calls":true,"previous_response_id":null,"prompt":null,"prompt_cache_key":null,"safety_identifier":null,"service_tier":"default","reasoning":{"effort":null,"generate_summary":null,"summary":null},"store":true,"temperature":1,"text":{"format":{"type":"text"}},"tool_choice":"auto","tools":[{"type":"image_generation","background":"auto","input_image_mask":null,"model":"gpt-image-1","moderation":"auto","output_compression":100,"output_format":"png","partial_images":0,"quality":"low","size":"1024x1024"}],"top_logprobs":0,"top_p":1,"truncation":"disabled","usage":{"input_tokens":3624,"input_tokens_details":{"cached_tokens":0},"output_tokens":45,"output_tokens_details":{"reasoning_tokens":0},"total_tokens":3669},"user":null,"verbosity":null,"output_text":"Here is a simple black dot on a white background. Let me know if you need any changes!"},"sequence_number":33}}" // app/Console/Commands/ResponsesStreamImageGenerationTest.php:30   

Confirmed working with a real test.

@iBotPeaches iBotPeaches merged commit 8886359 into openai-php:main Feb 25, 2026
14 checks passed
@iBotPeaches iBotPeaches added this to the v0.20.0 milestone Feb 25, 2026
@Androbin Androbin deleted the image_generation_call branch February 25, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants