Skip to main content
POST
/
v1
/
images
/
generations
Create image
curl --request POST \
  --url https://router.requesty.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "azure/openai/gpt-image-1",
  "prompt": "A watercolor painting of a Japanese garden in autumn",
  "n": 1,
  "size": "1024x1024",
  "quality": "auto",
  "response_format": "url",
  "background": "auto",
  "output_format": "png"
}
'
{
  "created": 1719000000,
  "data": [
    {
      "url": "<string>",
      "b64_json": "<string>"
    }
  ]
}
Generate images from a text prompt using OpenAI-compatible image generation models through Requesty’s routing.

Base URL

https://router.requesty.ai/v1/images/generations

Authentication

Include your Requesty API key in the request headers:
Authorization: Bearer YOUR_REQUESTY_API_KEY

Example Request

curl https://router.requesty.ai/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
  -d '{
    "model": "azure/openai/gpt-image-1",
    "prompt": "A watercolor painting of a Japanese garden in autumn",
    "n": 1,
    "size": "1024x1024",
    "quality": "auto"
  }'

Supported Models

  • azure/openai/gpt-image-1 — OpenAI’s GPT Image 1 model via Azure
  • azure/openai/gpt-image-1.5 — OpenAI’s GPT Image 1.5 model via Azure

Transparent Backgrounds

Use the background parameter to generate images with transparent backgrounds (useful for logos, icons, and design assets):
curl https://router.requesty.ai/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
  -d '{
    "model": "azure/openai/gpt-image-1",
    "prompt": "A simple icon of a rocket ship",
    "background": "transparent",
    "output_format": "png"
  }'

Error Handling

The API returns standard HTTP status codes:
  • 200 - Success
  • 400 - Bad Request (invalid parameters)
  • 401 - Unauthorized (invalid API key)
  • 429 - Rate Limited
  • 500 - Internal Server Error
This endpoint is fully compatible with the OpenAI Images API. You can use the OpenAI SDK’s client.images.generate() method directly.
For models that generate images as part of a conversational response (e.g., Gemini), use the Chat Completions endpoint instead. See the Image Generation feature guide for a full comparison.

Authorizations

Authorization
string
header
required

API key for authentication

Body

application/json
model
string
required

The model to use for image generation

Example:

"azure/openai/gpt-image-1"

prompt
string
required

A text description of the desired image

Example:

"A watercolor painting of a Japanese garden in autumn"

n
integer
default:1

The number of images to generate

Required range: x >= 1
Example:

1

size
enum<string>
default:1024x1024

The size of the generated images

Available options:
1024x1024,
1536x1024,
1024x1536
Example:

"1024x1024"

quality
enum<string>
default:auto

The quality of the generated image

Available options:
auto,
high,
medium,
low
Example:

"auto"

response_format
enum<string>
default:url

The format in which the generated images are returned

Available options:
url,
b64_json
Example:

"url"

background
enum<string>
default:auto

The background type for the generated image

Available options:
auto,
transparent,
opaque
Example:

"auto"

output_format
enum<string>
default:png

The file format of the generated image

Available options:
png,
jpeg,
webp
Example:

"png"

Response

Image generation response

created
integer
required

The Unix timestamp of when the image was created

Example:

1719000000

data
object[]
required

The list of generated images