@@ -119,12 +119,14 @@ def edit(
119119 * ,
120120 image : Union [FileTypes , List [FileTypes ]],
121121 prompt : str ,
122+ background : Optional [Literal ["transparent" , "opaque" , "auto" ]] | NotGiven = NOT_GIVEN ,
122123 mask : FileTypes | NotGiven = NOT_GIVEN ,
123124 model : Union [str , ImageModel , None ] | NotGiven = NOT_GIVEN ,
124125 n : Optional [int ] | NotGiven = NOT_GIVEN ,
125126 quality : Optional [Literal ["standard" , "low" , "medium" , "high" , "auto" ]] | NotGiven = NOT_GIVEN ,
126127 response_format : Optional [Literal ["url" , "b64_json" ]] | NotGiven = NOT_GIVEN ,
127- size : Optional [Literal ["256x256" , "512x512" , "1024x1024" ]] | NotGiven = NOT_GIVEN ,
128+ size : Optional [Literal ["256x256" , "512x512" , "1024x1024" , "1536x1024" , "1024x1536" , "auto" ]]
129+ | NotGiven = NOT_GIVEN ,
128130 user : str | NotGiven = NOT_GIVEN ,
129131 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
130132 # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -139,14 +141,25 @@ def edit(
139141 This endpoint only supports `gpt-image-1` and `dall-e-2`.
140142
141143 Args:
142- image: The image(s) to edit. Must be a supported image file or an array of images. For
143- `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
144- 25MB. For `dall-e-2`, you can only provide one image, and it should be a square
145- `png` file less than 4MB.
144+ image: The image(s) to edit. Must be a supported image file or an array of images.
145+
146+ For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
147+ 25MB. You can provide up to 16 images.
148+
149+ For `dall-e-2`, you can only provide one image, and it should be a square `png`
150+ file less than 4MB.
146151
147152 prompt: A text description of the desired image(s). The maximum length is 1000
148153 characters for `dall-e-2`, and 32000 characters for `gpt-image-1`.
149154
155+ background: Allows to set transparency for the background of the generated image(s). This
156+ parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
157+ `opaque` or `auto` (default value). When `auto` is used, the model will
158+ automatically determine the best background for the image.
159+
160+ If `transparent`, the output format needs to support transparency, so it should
161+ be set to either `png` (default value) or `webp`.
162+
150163 mask: An additional image whose fully transparent areas (e.g. where alpha is zero)
151164 indicate where `image` should be edited. If there are multiple images provided,
152165 the mask will be applied on the first image. Must be a valid PNG file, less than
@@ -187,6 +200,7 @@ def edit(
187200 {
188201 "image" : image ,
189202 "prompt" : prompt ,
203+ "background" : background ,
190204 "mask" : mask ,
191205 "model" : model ,
192206 "n" : n ,
@@ -429,12 +443,14 @@ async def edit(
429443 * ,
430444 image : Union [FileTypes , List [FileTypes ]],
431445 prompt : str ,
446+ background : Optional [Literal ["transparent" , "opaque" , "auto" ]] | NotGiven = NOT_GIVEN ,
432447 mask : FileTypes | NotGiven = NOT_GIVEN ,
433448 model : Union [str , ImageModel , None ] | NotGiven = NOT_GIVEN ,
434449 n : Optional [int ] | NotGiven = NOT_GIVEN ,
435450 quality : Optional [Literal ["standard" , "low" , "medium" , "high" , "auto" ]] | NotGiven = NOT_GIVEN ,
436451 response_format : Optional [Literal ["url" , "b64_json" ]] | NotGiven = NOT_GIVEN ,
437- size : Optional [Literal ["256x256" , "512x512" , "1024x1024" ]] | NotGiven = NOT_GIVEN ,
452+ size : Optional [Literal ["256x256" , "512x512" , "1024x1024" , "1536x1024" , "1024x1536" , "auto" ]]
453+ | NotGiven = NOT_GIVEN ,
438454 user : str | NotGiven = NOT_GIVEN ,
439455 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
440456 # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -449,14 +465,25 @@ async def edit(
449465 This endpoint only supports `gpt-image-1` and `dall-e-2`.
450466
451467 Args:
452- image: The image(s) to edit. Must be a supported image file or an array of images. For
453- `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
454- 25MB. For `dall-e-2`, you can only provide one image, and it should be a square
455- `png` file less than 4MB.
468+ image: The image(s) to edit. Must be a supported image file or an array of images.
469+
470+ For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
471+ 25MB. You can provide up to 16 images.
472+
473+ For `dall-e-2`, you can only provide one image, and it should be a square `png`
474+ file less than 4MB.
456475
457476 prompt: A text description of the desired image(s). The maximum length is 1000
458477 characters for `dall-e-2`, and 32000 characters for `gpt-image-1`.
459478
479+ background: Allows to set transparency for the background of the generated image(s). This
480+ parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
481+ `opaque` or `auto` (default value). When `auto` is used, the model will
482+ automatically determine the best background for the image.
483+
484+ If `transparent`, the output format needs to support transparency, so it should
485+ be set to either `png` (default value) or `webp`.
486+
460487 mask: An additional image whose fully transparent areas (e.g. where alpha is zero)
461488 indicate where `image` should be edited. If there are multiple images provided,
462489 the mask will be applied on the first image. Must be a valid PNG file, less than
@@ -497,6 +524,7 @@ async def edit(
497524 {
498525 "image" : image ,
499526 "prompt" : prompt ,
527+ "background" : background ,
500528 "mask" : mask ,
501529 "model" : model ,
502530 "n" : n ,
0 commit comments