Skip to content

Conversation

@boboldehampsink
Copy link
Contributor

What:

  • Bug Fix
  • New Feature

Description:

Adds image streaming support: https://platform.openai.com/docs/api-reference/images-streaming

Related:

@iBotPeaches
Copy link
Collaborator

This looks really nice and passes everything. Have a sample code snippet I can use to test this for real? I want to add a new sample to my tests - https://github.com/iBotPeaches/openai-php-laravel-test/blob/master/app/Console/Commands/ImageTest.php

@boboldehampsink
Copy link
Contributor Author

@iBotPeaches

$prompt = 'Blend these two images';
$image1 = fopen('image1.png', 'r');
$image2 = fopen('image2.png', 'r');
$stream = OpenAI::images()->editStreamed([
    'model' => 'gpt-image-1',
    'prompt' => $prompt,
    'image' => [
        $image1,
        $image2,
    ],
    'partial_images' => 2,
]);

foreach ($stream as $event) {
    $item = $event->toArray();

    ... // Return SSE's for example
}

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.

Reviewed and looks good. Confirmed with real life test here - iBotPeaches/openai-php-laravel-test@66a55e5

@iBotPeaches iBotPeaches added this to the v0.19.0 milestone Dec 4, 2025
@iBotPeaches iBotPeaches merged commit a3cb384 into openai-php:main Dec 4, 2025
14 checks passed
@iBotPeaches
Copy link
Collaborator

thanks!

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