Developer Docs/GPT Image API

GPT Image API

Build GPT Image integrations with A2E. Review authentication, request parameters, task creation, status, and result endpoints.

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/start

Start GPT Image generation or editing

Request Parameters

NameTypeRequiredDescription
namestringYesName of the image generation task
promptstringYesText prompt for image generation (max 3000 chars)
input_imagesarray<string>NoArray of input image URLs for image-to-image editing (up to 16 images for GPT Image 1.5)
modelenum: gpt-image-1.5 | gpt-image-2NoModel 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_ratioenum: auto | 1:1 | 9:16 | 21:9 | 16:9 | 4:3 | 3:2 | 3:4 | 2:3Nogpt-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.
qualityenum: medium | highNoImage quality level. Only used by gpt-image-1.5
resolutionenum: 1K | 2K | 4KNoImage 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_generatebooleanNoForce generation even if NSFW content is detected
webhook_urlstringNoHTTPS 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_tokenstringNoOptional 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/start

Start GPT Image generation or editing

GET/api/v1/userGptImage/list

Get GPT Image task list

POST/api/v1/userGptImage/batchDetail

Batch 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