v1

latestOpenAPI 3.1.02026-07-2611077199.5 KB

Generate images based on text prompts and image resources

post/openai/gpt/generations

Request body

model'gpt-image-1.5' | 'gpt-image-2' | 'gpt-image-2-plus'

Supported models

promptstring required

Text prompt for image generation. Since this is a reverse-engineered model, it's recommended to include keywords in your prompt such as: "draw a xxx", "generate a", 'draw a xxx', Language is not restricted; OpenAI itself supports multilingual models with excellent Chinese support.

referImagesstring[]

Reference image array

aspect_ratio'1:1' | '3:4' | '4:3' | '16:9' | '9:16'

Support model: gpt-image-2

sizestring

Image Size (width × height), support model: gpt-image-2-plus

must meet the following constraints:

Both width and height must be multiples of 16 Maximum edge ≤ 3840 Aspect ratio ≤ 3:1 Total pixels: 655,360 ~ 8,294,400

If the input size is invalid, it will be automatically adjusted to a valid range

hookUrlstring

Callback notification URL. When task completes or fails, this URL will be notified. <a href="gpt-fetch" target="_self">Notification data structure</a> is consistent with fetch structure. If not set, you need to request the <a href="gpt-fetch" target="_self">fetch endpoint</a> for query

Example request

{
  "referImages": [
    "https://cdn.ttapi.io/xxx1.png",
    "https://cdn.ttapi.io/xxx2.png"
  ],
  "aspect_ratio": "1:1",
  "size": "1024x1024"
}

Response

Request successful

statusstring required
messagestring required
dataobject required

Example response

{
  "status": "SUCCESS",
  "message": "success",
  "data": {
    "jobId": "jobId"
  }
}