Skip to main content
POST
/
vendors
/
openai
/
v1
/
gpt-image-2
/
generation
Text to Image
curl --request POST \
  --url https://api.mulerouter.ai/vendors/openai/v1/gpt-image-2/generation \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "<string>",
  "quality": "high",
  "size": "auto",
  "n": 1,
  "format": "png"
}
'
{
  "task_info": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "status": "pending",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  }
}

Overview

Generate high-quality images from text prompts using OpenAI’s GPT Image 2 model. Supports multiple resolutions up to 4K, four quality tiers, and PNG / JPEG / WebP output — with up to 4 images per request.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
prompt
string
required

Text prompt to guide image generation.

Minimum string length: 1
quality
enum<string>
default:high

Image quality level.

Available options:
high,
medium,
low,
auto
size
enum<string>
default:auto

Output image resolution.

Available options:
1024x1024,
1536x1024,
1024x1536,
2048x2048,
2048x1152,
3840x2160,
2160x3840,
auto
n
integer
default:1

Number of images to generate.

Required range: 1 <= x <= 4
format
enum<string>
default:png

Output image format.

Available options:
png,
jpeg,
webp

Response

202 - application/json

Accepted - Task created successfully

task_info
object