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 class
ImageGenerateParams.Builder
A builder for ImageGenerateParams.
public final class
ImageGenerateParams.Body
public final class
ImageGenerateParams.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
,opaque
orauto
(default value). Whenauto
is 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 class
ImageGenerateParams.Moderation
Control the content-moderation level for images generated by
gpt-image-1
. Must be eitherlow
for less restrictive filtering orauto
(default value).public final class
ImageGenerateParams.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
.public final class
ImageGenerateParams.Quality
The quality of the image that will be generated.
auto
(default value) will automatically select the best quality for the given model.high
,medium
andlow
are supported forgpt-image-1
.hd
andstandard
are supported fordall-e-3
.standard
is the only option fordall-e-2
.
public final class
ImageGenerateParams.ResponseFormat
The format in which generated images with
dall-e-2
anddall-e-3
are returned. Must be one ofurl
orb64_json
. URLs are only valid for 60 minutes after the image has been generated. This parameter isn't supported forgpt-image-1
which will always return base64-encoded images.public final class
ImageGenerateParams.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
, or1024x1024
fordall-e-2
, and one of1024x1024
,1792x1024
, or1024x1792
fordall-e-3
.public final class
ImageGenerateParams.Style
The style of the generated images. This parameter is only supported for
dall-e-3
. Must be one ofvivid
ornatural
. 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 String
prompt()
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<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-2
anddall-e-3
are 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<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()
final QueryParams
_additionalQueryParams()
final ImageGenerateParams.Builder
toBuilder()
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. Boolean
equals(Object other)
Integer
hashCode()
String
toString()
final static ImageGenerateParams.Builder
builder()
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-2
and 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
,opaque
orauto
(default value). Whenauto
is 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-2
unless a parameter specific togpt-image-1
is used.
-
moderation
final Optional<ImageGenerateParams.Moderation> moderation()
Control the content-moderation level for images generated by
gpt-image-1
. Must be eitherlow
for 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=1
is supported.
-
outputCompression
final Optional<Long> outputCompression()
The compression level (0-100%) for the generated images. This parameter is only supported for
gpt-image-1
with thewebp
orjpeg
output 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
.
-
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
,medium
andlow
are supported forgpt-image-1
.hd
andstandard
are supported fordall-e-3
.standard
is the only option fordall-e-2
.
-
responseFormat
final Optional<ImageGenerateParams.ResponseFormat> responseFormat()
The format in which generated images with
dall-e-2
anddall-e-3
are returned. Must be one ofurl
orb64_json
. URLs are only valid for 60 minutes after the image has been generated. This parameter isn't supported forgpt-image-1
which 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
, or1024x1024
fordall-e-2
, and one of1024x1024
,1792x1024
, or1024x1792
fordall-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 ofvivid
ornatural
. 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.
-
_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()
-
_additionalQueryParams
final QueryParams _additionalQueryParams()
-
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()
-
-
-
-