Skip to content

images

Create image

Generate images from text prompts

Request

POST /images/generations

Request Body

FieldTypeRequiredDescription
promptstringYesA text description of the desired image(s).- Maximum length is 32000 characters for the GPT image models- Maximum length is 1000 characters for dall-e-2- Maximum length is 4000 characters for dall-e-3
backgroundobjectNoAllows to set transparency for the background of the generated image(s).This parameter is only supported for the GPT image models.Must be one of transparent, opaque or auto (default value).When auto 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 either png (default value) or webp.
modelstringNoThe model to use for image generation. One of dall-e-2, dall-e-3, or a GPT image model (gpt-image-1, gpt-image-1-mini, gpt-image-1.5).Defaults to dall-e-2 unless a parameter specific to the GPT image models is used.
moderationobjectNoControl the content-moderation level for images generated by the GPT image models.Must be either low for less restrictive filtering or auto (default value).
nobjectNoThe number of images to generate. Must be between 1 and 10.For dall-e-3, only n=1 is supported.
output_compressionobjectNoThe compression level (0-100%) for the generated images.This parameter is only supported for the GPT image models with the webp or jpeg output formats, and defaults to 100.
output_formatobjectNoThe format in which the generated images are returned.This parameter is only supported for the GPT image models.Must be one of png, jpeg, or webp.
partial_imagesintegerNoThe 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.
qualityobjectNoThe quality of the image that will be generated.- auto (default value) will automatically select the best quality for the given model.- high, medium and low are supported for the GPT image models.- hd and standard are supported for dall-e-3.- standard is the only option for dall-e-2.
response_formatobjectNoThe format in which generated images with dall-e-2 and dall-e-3 are returned.Must be one of url or b64_json. URLs are only valid for 60 minutes after the image has been generated.This parameter isn’t supported for the GPT image models, which always return base64-encoded images.
sizeobjectNoThe size of the generated images.Must be one of 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto (default value) for the GPT image models,one of 256x256, 512x512, or 1024x1024 for dall-e-2,and one of 1024x1024, 1792x1024, or 1024x1792 for dall-e-3.
streamobjectNoGenerate the image in streaming mode. Defaults to false.See the Image generation guide for more information.This parameter is only supported for the GPT image models.
styleobjectNoThe style of the generated images. This parameter is only supported for dall-e-3.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.
userstringNoA unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.

Request Examples

Simple image generation

{
  "model": "gpt-5.6-luna",
  "prompt": "A cute cat sitting on a windowsill",
  "n": 1,
  "size": "1024x1024"
}

Image generation with detailed parameters

{
  "model": "gpt-5.6-luna",
  "prompt": "A futuristic city with flying cars at sunset",
  "n": 1,
  "quality": "hd",
  "size": "1792x1024",
  "style": "vivid"
}

Base64 output

{
  "model": "gpt-5.6-luna",
  "prompt": "Minimalist logo of a cloud with a lightning bolt",
  "n": 1,
  "response_format": "b64_json",
  "size": "512x512"
}

Successful response

Response Schema

FieldTypeRequiredDescription
createdintegerYes-
dataArray<ImageObject>Yes-
usageobjectNoUsage information for image generation (provider-dependent)

Response Example

{
  "created": 1677652288,
  "data": [
    {
      "url": "https://example.com/image.png",
      "revised_prompt": "A cute orange tabby cat sitting on a white windowsill, looking outside"
    }
  ]
}

Code Examples

JavaScript (Fetch)

const response = await fetch('https://api.uuroute.ai/v1/images/generations', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "model": "gpt-5.6-luna",
  "prompt": "A cute cat sitting on a windowsill",
  "n": 1,
  "size": "1024x1024"
})
});

const data = await response.json();
console.log(data);

Python (requests)

import requests

url = "https://api.uuroute.ai/v1/images/generations"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

response = requests.post(url, json={
  "model": "gpt-5.6-luna",
  "prompt": "A cute cat sitting on a windowsill",
  "n": 1,
  "size": "1024x1024"
}, headers=headers)
data = response.json()
print(data)

cURL

curl -X POST "https://api.uuroute.ai/v1/images/generations" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.6-luna","prompt":"A cute cat sitting on a windowsill","n":1,"size":"1024x1024"}'

Edit image

Create an edited or extended image given an original and prompt

Request

POST /images/edits

Request Body

FieldTypeRequiredDescription
imagestringYesThe image(s) to edit. Must be a supported image file or an array of images.For the GPT image models (gpt-image-1, gpt-image-1-mini, and gpt-image-1.5):- Each image should be a png, webp, or jpg file less than 50MB- You can provide up to 16 imagesFor dall-e-2:- You can only provide one image- It should be a square png file less than 4MB
promptstringYesA text description of the desired image(s).- Maximum length is 32000 characters for GPT image models- Maximum length is 1000 characters for dall-e-2- Maximum length is 4000 characters for dall-e-3
maskstringNoAn additional image whose fully transparent areas (e.g. where alpha is zero) indicate where image should be edited.If there are multiple images provided, the mask will be applied on the first image.Must be a valid PNG file, less than 4MB, and have the same dimensions as image.
backgroundobjectNoAllows to set transparency for the background of the generated image(s).This parameter is only supported for the GPT image models.Must be one of transparent, opaque or auto (default value).When auto 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 either png (default value) or webp.
input_fidelitystring (high, low)NoControl how much effort the model will exert to match the style and features, especially facial features, of input images.This parameter is only supported for gpt-image-1. Unsupported for gpt-image-1-mini.Supports high and low. Defaults to low.
modelstringNoThe model to use for image generation. One of dall-e-2, dall-e-3, or a GPT image model (gpt-image-1, gpt-image-1-mini, gpt-image-1.5).Defaults to dall-e-2 unless a parameter specific to the GPT image models is used.
moderationobjectNoControl the content-moderation level for images generated by the GPT image models.Must be either low for less restrictive filtering or auto (default value).
nobjectNoThe number of images to generate. Must be between 1 and 10.For dall-e-3, only n=1 is supported.
output_compressionobjectNoThe compression level (0-100%) for the generated images.This parameter is only supported for the GPT image models with the webp or jpeg output formats, and defaults to 100.
output_formatobjectNoThe format in which the generated images are returned.This parameter is only supported for the GPT image models.Must be one of png, jpeg, or webp.
partial_imagesintegerNoThe 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.
qualityobjectNoThe quality of the image that will be generated.- auto (default value) will automatically select the best quality for the given model.- high, medium and low are supported for the GPT image models.- hd and standard are supported for dall-e-3.- standard is the only option for dall-e-2.
response_formatobjectNoThe format in which generated images with dall-e-2 and dall-e-3 are returned.Must be one of url or b64_json. URLs are only valid for 60 minutes after the image has been generated.This parameter isn’t supported for the GPT image models, which always return base64-encoded images.
sizeobjectNoThe size of the generated images.Must be one of 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto (default value) for the GPT image models,one of 256x256, 512x512, or 1024x1024 for dall-e-2,and one of 1024x1024, 1792x1024, or 1024x1792 for dall-e-3.
streamobjectNoGenerate the image in streaming mode. Defaults to false.See the Image generation guide for more information.This parameter is only supported for the GPT image models.
styleobjectNoThe style of the generated images. This parameter is only supported for dall-e-3.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.
userstringNoA unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.

Request Examples

Simple edit with dall-e-2

{
  "image": "data:image/png;base64,<BASE64_IMAGE>",
  "prompt": "Add a red bow tie to the cat",
  "model": "dall-e-2",
  "n": 1,
  "size": "1024x1024",
  "response_format": "url"
}

Edit using a mask (dall-e-2)

{
  "image": "data:image/png;base64,<BASE64_IMAGE>",
  "mask": "data:image/png;base64,<BASE64_MASK>",
  "prompt": "Replace the sky with a sunset",
  "model": "dall-e-2",
  "size": "512x512"
}

Edit with GPT image model

{
  "image": "data:image/png;base64,<BASE64_IMAGE>",
  "prompt": "Make the background transparent and add autumn colors",
  "model": "gpt-image-1",
  "background": "transparent",
  "output_format": "png",
  "quality": "high",
  "input_fidelity": "high",
  "n": 2
}

Streaming edit with GPT image model

{
  "image": "data:image/png;base64,<BASE64_IMAGE>",
  "prompt": "Convert to watercolor painting style",
  "model": "gpt-image-1.5",
  "stream": true,
  "partial_images": 2,
  "output_format": "webp",
  "output_compression": 85
}

Edit multiple images (GPT image models)

{
  "image": [
    "data:image/png;base64,<BASE64_IMAGE1>",
    "data:image/png;base64,<BASE64_IMAGE2>"
  ],
  "prompt": "Apply vintage filter to all images",
  "model": "gpt-image-1",
  "n": 1,
  "size": "1536x1024"
}

Successful response

Response Schema

FieldTypeRequiredDescription
createdintegerYes-
dataArray<ImageObject>Yes-
usageobjectNoUsage information for image generation (provider-dependent)

Response Example

{
  "created": 1677652288,
  "data": [
    {
      "url": "https://example.com/edited-image.png"
    }
  ]
}

Code Examples

JavaScript (Fetch)

const response = await fetch('https://api.uuroute.ai/v1/images/edits', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({})
});

const data = await response.json();
console.log(data);

Python (requests)

import requests

url = "https://api.uuroute.ai/v1/images/edits"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

response = requests.post(url, json={}, headers=headers)
data = response.json()
print(data)

cURL

curl -X POST "https://api.uuroute.ai/v1/images/edits" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Schema Reference

ImageGenerationRequest

FieldTypeRequiredDescription
promptstringYesA text description of the desired image(s).- Maximum length is 32000 characters for the GPT image models- Maximum length is 1000 characters for dall-e-2- Maximum length is 4000 characters for dall-e-3
backgroundobjectNoAllows to set transparency for the background of the generated image(s).This parameter is only supported for the GPT image models.Must be one of transparent, opaque or auto (default value).When auto 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 either png (default value) or webp.
modelstringNoThe model to use for image generation. One of dall-e-2, dall-e-3, or a GPT image model (gpt-image-1, gpt-image-1-mini, gpt-image-1.5).Defaults to dall-e-2 unless a parameter specific to the GPT image models is used.
moderationobjectNoControl the content-moderation level for images generated by the GPT image models.Must be either low for less restrictive filtering or auto (default value).
nobjectNoThe number of images to generate. Must be between 1 and 10.For dall-e-3, only n=1 is supported.
output_compressionobjectNoThe compression level (0-100%) for the generated images.This parameter is only supported for the GPT image models with the webp or jpeg output formats, and defaults to 100.
output_formatobjectNoThe format in which the generated images are returned.This parameter is only supported for the GPT image models.Must be one of png, jpeg, or webp.
partial_imagesintegerNoThe 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.
qualityobjectNoThe quality of the image that will be generated.- auto (default value) will automatically select the best quality for the given model.- high, medium and low are supported for the GPT image models.- hd and standard are supported for dall-e-3.- standard is the only option for dall-e-2.
response_formatobjectNoThe format in which generated images with dall-e-2 and dall-e-3 are returned.Must be one of url or b64_json. URLs are only valid for 60 minutes after the image has been generated.This parameter isn’t supported for the GPT image models, which always return base64-encoded images.
sizeobjectNoThe size of the generated images.Must be one of 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto (default value) for the GPT image models,one of 256x256, 512x512, or 1024x1024 for dall-e-2,and one of 1024x1024, 1792x1024, or 1024x1792 for dall-e-3.
streamobjectNoGenerate the image in streaming mode. Defaults to false.See the Image generation guide for more information.This parameter is only supported for the GPT image models.
styleobjectNoThe style of the generated images. This parameter is only supported for dall-e-3.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.
userstringNoA unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.

ImageGenerationResponse

FieldTypeRequiredDescription
createdintegerYes-
dataArray<ImageObject>Yes-
usageobjectNoUsage information for image generation (provider-dependent)

ImageObject

FieldTypeRequiredDescription
urlstringNoImage URL
b64_jsonstringNoBase64-encoded JSON
revised_promptstringNoRevised prompt

ImageUsage

FieldTypeRequiredDescription
prompt_tokensintegerNoToken count for the prompt
image_tokensintegerNoToken count for the generated image (GPT-Image-1/1.5)
input_text_tokensintegerNoInput text token count (Qwen)
output_image_tokensintegerNoOutput image token count (Qwen)
widthintegerNoGenerated image width (Qwen)
heightintegerNoGenerated image height (Qwen)
image_countintegerNoNumber of images generated (Qwen)