Overview
Image generation and editing via OpenAI GPT-4o image capabilities. Excels at precise instruction-following, photorealistic rendering, and multi-step image editing tasks.
Primary Endpoint
POST
/api/v1/userGptImage/startStart GPT Image generation or editing
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Name of the image generation task |
| prompt | string | Yes | Text prompt for image generation (max 3000 chars) |
| input_images | array<string> | No | Array of input image URLs for image-to-image editing (up to 16 images for GPT Image 1.5) |
| model | enum: gpt-image-1.5 | gpt-image-2 | No | Model variant. gpt-image-1.5 (20/35 coins) supports both aspect_ratio and quality. gpt-image-2 (25/35/45 coins per image based on resolution: 1K=25, 2K=35, 4K=45; aspect_ratio=auto is billed as 1K, aspect_ratio=1:1 + 4K is downgraded to 2K) follows the current model spec: quality is fixed to medium; aspect_ratio exposes 9 ratios (auto/1:1/9:16/21:9/16:9/4:3/3:2/3:4/2:3); resolution supports 1K/2K/4K. |
| aspect_ratio | enum: auto | 1:1 | 9:16 | 21:9 | 16:9 | 4:3 | 3:2 | 3:4 | 2:3 | No | gpt-image-1.5 only supports 1:1/3:2/2:3 (other values are normalized to 1:1). gpt-image-2 supports 9 ratios. Note: 5:4/4:5 are not exposed because fallback generation would lose the aspect ratio. |
| quality | enum: medium | high | No | Image quality level. Only used by gpt-image-1.5 |
| resolution | enum: 1K | 2K | 4K | No | Image resolution. Only used by gpt-image-2. Constraints: aspect_ratio=1:1 cannot use 4K; aspect_ratio=auto (or omitted) only supports 1K, otherwise upstream will reject the task. |
| force_generate | boolean | No | Force generation even if NSFW content is detected |
| webhook_url | string | No | HTTPS URL to receive task.completed / task.failed notifications. Best-effort delivery, single attempt, no retries; clients should treat the detail API as the source of truth. |
| webhook_token | string | No | Optional plaintext token returned in the X-A2e-Webhook-Token header so receivers can verify the request originated from a2e. |
Request Example
curl -X POST "https://www.a2e.com.cn/api/v1/userGptImage/start" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "My generation task",
"prompt": "A cinematic scene with natural motion",
"input_images": [],
"model": "gpt-image-1.5",
"aspect_ratio": "1:1",
"quality": "medium",
"resolution": "1K",
"force_generate": false,
"webhook_url": "https://your-server.example.com/a2e/webhook",
"webhook_token": "a-shared-secret"
}'Related Endpoints
POST
/api/v1/userGptImage/startStart GPT Image generation or editing
GET
/api/v1/userGptImage/listGet GPT Image task list
POST
/api/v1/userGptImage/batchDetailBatch query task details
GET
/api/v1/userGptImage/detail/{id}Get task details
DELETE
/api/v1/userGptImage/{id}Delete GPT Image task
Responses
200
Task started successfully or NSFW content detected
401
Unauthorized - Invalid or missing bearer token