Skip to main content

ImageGenerateRequest

Struct ImageGenerateRequest 

Source
pub struct ImageGenerateRequest {
    pub prompt: String,
    pub model: Option<String>,
    pub n: Option<i64>,
    pub quality: Option<ImageQuality>,
    pub size: Option<ImageSize>,
    pub response_format: Option<ImageResponseFormat>,
    pub style: Option<ImageStyle>,
    pub user: Option<String>,
    pub output_format: Option<ImageOutputFormat>,
    pub output_compression: Option<i64>,
    pub background: Option<ImageBackground>,
    pub moderation: Option<ImageModeration>,
}
Expand description

Request body for POST /images/generations.

Fields§

§prompt: String

Text description of desired image(s).

§model: Option<String>

Model to use (e.g. “dall-e-3”, “gpt-image-1”).

§n: Option<i64>

Number of images to generate.

§quality: Option<ImageQuality>

Quality level (standard or hd for dall-e-3; low/medium/high/auto for gpt-image-1).

§size: Option<ImageSize>

Image dimensions.

§response_format: Option<ImageResponseFormat>

Response format (url or b64_json).

§style: Option<ImageStyle>

Style (vivid or natural) – dall-e-3 only.

§user: Option<String>

A unique identifier representing your end-user.

§output_format: Option<ImageOutputFormat>

Output format (png, jpeg, webp).

§output_compression: Option<i64>

Output compression quality (0-100).

§background: Option<ImageBackground>

Background style (transparent, opaque, auto).

§moderation: Option<ImageModeration>

Moderation level (low, auto).

Implementations§

Source§

impl ImageGenerateRequest

Source

pub fn new(prompt: impl Into<String>) -> Self

Source

pub fn model(self, model: impl Into<String>) -> Self

Source

pub fn n(self, n: i64) -> Self

Source

pub fn quality(self, quality: ImageQuality) -> Self

Source

pub fn size(self, size: ImageSize) -> Self

Source

pub fn response_format(self, response_format: ImageResponseFormat) -> Self

Source

pub fn style(self, style: ImageStyle) -> Self

Source

pub fn user(self, user: impl Into<String>) -> Self

Source

pub fn output_format(self, output_format: ImageOutputFormat) -> Self

Source

pub fn output_compression(self, output_compression: i64) -> Self

Source

pub fn background(self, background: ImageBackground) -> Self

Source

pub fn moderation(self, moderation: ImageModeration) -> Self

Trait Implementations§

Source§

impl Clone for ImageGenerateRequest

Source§

fn clone(&self) -> ImageGenerateRequest

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ImageGenerateRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for ImageGenerateRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.