API DocsAI Model APIsImagesOpenAI
Generate Images
Creates an image given a prompt. [Learn more](https://platform.openai.com/docs/guides/images).
Generate Images
Creates an image given a prompt. Learn more.
Base URL
https://autorouter.top— Production
Authentication
BearerAuth: http (bearer)
Authenticate using a Bearer Token.
Format: Authorization: Bearer sk-xxxxxx
Endpoints
POST /v1/images/generations
Generate Image
Creates an image given a prompt. Learn more.
Request Body
Content-Type: application/json
Properties:
| Name | Type | Required | Description |
|---|---|---|---|
model | string | No | ID of the model to use for image generation. |
prompt | string | Yes | A text description of the desired image. Maximum length is 32000 characters for gpt-image-1, 1000 for dall-e-2, and 4000 for dall-e-3. |
n | integer | No | The number of images to generate. Must be between 1 and 10. For dall-e-3, only n=1 is supported. |
size | string | No | The size of the generated images. For gpt-image-1, must be one of 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or auto (default). For dall-e-2, must be one of 256x256, 512x512, or 1024x1024. For dall-e-3, must be one of 1024x1024, 1792x1024, or 1024x1792. |
background | string | No | Allows setting transparency for the background of generated images. Only supported for gpt-image-1. Must be one of transparent, opaque, or auto (default). When using auto, 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 png (default) or webp. |
moderation | string | No | Controls the content-moderation level for images generated by gpt-image-1. Must be low for less restrictive filtering or auto (default). |
quality | string | No | The quality of the generated image. |
stream | string | No | - |
style | string | No | - |
user | string | No | - |
Responses
200: Response
Content-Type: application/json
Request Example
curl -X POST "https://autorouter.top/v1/images/generations" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A cute cartoon cat sitting on a colorful rainbow, digital art style",
"n": 1,
"size": "1024x1024"
}'Response Examples
{
"created": 0,
"data": [
{
"b64_json": "string",
"url": "string"
}
],
"usage": {
"total_tokens": 0,
"input_tokens": 0,
"output_tokens": 0,
"input_tokens_details": {
"text_tokens": 0,
"image_tokens": 0
}
}
}