Table of Contents

Class ImageGenerationRequest

Namespace
OpenAI.Images
Assembly
OpenAI-DotNet.dll

Creates an image given a prompt.

public sealed class ImageGenerationRequest
Inheritance
ImageGenerationRequest
Inherited Members

Constructors

ImageGenerationRequest(string, Model, int, string, ImageResponseFormat, string, string, string)

Constructor.

public ImageGenerationRequest(string prompt, Model model = null, int numberOfResults = 1, string quality = null, ImageResponseFormat responseFormat = ImageResponseFormat.Url, string size = null, string style = null, string user = null)

Parameters

prompt string

A text description of the desired image(s). The maximum length is 1000 characters for dall-e-2 and 4000 characters for dall-e-3.

model Model

The model to use for image generation.

numberOfResults int

The number of images to generate. Must be between 1 and 10. For dall-e-3, only n=1 is supported.

quality string

The quality of the image that will be generated. hd creates images with finer details and greater consistency across the image. This param is only supported for dall-e-3.

responseFormat ImageResponseFormat

The format in which the generated images are returned. Must be one of url or b64_json.

Defaults to Url
size string

The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024 for dall-e-2. Must be one of 1024x1024, 1792x1024, or 1024x1792 for dall-e-3 models.

style string

The style of the generated images. Must be one of vivid or natural. 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. This param is only supported for dall-e-3.

user string

A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.

Properties

Model

[JsonPropertyName("model")]
[FunctionProperty("The model to use for image generation.", true, "dall-e-2", new object[] { "dall-e-3" })]
public string Model { get; }

Property Value

string

Number

The number of images to generate. Must be between 1 and 10. For dall-e-3, only n=1 is supported.

[JsonPropertyName("n")]
[FunctionProperty("The number of images to generate. Must be between 1 and 10. For dall-e-3, only n=1 is supported.", true, 1, new object[] { })]
public int Number { get; }

Property Value

int

Prompt

A text description of the desired image(s). The maximum length is 1000 characters for dall-e-2 and 4000 characters for dall-e-3.

[JsonPropertyName("prompt")]
[FunctionProperty("A text description of the desired image(s). The maximum length is 1000 characters for dall-e-2 and 4000 characters for dall-e-3.", true, null, new object[] { })]
public string Prompt { get; }

Property Value

string

Quality

The quality of the image that will be generated. Must be one of standard or hd. hd creates images with finer details and greater consistency across the image. This param is only supported for dall-e-3.

[JsonPropertyName("quality")]
[FunctionProperty("The quality of the image that will be generated. hd creates images with finer details and greater consistency across the image. This param is only supported for dall-e-3.", false, null, new object[] { "standard", "hd" })]
public string Quality { get; }

Property Value

string

ResponseFormat

The format in which the generated images are returned. Must be one of url or b64_json.

Defaults to Url
[JsonPropertyName("response_format")]
[JsonConverter(typeof(JsonStringEnumConverter<ImageResponseFormat>))]
[FunctionProperty("The format in which the generated images are returned. Must be one of url or b64_json.", true, null, new object[] { })]
public ImageResponseFormat ResponseFormat { get; }

Property Value

ImageResponseFormat

Size

The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024 for dall-e-2. Must be one of 1024x1024, 1792x1024, or 1024x1792 for dall-e-3 models.

[JsonPropertyName("size")]
[FunctionProperty("The size of the generated images. Must be one of 256x256, 512x512, or 1024x1024 for dall-e-2. Must be one of 1024x1024, 1792x1024, or 1024x1792 for dall-e-3 models.", true, "1024x1024", new object[] { "256x256", "512x512", "1024x1024", "1792x1024", "1024x1792" })]
public string Size { get; }

Property Value

string

Style

The style of the generated images. Must be one of vivid or natural. 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. This param is only supported for dall-e-3.

[JsonPropertyName("style")]
[FunctionProperty("The style of the generated images. Must be one of vivid or natural. 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. This param is only supported for dall-e-3.", false, null, new object[] { "vivid", "natural" })]
public string Style { get; }

Property Value

string

User

A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.

[JsonPropertyName("user")]
[FunctionProperty("A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.", false, null, new object[] { })]
public string User { get; }

Property Value

string