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/generationsParameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Image description |
| size | string | No | Dimensions, minimum 1920×1920 (must be ≥ 3.68M pixels) |
| image | array | No | Reference 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/generationsParameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | No | Model name, default gemini-3.1-flash-image, or gemini-3-pro-image |
| prompt | string | Yes | Image description |
| size | string | No | Options: 0.5K, 1K, 2K, 4K |
| aspect_ratio | string | No | Aspect ratio: 1:1, 3:2, 2:3, 3:4, 4:3, 16:9, 9:16 |
| output_format | string | No | Output 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/generationsParameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Image description |
| size | string | No | e.g. 1024x1024, 1024x1536 |
| quality | string | No | Quality tier: low / medium / high |
| n | number | No | Number of images (default 1) |
| background | string | No | Background: opaque / transparent |
| output_format | string | No | Output format: png / jpeg / webp |
| output_compression | number | No | Compression 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: pending → processing → succeeded or failed