Class ImageGenerateParams
-
- All Implemented Interfaces:
-
com.openai.core.Params
public final class ImageGenerateParams implements Params
Creates an image given a prompt. Learn more.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classImageGenerateParams.BuilderA builder for ImageGenerateParams.
public final classImageGenerateParams.Bodypublic final classImageGenerateParams.BackgroundAllows to set transparency for the background of the generated image(s). This parameter is only supported for
gpt-image-1. Must be one oftransparent,opaqueorauto(default value). Whenautois used, the model will automatically determine the best background for the image.If
transparent, the output format needs to support transparency, so it should be set to eitherpng(default value) orwebp.public final classImageGenerateParams.ModerationControl the content-moderation level for images generated by
gpt-image-1. Must be eitherlowfor less restrictive filtering orauto(default value).public final classImageGenerateParams.OutputFormatThe format in which the generated images are returned. This parameter is only supported for
gpt-image-1. Must be one ofpng,jpeg, orwebp.public final classImageGenerateParams.QualityThe quality of the image that will be generated.
auto(default value) will automatically select the best quality for the given model.high,mediumandloware supported forgpt-image-1.hdandstandardare supported fordall-e-3.standardis the only option fordall-e-2.
public final classImageGenerateParams.ResponseFormatThe format in which generated images with
dall-e-2anddall-e-3are returned. Must be one ofurlorb64_json. URLs are only valid for 60 minutes after the image has been generated. This parameter isn't supported forgpt-image-1which will always return base64-encoded images.public final classImageGenerateParams.SizeThe size of the generated images. Must be one of
1024x1024,1536x1024(landscape),1024x1536(portrait), orauto(default value) forgpt-image-1, one of256x256,512x512, or1024x1024fordall-e-2, and one of1024x1024,1792x1024, or1024x1792fordall-e-3.public final classImageGenerateParams.StyleThe style of the generated images. This parameter is only supported for
dall-e-3. Must be one ofvividornatural. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images.
-
Method Summary
Modifier and Type Method Description final Stringprompt()A text description of the desired image(s). final Optional<ImageGenerateParams.Background>background()Allows to set transparency for the background of the generated image(s). final Optional<ImageModel>model()The model to use for image generation. final Optional<ImageGenerateParams.Moderation>moderation()Control the content-moderation level for images generated by gpt-image-1.final Optional<Long>n()The number of images to generate. final Optional<Long>outputCompression()The compression level (0-100%) for the generated images. final Optional<ImageGenerateParams.OutputFormat>outputFormat()The format in which the generated images are returned. final Optional<Long>partialImages()The number of partial images to generate. final Optional<ImageGenerateParams.Quality>quality()The quality of the image that will be generated. final Optional<ImageGenerateParams.ResponseFormat>responseFormat()The format in which generated images with dall-e-2anddall-e-3are returned.final Optional<ImageGenerateParams.Size>size()The size of the generated images. final Optional<ImageGenerateParams.Style>style()The style of the generated images. final Optional<String>user()A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. final JsonField<String>_prompt()Returns the raw JSON value of prompt. final JsonField<ImageGenerateParams.Background>_background()Returns the raw JSON value of background. final JsonField<ImageModel>_model()Returns the raw JSON value of model. final JsonField<ImageGenerateParams.Moderation>_moderation()Returns the raw JSON value of moderation. final JsonField<Long>_n()Returns the raw JSON value of n. final JsonField<Long>_outputCompression()Returns the raw JSON value of outputCompression. final JsonField<ImageGenerateParams.OutputFormat>_outputFormat()Returns the raw JSON value of outputFormat. final JsonField<Long>_partialImages()Returns the raw JSON value of partialImages. final JsonField<ImageGenerateParams.Quality>_quality()Returns the raw JSON value of quality. final JsonField<ImageGenerateParams.ResponseFormat>_responseFormat()Returns the raw JSON value of responseFormat. final JsonField<ImageGenerateParams.Size>_size()Returns the raw JSON value of size. final JsonField<ImageGenerateParams.Style>_style()Returns the raw JSON value of style. final JsonField<String>_user()Returns the raw JSON value of user. final Map<String, JsonValue>_additionalBodyProperties()final Headers_additionalHeaders()Additional headers to send with the request. final QueryParams_additionalQueryParams()Additional query param to send with the request. final ImageGenerateParams.BuildertoBuilder()final ImageGenerateParams.Body_body()Headers_headers()The full set of headers in the parameters, including both fixed and additional headers. QueryParams_queryParams()The full set of query params in the parameters, including both fixed and additional query params. Booleanequals(Object other)IntegerhashCode()StringtoString()final static ImageGenerateParams.Builderbuilder()Returns a mutable builder for constructing an instance of ImageGenerateParams. -
-
Method Detail
-
prompt
final String prompt()
A text description of the desired image(s). The maximum length is 32000 characters for
gpt-image-1, 1000 characters fordall-e-2and 4000 characters fordall-e-3.
-
background
final Optional<ImageGenerateParams.Background> background()
Allows to set transparency for the background of the generated image(s). This parameter is only supported for
gpt-image-1. Must be one oftransparent,opaqueorauto(default value). Whenautois used, the model will automatically determine the best background for the image.If
transparent, the output format needs to support transparency, so it should be set to eitherpng(default value) orwebp.
-
model
final Optional<ImageModel> model()
The model to use for image generation. One of
dall-e-2,dall-e-3, orgpt-image-1. Defaults todall-e-2unless a parameter specific togpt-image-1is used.
-
moderation
final Optional<ImageGenerateParams.Moderation> moderation()
Control the content-moderation level for images generated by
gpt-image-1. Must be eitherlowfor less restrictive filtering orauto(default value).
-
n
final Optional<Long> n()
The number of images to generate. Must be between 1 and 10. For
dall-e-3, onlyn=1is supported.
-
outputCompression
final Optional<Long> outputCompression()
The compression level (0-100%) for the generated images. This parameter is only supported for
gpt-image-1with thewebporjpegoutput formats, and defaults to 100.
-
outputFormat
final Optional<ImageGenerateParams.OutputFormat> outputFormat()
The format in which the generated images are returned. This parameter is only supported for
gpt-image-1. Must be one ofpng,jpeg, orwebp.
-
partialImages
final Optional<Long> partialImages()
The number of partial images to generate. This parameter is used for streaming responses that return partial images. Value must be between 0 and 3. When set to 0, the response will be a single image sent in one streaming event.
Note that the final image may be sent before the full number of partial images are generated if the full image is generated more quickly.
-
quality
final Optional<ImageGenerateParams.Quality> quality()
The quality of the image that will be generated.
auto(default value) will automatically select the best quality for the given model.high,mediumandloware supported forgpt-image-1.hdandstandardare supported fordall-e-3.standardis the only option fordall-e-2.
-
responseFormat
final Optional<ImageGenerateParams.ResponseFormat> responseFormat()
The format in which generated images with
dall-e-2anddall-e-3are returned. Must be one ofurlorb64_json. URLs are only valid for 60 minutes after the image has been generated. This parameter isn't supported forgpt-image-1which will always return base64-encoded images.
-
size
final Optional<ImageGenerateParams.Size> size()
The size of the generated images. Must be one of
1024x1024,1536x1024(landscape),1024x1536(portrait), orauto(default value) forgpt-image-1, one of256x256,512x512, or1024x1024fordall-e-2, and one of1024x1024,1792x1024, or1024x1792fordall-e-3.
-
style
final Optional<ImageGenerateParams.Style> style()
The style of the generated images. This parameter is only supported for
dall-e-3. Must be one ofvividornatural. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images.
-
user
final Optional<String> user()
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
-
_prompt
final JsonField<String> _prompt()
Returns the raw JSON value of prompt.
Unlike prompt, this method doesn't throw if the JSON field has an unexpected type.
-
_background
final JsonField<ImageGenerateParams.Background> _background()
Returns the raw JSON value of background.
Unlike background, this method doesn't throw if the JSON field has an unexpected type.
-
_model
final JsonField<ImageModel> _model()
Returns the raw JSON value of model.
Unlike model, this method doesn't throw if the JSON field has an unexpected type.
-
_moderation
final JsonField<ImageGenerateParams.Moderation> _moderation()
Returns the raw JSON value of moderation.
Unlike moderation, this method doesn't throw if the JSON field has an unexpected type.
-
_n
final JsonField<Long> _n()
Returns the raw JSON value of n.
Unlike n, this method doesn't throw if the JSON field has an unexpected type.
-
_outputCompression
final JsonField<Long> _outputCompression()
Returns the raw JSON value of outputCompression.
Unlike outputCompression, this method doesn't throw if the JSON field has an unexpected type.
-
_outputFormat
final JsonField<ImageGenerateParams.OutputFormat> _outputFormat()
Returns the raw JSON value of outputFormat.
Unlike outputFormat, this method doesn't throw if the JSON field has an unexpected type.
-
_partialImages
final JsonField<Long> _partialImages()
Returns the raw JSON value of partialImages.
Unlike partialImages, this method doesn't throw if the JSON field has an unexpected type.
-
_quality
final JsonField<ImageGenerateParams.Quality> _quality()
Returns the raw JSON value of quality.
Unlike quality, this method doesn't throw if the JSON field has an unexpected type.
-
_responseFormat
final JsonField<ImageGenerateParams.ResponseFormat> _responseFormat()
Returns the raw JSON value of responseFormat.
Unlike responseFormat, this method doesn't throw if the JSON field has an unexpected type.
-
_size
final JsonField<ImageGenerateParams.Size> _size()
Returns the raw JSON value of size.
Unlike size, this method doesn't throw if the JSON field has an unexpected type.
-
_style
final JsonField<ImageGenerateParams.Style> _style()
Returns the raw JSON value of style.
Unlike style, this method doesn't throw if the JSON field has an unexpected type.
-
_user
final JsonField<String> _user()
Returns the raw JSON value of user.
Unlike user, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalBodyProperties
final Map<String, JsonValue> _additionalBodyProperties()
-
_additionalHeaders
final Headers _additionalHeaders()
Additional headers to send with the request.
-
_additionalQueryParams
final QueryParams _additionalQueryParams()
Additional query param to send with the request.
-
toBuilder
final ImageGenerateParams.Builder toBuilder()
-
_body
final ImageGenerateParams.Body _body()
-
_headers
Headers _headers()
The full set of headers in the parameters, including both fixed and additional headers.
-
_queryParams
QueryParams _queryParams()
The full set of query params in the parameters, including both fixed and additional query params.
-
builder
final static ImageGenerateParams.Builder builder()
Returns a mutable builder for constructing an instance of ImageGenerateParams.
The following fields are required:
.prompt()
-
-
-
-