Skip to main content

async_openai/types/images/
image.rs

1#![allow(deprecated)]
2use derive_builder::Builder;
3use serde::{Deserialize, Serialize};
4
5use crate::error::OpenAIError;
6use crate::types::images::{ImageGenInputUsageDetails, ImageGenOutputTokensDetails, ImageInput};
7
8#[derive(Default, Debug, Serialize, Deserialize, Clone, PartialEq)]
9pub enum ImageSize {
10    #[default]
11    #[serde(rename = "auto")]
12    Auto,
13    #[serde(rename = "256x256")]
14    S256x256,
15    #[serde(rename = "512x512")]
16    S512x512,
17    #[serde(rename = "1024x1024")]
18    S1024x1024,
19    #[serde(rename = "1792x1024")]
20    S1792x1024,
21    #[serde(rename = "1024x1792")]
22    S1024x1792,
23    #[serde(rename = "1536x1024")]
24    S1536x1024,
25    #[serde(rename = "1024x1536")]
26    S1024x1536,
27    #[serde(untagged)]
28    Other(String),
29}
30
31#[derive(Default, Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
32pub enum DallE2ImageSize {
33    #[serde(rename = "256x256")]
34    S256x256,
35    #[serde(rename = "512x512")]
36    S512x512,
37    #[default]
38    #[serde(rename = "1024x1024")]
39    S1024x1024,
40}
41
42#[derive(Default, Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
43pub enum DallE3ImageSize {
44    #[default]
45    #[serde(rename = "1024x1024")]
46    S1024x1024,
47    #[serde(rename = "1792x1024")]
48    S1792x1024,
49    #[serde(rename = "1024x1792")]
50    S1024x1792,
51}
52
53#[derive(Default, Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
54pub enum GptImage1ImageSize {
55    #[default]
56    #[serde(rename = "auto")]
57    Auto,
58    #[serde(rename = "1024x1024")]
59    S1024x1024,
60    #[serde(rename = "1536x1024")]
61    S1536x1024,
62    #[serde(rename = "1024x1536")]
63    S1024x1536,
64}
65
66#[derive(Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq)]
67#[serde(rename_all = "lowercase")]
68pub enum ImageResponseFormat {
69    #[default]
70    Url,
71    #[serde(rename = "b64_json")]
72    B64Json,
73}
74
75#[derive(Debug, Serialize, Deserialize, Default, Clone, PartialEq)]
76pub enum ImageModel {
77    #[default]
78    #[serde(rename = "gpt-image-2")]
79    GptImage2,
80    #[serde(rename = "gpt-image-2-2026-04-21")]
81    GptImage2_2026_04_21,
82    #[serde(rename = "gpt-image-2.5-sunburst")]
83    GptImage2_5Sunburst,
84    #[serde(rename = "gpt-image-2.5-sunburst-2026-09-08")]
85    GptImage2_5Sunburst2026_09_08,
86    #[serde(rename = "gpt-image-2.5-flare")]
87    GptImage2_5Flare,
88    #[serde(rename = "gpt-image-2.5-flare-2026-09-08")]
89    GptImage2_5Flare2026_09_08,
90    #[serde(rename = "gpt-image-1.5")]
91    GptImage1dot5,
92    #[serde(rename = "gpt-image-1-mini")]
93    GptImage1Mini,
94    #[serde(rename = "chatgpt-image-latest")]
95    ChatGptImageLatest,
96    #[serde(untagged)]
97    Other(String),
98}
99
100#[derive(Debug, Serialize, Deserialize, Default, Clone, PartialEq)]
101#[serde(rename_all = "lowercase")]
102pub enum ImageQuality {
103    Standard,
104    HD,
105    High,
106    Medium,
107    Low,
108    XHigh,
109    Max,
110    #[default]
111    Auto,
112}
113
114#[derive(Debug, Serialize, Deserialize, Default, Clone, PartialEq)]
115#[serde(rename_all = "lowercase")]
116pub enum ImageStyle {
117    #[default]
118    Vivid,
119    Natural,
120}
121
122#[derive(Debug, Serialize, Deserialize, Default, Clone, PartialEq)]
123#[serde(rename_all = "lowercase")]
124pub enum ImageModeration {
125    #[default]
126    Auto,
127    Low,
128}
129
130#[derive(Debug, Serialize, Deserialize, Default, Clone, PartialEq)]
131#[serde(rename_all = "lowercase")]
132pub enum ImageOutputFormat {
133    #[default]
134    Png,
135    Jpeg,
136    Webp,
137}
138
139#[derive(Debug, Serialize, Deserialize, Default, Clone, PartialEq)]
140#[serde(rename_all = "lowercase")]
141pub enum ImageBackground {
142    #[default]
143    Auto,
144    Transparent,
145    Opaque,
146}
147
148#[derive(Debug, Clone, Serialize, Deserialize, Default, Builder, PartialEq)]
149#[builder(name = "CreateImageRequestArgs")]
150#[builder(pattern = "mutable")]
151#[builder(setter(into, strip_option), default)]
152#[builder(derive(Debug))]
153#[builder(build_fn(error = "OpenAIError"))]
154pub struct CreateImageRequest {
155    /// A text description of the desired image(s). The maximum length is 32000 characters.
156    pub prompt: String,
157
158    /// The GPT image model to use for image generation. Specify a model explicitly.
159    /// Supported models include `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
160    /// `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
161    /// `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
162    /// `gpt-image-2.5-flare-2026-09-08`, and `chatgpt-image-latest`.
163    ///
164    /// `gpt-image-1` was shut down on October 23, 2026. Use
165    /// `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.
166    pub model: ImageModel,
167
168    /// The number of images to generate. Must be between 1 and 10.
169    #[serde(skip_serializing_if = "Option::is_none")]
170    pub n: Option<u8>, // min:1 max:10 default:1
171
172    /// The quality of the image that will be generated.
173    ///
174    /// - `auto` (default value) will automatically select the best quality for the given
175    ///   model.
176    /// - `high`, `medium` and `low` are supported for the GPT image models.
177    /// - `gpt-image-2.5-sunburst` and `gpt-image-2.5-flare`, including their `2026-09-08`
178    ///   snapshots, also support `xhigh` and `max`.
179    #[serde(skip_serializing_if = "Option::is_none")]
180    pub quality: Option<ImageQuality>,
181
182    /// Legacy response format parameter for retired image models. Unsupported for GPT image models, which
183    /// always return base64-encoded images.
184    #[serde(skip_serializing_if = "Option::is_none")]
185    #[deprecated(
186        note = "Legacy response format parameter for retired image models. Unsupported for GPT image models, which always return base64-encoded images."
187    )]
188    pub response_format: Option<ImageResponseFormat>,
189
190    /// The format in which the generated images are returned. This parameter is only supported for
191    /// the GPT image models. Must be one of `png`, `jpeg`, or `webp`.
192    #[serde(skip_serializing_if = "Option::is_none")]
193    pub output_format: Option<ImageOutputFormat>,
194
195    /// The compression level (0-100%) for the generated images. This parameter is only supported for
196    /// the GPT image models with the `webp` or `jpeg` output formats, and defaults to 100.
197    #[serde(skip_serializing_if = "Option::is_none")]
198    pub output_compression: Option<u8>,
199
200    /// Generate the image in streaming mode. Defaults to `false`. See the
201    /// [Image generation guide](https://platform.openai.com/docs/guides/image-generation) for more
202    /// information. This parameter is only supported for the GPT image models.
203    #[serde(skip_serializing_if = "Option::is_none")]
204    pub stream: Option<bool>,
205
206    /// The number of partial images to generate. This parameter is used for
207    /// streaming responses that return partial images. Value must be between 0 and 3.
208    /// When set to 0, the response will be a single image sent in one streaming event.
209    /// Note that the final image may be sent before the full number of partial images
210    /// are generated if the full image is generated more quickly.
211    #[serde(skip_serializing_if = "Option::is_none")]
212    pub partial_images: Option<u8>,
213
214    /// The size of the generated images. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
215    /// `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
216    /// `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for
217    /// example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio
218    /// must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum
219    /// supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel
220    /// and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the
221    /// GPT image models; `auto` is supported for models that allow automatic sizing.
222    #[serde(skip_serializing_if = "Option::is_none")]
223    pub size: Option<ImageSize>,
224
225    /// Control the content-moderation level for images generated by the GPT image models. Must be either `low`
226    /// for less restrictive filtering or `auto` (default value).
227    #[serde(skip_serializing_if = "Option::is_none")]
228    pub moderation: Option<ImageModeration>,
229
230    /// Set the background of the generated image(s). This parameter is only
231    /// supported for the GPT image models. Must be one of `transparent`, `opaque`,
232    /// or `auto` (default value). When `auto` is used, the model will automatically
233    /// determine the best background for the image.
234    ///
235    /// Transparent backgrounds are available for supported GPT Image models. For
236    /// `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
237    /// using `transparent`, set the output format to `png` or `webp`.
238    #[serde(skip_serializing_if = "Option::is_none")]
239    pub background: Option<ImageBackground>,
240
241    /// Legacy style parameter for retired image models. Unsupported for GPT image models; describe the
242    /// desired style in the prompt instead.
243    #[serde(skip_serializing_if = "Option::is_none")]
244    #[deprecated(
245        note = "Legacy style parameter for retired image models. Unsupported for GPT image models; describe the desired style in the prompt instead."
246    )]
247    pub style: Option<ImageStyle>,
248
249    /// Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward
250    /// compatibility and is used when `safety_identifier` is omitted, null, or empty. [Learn
251    /// more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
252    #[serde(skip_serializing_if = "Option::is_none")]
253    #[deprecated(note = " Deprecated: use `safety_identifier` instead.")]
254    pub user: Option<String>,
255
256    /// A stable identifier for an end user in your organization, used for safety monitoring and abuse
257    /// detection. Hash a username or email address to avoid sending identifying information. A non-empty
258    /// value takes precedence over the deprecated `user` parameter. If omitted, null, or empty, the API
259    /// uses `user` when available. [Learn
260    /// more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
261    #[serde(skip_serializing_if = "Option::is_none")]
262    pub safety_identifier: Option<String>,
263}
264
265#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
266#[serde(untagged)]
267pub enum Image {
268    /// The URL of the generated image, if `response_format` is `url` (default).
269    Url {
270        url: String,
271        revised_prompt: Option<String>,
272    },
273    /// The base64-encoded JSON of the generated image, if `response_format` is `b64_json`.
274    B64Json {
275        b64_json: std::sync::Arc<String>,
276        revised_prompt: Option<String>,
277    },
278}
279
280#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
281#[serde(rename_all = "lowercase")]
282pub enum ImageResponseBackground {
283    Transparent,
284    Opaque,
285}
286
287#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Default)]
288pub struct ImageGenUsage {
289    /// The number of tokens (images and text) in the input prompt.
290    pub input_tokens: u32,
291    /// The total number of tokens (images and text) used for the image generation.
292    pub total_tokens: u32,
293    /// The number of output tokens generated by the model.
294    pub output_tokens: u32,
295    /// The output token details for the image generation.
296    pub output_token_details: Option<ImageGenOutputTokensDetails>,
297    /// The input tokens detailed information for the image generation.
298    pub input_tokens_details: ImageGenInputUsageDetails,
299}
300
301#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Default)]
302pub struct ImagesResponse {
303    /// The Unix timestamp (in seconds) of when the image was created.
304    pub created: u32,
305    /// The list of generated images.
306    pub data: Vec<std::sync::Arc<Image>>,
307    /// The background parameter used for the image generation. Either `transparent` or `opaque`.
308    pub background: Option<ImageResponseBackground>,
309    /// The output format of the image generation. Either `png`, `webp`, or `jpeg`.
310    pub output_format: Option<ImageOutputFormat>,
311    /// The size of the generated image as a `WIDTHxHEIGHT` string.
312    pub size: Option<ImageSize>,
313    /// The quality of the image generated. One of `low`, `medium`, `high`, `xhigh`, or `max`.
314    pub quality: Option<ImageQuality>,
315    /// For the GPT image models only, the token usage information for the image generation.
316    pub usage: Option<ImageGenUsage>,
317    /// The effective safety identifier used for safety monitoring and abuse detection. This is the
318    /// non-empty `safety_identifier` from the request, or the deprecated `user` value when
319    /// `safety_identifier` is omitted, null, or empty.
320    #[serde(skip_serializing_if = "Option::is_none")]
321    pub safety_identifier: Option<String>,
322}
323
324#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
325#[serde(rename_all = "lowercase")]
326pub enum InputFidelity {
327    High,
328    #[default]
329    Low,
330}
331
332#[derive(Debug, Clone, PartialEq)]
333pub enum ImageEditInput {
334    Image(ImageInput),
335    Images(Vec<ImageInput>),
336}
337
338#[derive(Debug, Clone, Default, Builder, PartialEq)]
339#[builder(name = "CreateImageEditRequestArgs")]
340#[builder(pattern = "mutable")]
341#[builder(setter(into, strip_option), default)]
342#[builder(derive(Debug))]
343#[builder(build_fn(error = "OpenAIError"))]
344pub struct CreateImageEditRequest {
345    /// The image(s) to edit. Must be a supported image file or an array of images.
346    ///
347    /// For the GPT image models (`gpt-image-1-mini`, `gpt-image-1.5`,
348    /// `gpt-image-2`, `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
349    /// `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
350    /// `gpt-image-2.5-flare-2026-09-08`), each image should be a `png`, `webp`, or `jpg`
351    /// file less than 50MB. You can provide up to 16 images. `chatgpt-image-latest`
352    /// follows the same input constraints as GPT image models.
353    pub image: ImageEditInput,
354
355    /// A text description of the desired image(s). The maximum length is 32000 characters for the GPT image
356    /// models.
357    pub prompt: String,
358
359    /// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where
360    /// `image` should be edited. If there are multiple images provided, the mask will be applied on the
361    /// first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`.
362    pub mask: Option<ImageInput>,
363
364    /// Set the background of the generated image(s). This parameter is only
365    /// supported for the GPT image models. Must be one of `transparent`, `opaque`,
366    /// or `auto` (default value). When `auto` is used, the model will automatically
367    /// determine the best background for the image.
368    ///
369    /// Transparent backgrounds are available for supported GPT Image models. For
370    /// `gpt-image-2` and `gpt-image-2-2026-04-21`, this support is in preview. When
371    /// using `transparent`, set the output format to `png` or `webp`.
372    pub background: Option<ImageBackground>,
373
374    /// The GPT image model to use for image editing
375    /// (`gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
376    /// `gpt-image-2-2026-04-21`, `gpt-image-2.5-sunburst`,
377    /// `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`,
378    /// `gpt-image-2.5-flare-2026-09-08`, or `chatgpt-image-latest`).
379    ///
380    /// `gpt-image-1` was shut down on October 23, 2026. Use
381    /// `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare` instead.
382    pub model: ImageModel,
383
384    /// The number of images to generate. Must be between 1 and 10.
385    pub n: Option<u8>, // min:1 max:10 default:1
386
387    /// The size of the generated images. Defaults to `auto`. For `gpt-image-2`, `gpt-image-2-2026-04-21`,
388    /// `gpt-image-2.5-sunburst`, `gpt-image-2.5-sunburst-2026-09-08`, `gpt-image-2.5-flare`, and
389    /// `gpt-image-2.5-flare-2026-09-08`, arbitrary resolutions are supported as `WIDTHxHEIGHT` strings, for
390    /// example `1536x864`. Width and height must both be divisible by 16 and the requested aspect ratio
391    /// must be between 1:3 and 3:1. Resolutions above `2560x1440` are experimental, and the maximum
392    /// supported resolution is `3840x2160`. The requested size must also satisfy the model's current pixel
393    /// and edge limits. The standard sizes `1024x1024`, `1536x1024`, and `1024x1536` are supported by the
394    /// GPT image models; `auto` is supported for models that allow automatic sizing.
395    pub size: Option<ImageSize>,
396
397    /// Legacy response format parameter for retired image models. Unsupported for GPT image models, which
398    /// always return base64-encoded images.
399    #[deprecated(
400        note = "Legacy response format parameter for retired image models. Unsupported for GPT image models, which always return base64-encoded images."
401    )]
402    pub response_format: Option<ImageResponseFormat>,
403
404    /// The format in which the generated images are returned. This parameter is
405    /// only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.
406    /// The default value is `png`.
407    pub output_format: Option<ImageOutputFormat>,
408
409    /// The compression level (0-100%) for the generated images. This parameter
410    /// is only supported for the GPT image models with the `webp` or `jpeg` output
411    /// formats, and defaults to 100.
412    pub output_compression: Option<u8>,
413
414    /// Deprecated: use `safety_identifier` instead. This parameter remains accepted for backward
415    /// compatibility and is used when `safety_identifier` is omitted, null, or empty. [Learn
416    /// more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
417    #[deprecated(note = "Deprecated: use `safety_identifier` instead.")]
418    pub user: Option<String>,
419
420    /// Control how much effort the model will exert to match the style and features, especially facial
421    /// features, of input images. This parameter is only supported for the GPT image models. Unsupported for
422    /// `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
423    pub input_fidelity: Option<InputFidelity>,
424
425    /// Edit the image in streaming mode. Defaults to `false`. See the
426    /// [Image generation guide](https://platform.openai.com/docs/guides/image-generation) for more
427    /// information.
428    pub stream: Option<bool>,
429
430    /// The number of partial images to generate. This parameter is used for
431    /// streaming responses that return partial images. Value must be between 0 and 3.
432    /// When set to 0, the response will be a single image sent in one streaming event.
433
434    /// Note that the final image may be sent before the full number of partial images
435    /// are generated if the full image is generated more quickly.
436    pub partial_images: Option<u8>,
437
438    /// The quality of the image that will be generated. GPT image models support
439    /// quality levels through `max`; `dall-e-2` supports `standard`. Defaults to `auto`.
440    pub quality: Option<ImageQuality>,
441
442    /// A stable identifier for an end user in your organization, used for safety monitoring and abuse
443    /// detection. Hash a username or email address to avoid sending identifying information. A non-empty
444    /// value takes precedence over the deprecated `user` parameter. If omitted, null, or empty, the API
445    /// uses `user` when available. [Learn
446    /// more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers).
447    pub safety_identifier: Option<String>,
448
449    /// A transparent PNG overlaid on the first image to guide the edit. Must match that image's dimensions
450    /// after orientation and contain transparent pixels. Supports GPT Image 2.5. Cannot be combined with
451    /// mask.
452    pub markup: Option<ImageInput>,
453}
454
455#[derive(Debug, Default, Clone, Builder, PartialEq)]
456#[builder(name = "CreateImageVariationRequestArgs")]
457#[builder(pattern = "mutable")]
458#[builder(setter(into, strip_option), default)]
459#[builder(derive(Debug))]
460#[builder(build_fn(error = "OpenAIError"))]
461#[deprecated(note = "DALL-E 2 and image variations shut down on February 26, 2027.")]
462pub struct CreateImageVariationRequest {
463    /// The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and
464    /// square.
465    pub image: ImageInput,
466
467    /// The legacy model used by the retired image variations endpoint. This endpoint no longer accepts
468    /// requests.
469    pub model: Option<ImageModel>,
470
471    /// The number of images to generate. Must be between 1 and 10.
472    pub n: Option<u8>, // min:1 max:10 default:1
473
474    /// The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs
475    /// are only valid for 60 minutes after the image has been generated.
476    pub response_format: Option<ImageResponseFormat>,
477
478    /// The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
479    pub size: Option<DallE2ImageSize>,
480
481    /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
482    /// [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).
483    pub user: Option<String>,
484}
485
486/// Reference an input image by either URL or uploaded file ID.
487/// Provide exactly one of `image_url` or `file_id`.
488#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
489pub struct ImageRefParam {
490    /// A fully qualified URL or base64-encoded data URL.
491    #[serde(skip_serializing_if = "Option::is_none")]
492    pub image_url: Option<String>,
493    /// The File API ID of an uploaded image to use as input.
494    #[serde(skip_serializing_if = "Option::is_none")]
495    pub file_id: Option<String>,
496}
497
498/// JSON request body for image edits.
499///
500/// Use `images` (array of `ImageRefParam`) instead of multipart `image` uploads.
501/// You can reference images via external URLs, data URLs, or uploaded file IDs.
502/// JSON edits support GPT image models only; DALL-E edits require multipart (`dall-e-2` only).
503#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder, Default)]
504#[builder(name = "EditImageJsonRequestArgs")]
505#[builder(pattern = "mutable")]
506#[builder(setter(into, strip_option), default)]
507#[builder(derive(Debug))]
508#[builder(build_fn(error = "OpenAIError"))]
509pub struct EditImageJsonRequest {
510    /// The model to use for image editing.
511    #[serde(skip_serializing_if = "Option::is_none")]
512    pub model: Option<ImageModel>,
513
514    /// Input image references to edit. For GPT image models, you can provide up to 16 images.
515    pub images: Vec<ImageRefParam>,
516
517    /// An optional mask image reference indicating which areas of the image should be edited.
518    #[serde(skip_serializing_if = "Option::is_none")]
519    pub mask: Option<ImageRefParam>,
520
521    /// A text description of the desired image edit.
522    pub prompt: String,
523
524    /// The number of edited images to generate. Must be between 1 and 10.
525    #[serde(skip_serializing_if = "Option::is_none")]
526    pub n: Option<u8>,
527
528    /// The quality of the image that will be generated.
529    #[serde(skip_serializing_if = "Option::is_none")]
530    pub quality: Option<ImageQuality>,
531
532    /// Control how much effort the model will exert to match the style and features,
533    /// especially facial features, of input images. Supports `high` and `low`. Defaults to `low`.
534    #[serde(skip_serializing_if = "Option::is_none")]
535    pub input_fidelity: Option<InputFidelity>,
536
537    /// The size of the generated image.
538    #[serde(skip_serializing_if = "Option::is_none")]
539    pub size: Option<ImageSize>,
540
541    /// A unique identifier representing your end-user.
542    #[serde(skip_serializing_if = "Option::is_none")]
543    #[deprecated(note = "Use safety_identifier instead.")]
544    pub user: Option<String>,
545
546    /// The output format for the generated image.
547    #[serde(skip_serializing_if = "Option::is_none")]
548    pub output_format: Option<ImageOutputFormat>,
549
550    /// The compression level (0-100%) for the generated images.
551    #[serde(skip_serializing_if = "Option::is_none")]
552    pub output_compression: Option<u8>,
553
554    /// Control the content-moderation level for images.
555    #[serde(skip_serializing_if = "Option::is_none")]
556    pub moderation: Option<ImageModeration>,
557
558    /// The background style for the generated image.
559    #[serde(skip_serializing_if = "Option::is_none")]
560    pub background: Option<ImageBackground>,
561
562    /// Whether to stream the image generation. Defaults to `false`.
563    #[serde(skip_serializing_if = "Option::is_none")]
564    pub stream: Option<bool>,
565
566    /// The number of partial images to generate during streaming.
567    #[serde(skip_serializing_if = "Option::is_none")]
568    pub partial_images: Option<u8>,
569
570    /// Opaque end-user identifier, up to 128 characters.
571    #[serde(skip_serializing_if = "Option::is_none")]
572    pub safety_identifier: Option<String>,
573    /// An optional markup image containing edit instructions.
574    #[serde(skip_serializing_if = "Option::is_none")]
575    pub markup: Option<ImageRefParam>,
576}