Skip to content

1. Image Generation

POST /generate

The primary endpoint for image generation.

Request Body

json
{
  "prompt": "Text Prompt for Image Generation",
  "negative_prompt": "Description of content not to appear in the image (optional)",
  "height": 768,
  "width": 1024,
  "num_images_per_prompt": 1
}

Parameter Description

  • prompt(Required):Text Prompt for Image Generation

  • negative_prompt(Optional):Negative Prompt – instructs the model to avoid generating specific content, default value is an empty string

  • height(Optional):Image Height: Range 128-2048, Default Value 768

  • width(Optional):Image Width: Range 128-2048, Default Value 1024

  • num_images_per_prompt(Optional):Number of Images per Prompt: Range 1-10, Default Value 1

Response(200)

json
{
  "task_id": "Task ID",
  "status": "Task Status"
}

2. Get Task Status

GET /task/{task_id}

Query the status of a specific task.

Path Parameter

  • task_id(Required):Task ID

Query Parameter

  • return_base64(Optional):Whether to include the base64-encoded image in the response, default value is false

Response (200)

json
{
  "task_id": "Task ID",
  "status": "Task Status",
  "images_base64": [
    "Array of Base64-Encoded Images (if return_base64 is true)"
  ],
  "error": "Error Message (if any)"
}

3. Get Generated Images

GET /image/{task_id}/{image_index}

Get the image at a specific index generated by a specific task.

Path Parameter

  • task_id(Required):Task ID

  • image_index(Required):Image Index

Response (200)

Image Data