Text-to-Image / Image Edit Task API Usage

Common Conventions

  • All interfaces require request headers Authorization: Bearer <apiKey> and Topview-Uid: <userId>
  • Successful response unified structure: { "code": "200", "message": "Success", "result": { ... } }
  • After task submission, returns taskId. Frontend polls the query interface to get results

I. Text-to-Image

1.1 Submit Task

POST /v1/common_task/text2image/task/submit

Request Headers

ParameterTypeRequiredDescription
Topview-UidstringYesUser ID

Request Body (JSON)

ParameterTypeRequiredDescription
modelstringYesModel display name, e.g., "Nano Banana 2", "Seedream 5.0", see supported models table below
promptstringYesPositive prompt text
aspectRatiostringYesAspect ratio, supported values vary by model, see supported models table below
resolutionstringModel-dependentResolution, e.g., "512p", "1K", "2K", "4K"; required for some models, not supported by others, see supported models table below
qualitystringModel-dependentQuality tier: low / medium / high (case-insensitive). Supported only by GPT Image 2 and Reve Image; defaults to medium when omitted; not allowed for other models
generateCountintegerYesNumber of images to generate, 1~4
boardIdstringNoBoard ID. When provided, a task record will be created in the Board

Supported Models and Parameter Constraints

Note: The model parameter should use the model display name (e.g., "Nano Banana 2"), not the code.

Model NameAspect Ratio Options (aspectRatio)Resolution (resolution)Quality (quality)Remarks
Nano Banana 29:16, 3:4, 1:1, 4:3, 16:9, 2:3, 3:2, 5:4, 4:5, 21:9, 4:1, 1:4, 8:1, 1:8512p, 1K, 2K, 4K (required)Not supported, do not passSupports 14 aspect ratios
Nano Banana 2 Lite9:16, 3:4, 1:1, 4:3, 16:9, 2:3, 3:2, 5:4, 4:5, 21:9, 4:1, 1:4, 8:1, 1:81K (required, only supports 1K)Not supported, do not passSupports 14 aspect ratios
Nano Banana Pro1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:91K, 2K, 4K (required)Not supported, do not pass
Nano Banana9:16, 3:4, 1:1, 4:3, 16:9Not supported, do not passNot supported, do not pass
Seedream 5.0 Proauto, 9:16, 3:4, 2:3, 1:1, 3:2, 4:3, 16:9, 21:91K, 2K (required)Not supported, do not passauto means the model automatically determines the aspect ratio
Seedream 5.0 Liteauto, 9:16, 3:4, 1:1, 4:3, 16:9, 21:92K (required, only supports 2K)Not supported, do not passJSON standard name; Seedream 5.0 is a compatibility alias
Seedream 5.0auto, 9:16, 3:4, 1:1, 4:3, 16:9, 21:92K (required, only supports 2K)Not supported, do not passCompatibility alias, equivalent to Seedream 5.0 Lite
Seedream 4.5auto, 9:16, 3:4, 1:1, 4:3, 16:9, 21:92K, 4K (required)Not supported, do not passauto means the model automatically determines the aspect ratio
Seedream 4.0auto, 9:16, 3:4, 1:1, 4:3, 16:9, 21:91K, 2K, 4K (required)Not supported, do not passauto means the model automatically determines the aspect ratio
Reve Image9:16, 3:4, 2:3, 1:1, 3:2, 4:3, 16:91K, 2K, 4K (required)low / medium / high (optional, default medium)Text-to-Image only
Midjourney v8.19:16, 3:4, 1:1, 4:3, 16:9, 2:3, 3:2, 5:4, 4:5, 21:9, 9:21, 1:2, 2:1Not supported, do not passNot supported, do not passSupports 13 aspect ratios
Midjourney v79:16, 3:4, 1:1, 4:3, 16:9, 2:3, 3:2, 5:4, 4:5, 21:9, 9:21, 1:2, 2:1Not supported, do not passNot supported, do not passSupports 13 aspect ratios
Wan 2.7 Image Pro9:16, 3:4, 1:1, 4:3, 16:9, 2:3, 3:21K, 2K, 4K (required)Not supported, do not pass
Wan 2.7 Image9:16, 3:4, 1:1, 4:3, 16:9, 2:3, 3:21K, 2K (required)Not supported, do not pass
Kling V3 Omni9:16, 3:4, 2:3, 1:1, 3:2, 4:3, 16:9, 21:91K, 2K, 4K (required)Not supported, do not pass
Kling V39:16, 3:4, 2:3, 1:1, 3:2, 4:3, 16:9, 21:91K, 2K (required)Not supported, do not pass
Kling 2.19:16, 3:4, 2:3, 1:1, 3:2, 4:3, 16:9, 21:91K, 2K (required)Not supported, do not pass
Grok Image Quality1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 2:1, 1:2, 20:9, 9:20, 19.5:9, 9:19.51K, 2K (required)Not supported, do not passSupports 13 aspect ratios
Grok Image1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 2:1, 1:2, 20:9, 9:20, 19.5:9, 9:19.51K, 2K (required)Not supported, do not passSupports 13 aspect ratios
GPT Image 29:16, 3:4, 1:1, 4:3, 16:9, 2:3, 3:2, 5:4, 4:5, 21:9, 9:21, 1:2, 2:11K, 2K, 4K (required)low / medium / high (optional, default medium)Supports 13 aspect ratios
Kontext-Pro9:16, 3:4, 1:1, 4:3, 16:9Not supported, do not passNot supported, do not pass
Imagen 49:16, 3:4, 1:1, 4:3, 16:9Not supported, do not passNot supported, do not pass
  • aspectRatio: Required for all models, must be one of the supported ratios for that model
  • resolution: Models marked as "required" must pass this parameter; models marked as "not supported, do not pass" will return an error if provided
  • quality: Supported only by GPT Image 2 and Reve Image; defaults to medium when omitted; other models return an error if provided
  • generateCount: 1~4, required

Request Example

POST /v1/common_task/text2image/task/submit
Topview-Uid: user_123

{
  "model": "GPT Image 2",
  "prompt": "A futuristic city skyline at dusk, neon lights reflected on wet streets, cinematic composition",
  "aspectRatio": "16:9",
  "resolution": "2K",
  "quality": "high",
  "generateCount": 2
}

Response Example

{
  "code": "200",
  "message": "Success",
  "result": {
    "taskId": "task_t2i_20251128001",
    "status": "success",
    "noticeUuid": "uuid_abc"
  }
}

If boardId is provided, the response will additionally return boardTaskIds and boardId fields.


1.2 Query Task Result

GET /v1/common_task/text2image/task/query

Request Parameters (Query)

ParameterTypeRequiredDefaultDescription
taskIdstringYes-Task ID returned from submission
needCloudFrontUrlbooleanNofalseWhether to return CloudFront URL

Request Example

GET /v1/common_task/text2image/task/query?taskId=task_t2i_20251128001
Topview-Uid: user_123

Response Example (In Progress)

{
  "code": "200",
  "message": "Success",
  "result": {
    "taskId": "task_t2i_20251128001",
    "status": "running",
    "errorMsg": null,
    "costCredit": "0.000",
    "images": []
  }
}

Response Example (Success)

{
  "code": "200",
  "message": "Success",
  "result": {
    "taskId": "task_t2i_20251128001",
    "status": "success",
    "errorMsg": null,
    "costCredit": "0.400",
    "images": [
      {
        "status": "success",
        "errorMsg": null,
        "fileId": "file_img_001",
        "filePath": "https://cdn.example.com/images/output_001.jpg",
        "width": 2560,
        "height": 1440,
        "boardTaskId": null
      },
      {
        "status": "success",
        "errorMsg": null,
        "fileId": "file_img_002",
        "filePath": "https://cdn.example.com/images/output_002.jpg",
        "width": 2560,
        "height": 1440,
        "boardTaskId": null
      }
    ]
  }
}

Response Example (Failure)

{
  "code": "200",
  "message": "Success",
  "result": {
    "taskId": "task_t2i_20251128001",
    "status": "fail",
    "errorMsg": "Model service unavailable",
    "costCredit": "0.000",
    "images": []
  }
}

II. Image Edit

Image editing supports generating edited images by providing one or more reference images + a prompt. Supports instruction-based modifications, style transfer, and other scenarios.

2.1 Submit Task

POST /v1/common_task/image_edit/task/submit

Request Headers

ParameterTypeRequiredDescription
Topview-UidstringYesUser ID

Request Body (JSON)

ParameterTypeRequiredDescription
modelstringYesModel display name, e.g., "Seedream 5.0", "Kontext-Pro", see supported models table below
promptstringYesEdit prompt text describing the modifications to be made to the image
inputImageFileIdsstring[]YesList of reference image fileIds, maximum quantity varies by model (get fileId from upload interface)
aspectRatiostringYesAspect ratio; Seedream / Nano Banana / Kontext-Pro series support "auto" (follow input image ratio), see supported models table below
resolutionstringModel-dependentResolution, e.g., "512p", "1K", "2K", "4K"; required for some models, not supported by others, see supported models table below
qualitystringModel-dependentQuality tier: low / medium / high (case-insensitive). Supported only by GPT Image 2, Reve Image Edit, and Reve Image Remix; defaults to medium when omitted; not allowed for other models
generateCountintegerYesNumber of images to generate, 1~4
boardIdstringNoBoard ID. When provided, a task record will be created in the Board

Supported Models and Parameter Constraints

Note: The model parameter should use the model display name (e.g., "Seedream 5.0"), not the code.

Model NameAspect Ratio Options (aspectRatio)Resolution (resolution)Quality (quality)Max Input ImagesRemarks
Nano Banana 2auto, 9:16, 3:4, 1:1, 4:3, 16:9, 2:3, 3:2, 5:4, 4:5, 21:9, 4:1, 1:4, 8:1, 1:8512p, 1K, 2K, 4K (required)Not supported, do not pass14auto follows input image ratio
Nano Banana 2 Liteauto, 9:16, 3:4, 1:1, 4:3, 16:9, 2:3, 3:2, 5:4, 4:5, 21:9, 4:1, 1:4, 8:1, 1:81K (required, only supports 1K)Not supported, do not pass14auto follows input image ratio
Nano Banana Proauto, 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:91K, 2K, 4K (required)Not supported, do not pass6auto follows input image ratio
Nano Bananaauto, 9:16, 3:4, 1:1, 4:3, 16:9Not supported, do not passNot supported, do not pass6auto follows input image ratio
Seedream 5.0 Proauto, 9:16, 3:4, 2:3, 1:1, 3:2, 4:3, 16:9, 21:91K, 2K (required)Not supported, do not pass14auto follows input image ratio
Seedream 5.0 Liteauto, 9:16, 3:4, 1:1, 4:3, 16:9, 21:92K (required, only supports 2K)Not supported, do not pass14JSON standard name; Seedream 5.0 is alias
Seedream 5.0auto, 9:16, 3:4, 1:1, 4:3, 16:9, 21:92K (required, only supports 2K)Not supported, do not pass14Compatibility alias
Seedream 4.5auto, 9:16, 3:4, 1:1, 4:3, 16:9, 21:92K, 4K (required)Not supported, do not pass14auto follows input image ratio
Seedream 4.0auto, 9:16, 3:4, 1:1, 4:3, 16:9, 21:91K, 2K, 4K (required)Not supported, do not pass5auto follows input image ratio
Reve Image Editauto, 9:16, 3:4, 2:3, 1:1, 3:2, 4:3, 16:91K, 2K, 4K (required)low / medium / high (optional, default medium)1Image Edit only; single image mode
Reve Image Remixauto, 9:16, 3:4, 2:3, 1:1, 3:2, 4:3, 16:91K, 2K, 4K (required)low / medium / high (optional, default medium)6Image Edit only; multi-image mode
Midjourney v8.19:16, 3:4, 1:1, 4:3, 16:9, 2:3, 3:2, 5:4, 4:5, 21:9, 9:21, 1:2, 2:1Not supported, do not passNot supported, do not pass4Supports 13 aspect ratios
Midjourney v79:16, 3:4, 1:1, 4:3, 16:9, 2:3, 3:2, 5:4, 4:5, 21:9, 9:21, 1:2, 2:1Not supported, do not passNot supported, do not pass4Supports 13 aspect ratios
Wan 2.7 Image Pro9:16, 3:4, 1:1, 4:3, 16:9, 2:3, 3:21K, 2K (required)Not supported, do not pass9
Wan 2.7 Image9:16, 3:4, 1:1, 4:3, 16:9, 2:3, 3:21K, 2K (required)Not supported, do not pass9
Kling V3 Omni9:16, 3:4, 2:3, 1:1, 3:2, 4:3, 16:9, 21:91K, 2K, 4K (required)Not supported, do not pass10
Kling V39:16, 3:4, 2:3, 1:1, 3:2, 4:3, 16:9, 21:91K, 2K (required)Not supported, do not pass4
Kling 2.19:16, 3:4, 2:3, 1:1, 3:2, 4:3, 16:9, 21:91K, 2K (required)Not supported, do not pass4
Grok Image Quality1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 2:1, 1:2, 20:9, 9:20, 19.5:9, 9:19.51K, 2K (required)Not supported, do not pass3
Grok Image1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 2:1, 1:2, 20:9, 9:20, 19.5:9, 9:19.51K, 2K (required)Not supported, do not pass3
GPT Image 29:16, 3:4, 1:1, 4:3, 16:9, 2:3, 3:2, 5:4, 4:5, 21:9, 9:21, 1:2, 2:11K, 2K, 4K (required)low / medium / high (optional, default medium)16Supports 13 aspect ratios
Kontext-Proauto, 9:16, 3:4, 1:1, 4:3, 16:9Not supported, do not passNot supported, do not pass1Specialized for image editing; single image mode

Request Example

POST /v1/common_task/image_edit/task/submit
Topview-Uid: user_123

{
  "model": "GPT Image 2",
  "prompt": "Change the background to a snowy mountain landscape, keep the subject unchanged",
  "inputImageFileIds": ["file_src_img_001"],
  "aspectRatio": "1:1",
  "resolution": "2K",
  "quality": "medium",
  "generateCount": 1
}

Request Example (Multi-Image Reference)

POST /v1/common_task/image_edit/task/submit
Topview-Uid: user_123

{
  "model": "Nano Banana 2",
  "prompt": "Blend the style of both images into a unified artistic composition",
  "inputImageFileIds": ["file_img_style001", "file_img_content001"],
  "aspectRatio": "1:1",
  "resolution": "2K",
  "generateCount": 2
}

Response Example

{
  "code": "200",
  "message": "Success",
  "result": {
    "taskId": "task_ie_20251228001",
    "status": "success",
    "noticeUuid": "uuid_ie_xyz"
  }
}

If boardId is provided, the response will additionally return boardTaskIds and boardId fields.


2.2 Query Task Result

GET /v1/common_task/image_edit/task/query

Request Parameters (Query)

ParameterTypeRequiredDefaultDescription
taskIdstringYes-Task ID returned from submission
needCloudFrontUrlbooleanNofalseWhether to return CloudFront URL

Request Example

GET /v1/common_task/image_edit/task/query?taskId=task_ie_20251228001
Topview-Uid: user_123

Response Example (Success)

{
  "code": "200",
  "message": "Success",
  "result": {
    "taskId": "task_ie_20251228001",
    "status": "success",
    "errorMsg": null,
    "costCredit": "0.200",
    "images": [
      {
        "status": "success",
        "errorMsg": null,
        "fileId": "file_edited_001",
        "filePath": "https://cdn.example.com/images/edited_001.jpg",
        "width": 2560,
        "height": 1440,
        "boardTaskId": null
      }
    ]
  }
}

Response Example (Partial Success)

{
  "code": "200",
  "message": "Success",
  "result": {
    "taskId": "task_ie_20251228002",
    "status": "success",
    "errorMsg": "Partial tasks failed (1/2): Content policy violation",
    "costCredit": "0.200",
    "images": [
      {
        "status": "success",
        "errorMsg": null,
        "fileId": "file_edited_002",
        "filePath": "https://cdn.example.com/images/edited_002.jpg",
        "width": 2560,
        "height": 1440,
        "boardTaskId": null
      },
      {
        "status": "fail",
        "errorMsg": "Content policy violation",
        "fileId": null,
        "filePath": null,
        "width": null,
        "height": null,
        "boardTaskId": null
      }
    ]
  }
}

III. Common Specifications

Task Status Enumeration

Status ValueMeaning
initTask submitted, waiting for processing
runningTask is being processed
successTask completed successfully
failTask failed, see errorMsg field for error reason

Polling Recommendations

Recommended polling interval: 3–5 seconds, timeout should be set to 5 minutes.

Sub-tasks in images

When generateCount > 1, the images list contains multiple sub-task results. Each sub-task has an independent status.

  • Parent task status=success: All sub-tasks are completed (some sub-tasks may be fail, check the sub-task's status and errorMsg)
  • Parent task status=fail: All sub-tasks failed

When partial failures occur, the parent task's errorMsg summarizes the failure reasons, e.g., "Partial tasks failed (1/2): Content policy violation".

Query Response Fields

FieldTypeDescription
taskIdstringTask ID
statusstringTask status, see enumeration above
errorMsgstringError message (has value when task fails or partially fails)
costCreditnumberCredits consumed by task (floating point number)
boardIdstringAssociated Board ID (returned if task comes from Board)
imagesarrayList of generated image results, each item contains: status, errorMsg, fileId, filePath, width, height, boardTaskId

IV. Credit Billing Explanation

totalCost = unitCost × generateCount

Credit types: Text-to-Image is common_task_text2image, Image Edit is common_task_image_edit.

Billing Explanation: Credits are deducted when the task is submitted, settled based on actual consumption when the task succeeds, and refunded if the task fails.

Pricing Rules:

  • Models that support quality: prefer pricing[resolution_quality] (e.g., pricing["2K_high"]); when omitted, API defaults to medium
  • Models with resolution but without quality: price by pricing[resolution] (e.g., pricing["2K"])
  • Models without resolution parameter: price by pricing["default"]

4.1 Text-to-Image (textToImage) Pricing Table


Models Billed by Resolution (Unit: Credits/Generation, generateCount=1)

Model Name512p1K2K4K
Nano Banana 20.250.400.600.85
Nano Banana 2 Lite0.30
Nano Banana Pro0.800.801.40
Seedream 5.0 Pro0.400.80
Seedream 5.0 Lite0.20
Seedream 5.00.20
Seedream 4.50.200.20
Seedream 4.00.150.150.15
Reve Image1.601.802.00
Grok Image Quality0.601.00
Grok Image0.300.30
GPT Image 20.200.801.40
Kling 2.10.150.15
Kling V30.300.30
Kling V3 Omni0.300.300.60
Wan 2.7 Image0.400.40
Wan 2.7 Image Pro0.800.800.80

Fixed Price Models (Unit: Credits/Generation, not differentiated by resolution)

Model NameUnit Price
Nano Banana0.30
Kontext-Pro0.50
Imagen 40.50
Midjourney v8.10.50
Midjourney v70.50

4.2 Image Edit (imageEdit) Pricing Table

Image Edit pricing follows Text-to-Image model pricing in general. Image Edit does not include Imagen 4, GPT Image 1.5, or Reve Image; Reve Image Edit / Reve Image Remix support Image Edit only; Wan 2.7 Image Pro in Image Edit supports only 1K/2K (no 4K pricing).


Models Billed by Resolution (Unit: Credits/Generation, generateCount=1)

Model Name512p1K2K4K
Nano Banana 20.250.400.600.85
Nano Banana 2 Lite0.30
Nano Banana Pro0.800.801.40
Seedream 5.0 Pro0.400.80
Seedream 5.0 Lite0.20
Seedream 5.00.20
Seedream 4.50.200.20
Seedream 4.00.150.150.15
Reve Image Edit1.601.802.00
Reve Image Remix1.601.802.00
Grok Image Quality0.601.00
Grok Image0.300.30
GPT Image 20.200.801.40
Kling 2.10.150.15
Kling V30.300.30
Kling V3 Omni0.300.300.60
Wan 2.7 Image0.400.40
Wan 2.7 Image Pro0.800.80

Fixed Price Models (Unit: Credits/Generation, not differentiated by resolution)

Model NameUnit Price
Nano Banana0.30
Kontext-Pro0.50
Midjourney v8.10.50
Midjourney v70.50