PieBox
Documentation

Image Generation

Multi-model image generation: Seedream, Gemini, GPT-Image-2

Multiple models are supported: Seedream (lightweight, optimized for Chinese prompts), Gemini Flash/Pro, and GPT-Image-2.

Seedream

Best for Chinese-language prompts. Ideal for Chinese-style art, anime, and everyday illustrations.

Request:

POST /v2/extend/image/seedream/generations

Parameters:

ParameterTypeRequiredDescription
promptstringYesImage description
sizestringNoDimensions, minimum 1920×1920 (must be ≥ 3.68M pixels)
imagearrayNoReference images (URL or base64)

Example:

curl https://tokenhub.piegateway.me/v2/extend/image/seedream/generations \
  -H "X-API-Key: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a cat playing guitar on the moon",
    "size": "2048x2048"
  }'

Response:

{ "task_id": "img_gen_xxx", "model": "novita_seedream/seedream-5.0-lite" }

Gemini

Versatile styles. Available in Flash (fast) and Pro (high quality).

Request:

POST /v2/extend/image/generations

Parameters:

ParameterTypeRequiredDescription
modelstringNoModel name, default gemini-3.1-flash-image, or gemini-3-pro-image
promptstringYesImage description
sizestringNoOptions: 0.5K, 1K, 2K, 4K
aspect_ratiostringNoAspect ratio: 1:1, 3:2, 2:3, 3:4, 4:3, 16:9, 9:16
output_formatstringNoOutput format: image/png, image/jpeg, image/webp

Example:

curl https://tokenhub.piegateway.me/v2/extend/image/generations \
  -H "X-API-Key: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-image",
    "prompt": "a cat playing guitar on the moon",
    "size": "2K"
  }'

GPT-Image-2

OpenAI's image model. Best for text rendering in images.

Request:

POST /v2/extend/image/gpt_image/generations

Parameters:

ParameterTypeRequiredDescription
promptstringYesImage description
sizestringNoe.g. 1024x1024, 1024x1536
qualitystringNoQuality tier: low / medium / high
nnumberNoNumber of images (default 1)
backgroundstringNoBackground: opaque / transparent
output_formatstringNoOutput format: png / jpeg / webp
output_compressionnumberNoCompression rate (0–100)

Example:

curl https://tokenhub.piegateway.me/v2/extend/image/gpt_image/generations \
  -H "X-API-Key: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a futuristic city at sunset",
    "size": "1024x1024",
    "quality": "medium"
  }'

Checking Image Generation Results

All image generation endpoints are asynchronous — they return a task_id, and you need to poll for the result.

Request:

GET /v2/extend/image/tasks/{task_id}
GET /v2/extend/image/seedream/tasks/{task_id}
GET /v2/extend/image/gpt_image/tasks/{task_id}

Example:

curl https://tokenhub.piegateway.me/v2/extend/image/seedream/tasks/<task_id> \
  -H "X-API-Key: <your-api-key>"

Response Example:

{
  "task_id": "img_gen_xxx",
  "status": "succeeded",
  "model": "novita_seedream/seedream-5.0-lite",
  "result": {
    "images": [{ "url": "https://..." }]
  }
}

Status values: pendingprocessingsucceeded or failed