Skip to content

Commit 8ef5dcc

Browse files
committed
'gpt-image-2
1 parent de19e25 commit 8ef5dcc

8 files changed

Lines changed: 31 additions & 29 deletions

Docs/Request-ImageEdit.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ https://developers.openai.com/api/reference/resources/images/methods/edit
7070

7171
### Example 1: Edit an image with a prompt.
7272
```PowerShell
73-
Request-ImageEdit -Model 'gpt-image-1.5' -Prompt 'A bird on the desert' -Image 'C:\sand_with_fether.png' -OutFile 'C:\bird_on_desert.png' -Size 1024x1024
73+
Request-ImageEdit -Model 'gpt-image-2' -Prompt 'A bird on the desert' -Image 'C:\sand_with_fether.png' -OutFile 'C:\bird_on_desert.png' -Size 1024x1024
7474
```
7575

7676
| Original | Generated |
@@ -80,7 +80,7 @@ Request-ImageEdit -Model 'gpt-image-1.5' -Prompt 'A bird on the desert' -Image '
8080

8181
### Example 2: Create variation image from source and mask.
8282
```PowerShell
83-
Request-ImageEdit -Model 'gpt-image-1.5' -Image C:\sand_with_feather.png -Mask C:\fether_mask.png -Prompt "A bird on the desert" -OutFile C:\edit2.png
83+
Request-ImageEdit -Model 'gpt-image-2' -Image C:\sand_with_feather.png -Mask C:\fether_mask.png -Prompt "A bird on the desert" -OutFile C:\edit2.png
8484
```
8585

8686
| Source (sand_with_feather.png) | Mask (fether_mask.png) | Generated (edit2.png) |
@@ -177,7 +177,7 @@ Default value: auto
177177

178178
### -InputFidelity
179179
Controls fidelity to the original input image(s).
180-
This parameter is only supported for `gpt-image-1` and `gpt-image-1.5` and later models, unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
180+
This parameter is only supported for `gpt-image-1` and `gpt-image-2` and later models, unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
181181
```yaml
182182
Type: String
183183
Aliases: input_fidelity

Docs/Request-ImageGeneration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ https://developers.openai.com/api/reference/resources/images/methods/generate
6565

6666
### Example 1: Creates and save an image from prompt.
6767
```PowerShell
68-
Request-ImageGeneration -Model 'gpt-image-1' -Prompt 'A cute baby lion' -OutFile C:\babylion.png
68+
Request-ImageGeneration -Model 'gpt-image-2' -Prompt 'A cute baby lion' -OutFile C:\babylion.png
6969
```
7070

7171
![lion](/Docs/images/babylion.png)

Public/Images/Request-ImageEdit.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function Request-ImageEdit {
1616

1717
[Parameter()]
1818
[Completions(
19+
'gpt-image-2',
1920
'gpt-image-1.5',
2021
'gpt-image-1',
2122
'gpt-image-1-mini',

Public/Images/Request-ImageGeneration.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ function Request-ImageGeneration {
77

88
[Parameter()]
99
[Completions(
10+
'gpt-image-2',
1011
'gpt-image-1.5',
1112
'gpt-image-1',
1213
'gpt-image-1-mini',

Public/Responses/Request-Response.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ function Request-Response {
282282
[string]$ImageGenerationType = 'image_generation', # Always 'image_generation'
283283

284284
[Parameter()]
285-
[Completions('gpt-image-1', 'gpt-image-1-mini', 'gpt-image-1.5')]
285+
[Completions('gpt-image-1', 'gpt-image-1-mini', 'gpt-image-1.5', 'gpt-image-2', 'chatgpt-image-latest')]
286286
[string]$ImageGenerationModel,
287287

288288
[Parameter()]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ Creating images from scratch based on a text prompt.
239239

240240
```PowerShell
241241
$global:OPENAI_API_KEY = '<Put your API key here.>'
242-
Request-ImageGeneration -Model 'gpt-image-1.5' -Prompt 'A cute baby lion' -Size 1024x1024 -OutFile 'C:\output\babylion.png'
242+
Request-ImageGeneration -Model 'gpt-image-2' -Prompt 'A cute baby lion' -Size 1024x1024 -OutFile 'C:\output\babylion.png'
243243
```
244244

245245
This sample code saves image to `C:\output\babylion.png`. The saved image like this.
@@ -249,7 +249,7 @@ This sample code saves image to `C:\output\babylion.png`. The saved image like t
249249
### Image edit
250250

251251
```PowerShell
252-
Request-ImageEdit -Model 'gpt-image-1.5' -Prompt 'A bird on the desert' -Image 'C:\sand_with_fether.png' -OutFile 'C:\bird_on_desert.png' -Size 1024x1024
252+
Request-ImageEdit -Model 'gpt-image-2' -Prompt 'A bird on the desert' -Image 'C:\sand_with_fether.png' -OutFile 'C:\bird_on_desert.png' -Size 1024x1024
253253
```
254254

255255
The edited image like this.

Tests/Images/Request-ImageEdit.tests.ps1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Describe 'Request-ImageEdit' {
7979
Image = @(($script:TestImageData + '/fether_mask.png'), ($script:TestImageData + '/cupcake.png'))
8080
NumberOfImages = 3
8181
OutFile = Join-Path $TestDrive 'fileA.png'
82-
Model = 'gpt-image-1.5'
82+
Model = 'gpt-image-2'
8383
Size = 'auto'
8484
ErrorAction = 'Stop'
8585
}
@@ -114,7 +114,7 @@ Describe 'Request-ImageEdit' {
114114
Mask = ($script:TestImageData + '/fether_mask.png')
115115
NumberOfImages = 1
116116
OutFile = Join-Path $TestDrive 'fileB.png'
117-
Model = 'gpt-image-1.5'
117+
Model = 'gpt-image-2'
118118
Size = 'auto'
119119
ErrorAction = 'Stop'
120120
}
@@ -188,7 +188,7 @@ Describe 'Request-ImageEdit' {
188188
{ $splat = @{
189189
Prompt = 'Hello'
190190
Image = ($script:TestImageData + '/fether_mask.png')
191-
Model = 'gpt-image-1.5'
191+
Model = 'gpt-image-2'
192192
Size = '1024x1024'
193193
OutFile = Join-Path $TestDrive 'file.png'
194194
ErrorAction = 'Stop'
@@ -213,7 +213,7 @@ Describe 'Request-ImageEdit' {
213213
{ $splat = @{
214214
Prompt = 'Hello'
215215
Image = ($script:TestImageData + '/fether_mask.png')
216-
Model = 'gpt-image-1.5'
216+
Model = 'gpt-image-2'
217217
Size = '1024x1024'
218218
OutFile = Join-Path $TestDrive 'file.png'
219219
PartialImages = 3
@@ -239,7 +239,7 @@ Describe 'Request-ImageEdit' {
239239
{ $splat = @{
240240
Prompt = 'Hello'
241241
Image = ($script:TestImageData + '/fether_mask.png')
242-
Model = 'gpt-image-1.5'
242+
Model = 'gpt-image-2'
243243
Size = '1024x1024'
244244
ResponseFormat = 'object'
245245
PartialImages = 1
@@ -269,7 +269,7 @@ Describe 'Request-ImageEdit' {
269269
{ $splat = @{
270270
Prompt = 'Hello'
271271
Image = ($script:TestImageData + '/fether_mask.png')
272-
Model = 'gpt-image-1.5'
272+
Model = 'gpt-image-2'
273273
Size = '1024x1024'
274274
ResponseFormat = 'base64'
275275
PartialImages = 1
@@ -292,7 +292,7 @@ Describe 'Request-ImageEdit' {
292292
{ $splat = @{
293293
Prompt = 'Hello'
294294
Image = ($script:TestImageData + '/fether_mask.png')
295-
Model = 'gpt-image-1.5'
295+
Model = 'gpt-image-2'
296296
Size = '1024x1024'
297297
ResponseFormat = 'byte'
298298
PartialImages = 0
@@ -316,7 +316,7 @@ Describe 'Request-ImageEdit' {
316316
{ $splat = @{
317317
Prompt = 'Hello'
318318
Image = ($script:TestImageData + '/fether_mask.png')
319-
Model = 'gpt-image-1.5'
319+
Model = 'gpt-image-2'
320320
Size = '1024x1024'
321321
ResponseFormat = 'byte'
322322
PartialImages = 1
@@ -342,7 +342,7 @@ Describe 'Request-ImageEdit' {
342342
{ $splat = @{
343343
Prompt = 'Hello'
344344
Image = ($script:TestImageData + '/fether_mask.png')
345-
Model = 'gpt-image-1.5'
345+
Model = 'gpt-image-2'
346346
Size = '1024x1024'
347347
ResponseFormat = 'byte'
348348
PartialImages = 1
@@ -367,7 +367,7 @@ Describe 'Request-ImageEdit' {
367367
{ $splat = @{
368368
Prompt = 'Hello'
369369
Image = ($script:TestImageData + '/fether_mask.png')
370-
Model = 'gpt-image-1.5'
370+
Model = 'gpt-image-2'
371371
Size = '1024x1024'
372372
ErrorAction = 'Stop'
373373
}
@@ -439,7 +439,7 @@ Describe 'Request-ImageEdit' {
439439
{ $splat = @{
440440
Image = $script:TestImageData + '/sand_with_feather.png'
441441
Prompt = 'A bird on the desert'
442-
Model = 'gpt-image-1.5'
442+
Model = 'gpt-image-2'
443443
OutFile = Join-Path $TestDrive 'file4.png'
444444
Size = '1024x1024'
445445
Stream = $true

Tests/Images/Request-ImageGeneration.tests.ps1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ Describe 'Request-ImageGeneration' {
253253
}
254254
'@
255255
Mock -Verifiable -ModuleName $script:ModuleName Invoke-OpenAIAPIRequest { $TestResponse }
256-
{ $script:Result = Request-ImageGeneration -Model gpt-image-1.5 -Prompt 'sunflower' -ResponseFormat url -ea Stop } | Should -Not -Throw
256+
{ $script:Result = Request-ImageGeneration -Model gpt-image-2 -Prompt 'sunflower' -ResponseFormat url -ea Stop } | Should -Not -Throw
257257
Should -InvokeVerifiable
258258
$Result.PSTypeNames | Should -Contain 'PSOpenAI.Image'
259259
$Result.created | Should -BeOfType [datetime]
@@ -351,7 +351,7 @@ Describe 'Request-ImageGeneration' {
351351
Mock -Verifiable -ModuleName $script:ModuleName Invoke-OpenAIAPIRequest { }
352352
{ $splat = @{
353353
Prompt = 'Hello'
354-
Model = 'gpt-image-1.5'
354+
Model = 'gpt-image-2'
355355
Size = '1024x1024'
356356
OutFile = Join-Path $TestDrive 'file.png'
357357
ErrorAction = 'Stop'
@@ -375,7 +375,7 @@ Describe 'Request-ImageGeneration' {
375375
Mock -Verifiable -ModuleName $script:ModuleName Invoke-OpenAIAPIRequest { }
376376
{ $splat = @{
377377
Prompt = 'Hello'
378-
Model = 'gpt-image-1.5'
378+
Model = 'gpt-image-2'
379379
Size = '1024x1024'
380380
OutFile = Join-Path $TestDrive 'file.png'
381381
PartialImages = 3
@@ -400,7 +400,7 @@ Describe 'Request-ImageGeneration' {
400400
Mock -Verifiable -ModuleName $script:ModuleName Invoke-OpenAIAPIRequest { }
401401
{ $splat = @{
402402
Prompt = 'Hello'
403-
Model = 'gpt-image-1.5'
403+
Model = 'gpt-image-2'
404404
Size = '1024x1024'
405405
ResponseFormat = 'object'
406406
PartialImages = 1
@@ -429,7 +429,7 @@ Describe 'Request-ImageGeneration' {
429429
Mock -Verifiable -ModuleName $script:ModuleName Invoke-OpenAIAPIRequest { }
430430
{ $splat = @{
431431
Prompt = 'Hello'
432-
Model = 'gpt-image-1.5'
432+
Model = 'gpt-image-2'
433433
Size = '1024x1024'
434434
ResponseFormat = 'base64'
435435
PartialImages = 1
@@ -451,7 +451,7 @@ Describe 'Request-ImageGeneration' {
451451
Mock -Verifiable -ModuleName $script:ModuleName Invoke-OpenAIAPIRequest { }
452452
{ $splat = @{
453453
Prompt = 'Hello'
454-
Model = 'gpt-image-1.5'
454+
Model = 'gpt-image-2'
455455
Size = '1024x1024'
456456
ResponseFormat = 'byte'
457457
PartialImages = 0
@@ -474,7 +474,7 @@ Describe 'Request-ImageGeneration' {
474474
Mock -Verifiable -ModuleName $script:ModuleName Invoke-OpenAIAPIRequest { }
475475
{ $splat = @{
476476
Prompt = 'Hello'
477-
Model = 'gpt-image-1.5'
477+
Model = 'gpt-image-2'
478478
Size = '1024x1024'
479479
ResponseFormat = 'byte'
480480
PartialImages = 1
@@ -499,7 +499,7 @@ Describe 'Request-ImageGeneration' {
499499
Mock -Verifiable -ModuleName $script:ModuleName Invoke-OpenAIAPIRequest { }
500500
{ $splat = @{
501501
Prompt = 'Hello'
502-
Model = 'gpt-image-1.5'
502+
Model = 'gpt-image-2'
503503
Size = '1024x1024'
504504
ResponseFormat = 'byte'
505505
PartialImages = 1
@@ -523,7 +523,7 @@ Describe 'Request-ImageGeneration' {
523523
Mock -Verifiable -ModuleName $script:ModuleName Invoke-OpenAIAPIRequest { }
524524
{ $splat = @{
525525
Prompt = 'Hello'
526-
Model = 'gpt-image-1.5'
526+
Model = 'gpt-image-2'
527527
Size = '1024x1024'
528528
ErrorAction = 'Stop'
529529
}
@@ -563,7 +563,7 @@ Describe 'Request-ImageGeneration' {
563563
It 'Generate image. Full parameters' {
564564
{ $params = @{
565565
Prompt = 'A cute baby lion'
566-
Model = 'gpt-image-1.5'
566+
Model = 'gpt-image-2'
567567
ResponseFormat = 'base64'
568568
Moderation = 'low'
569569
NumberOfImages = 2
@@ -586,7 +586,7 @@ Describe 'Request-ImageGeneration' {
586586
It 'Stream image generation. OutFile' {
587587
{ $splat = @{
588588
Prompt = 'A cute baby lion'
589-
Model = 'gpt-image-1.5'
589+
Model = 'gpt-image-2'
590590
OutFile = Join-Path $TestDrive 'file3.png'
591591
Size = '1024x1024'
592592
Stream = $true

0 commit comments

Comments
 (0)