Overview
Generate images from natural language prompts using the platform's diffusion model pipeline. Describe what you want - style, composition, lighting - and receive high-resolution results.
Primary Endpoint
/api/v1/userText2Image/startCreate one or more asynchronous text-to-image tasks, then return the records used to monitor generated images. Select the image model with `model_type`: - `a2e`: auto-select the default image model. It supports text-to-image and image editing with up to two reference images. - `zimage`: Z-Image Turbo for text-to-image generation. It does not accept reference images. - `seedream`: the Seedream image generation and editing family. Set `model_version` to `4.5`, `5.0`, or `5.0-pro`; Seedream 5.0 Pro accepts up to ten reference images, while 4.5 and 5.0 accept up to two. API clients should normally set concrete output dimensions with `width` and `height`. The optional `aspect_ratio` and `resolution` fields are also accepted and validated by this endpoint (an unsupported value returns 400), and both are echoed back in the task records, so they are part of the public request contract. For Seedream 5.0 Pro `aspect_ratio` takes precedence over `width`/`height`, and when it is omitted the backend falls back to `9:16`. ### Request - Send a valid bearer token. The server evaluates the operation in the authenticated caller's access context. - Send an `application/json` body. Required fields: `prompt`. - API-token callers may include `webhook_url` and `webhook_token` for best-effort terminal-state notifications; ordinary JWT/cookie calls ignore these fields. ### Behavior - This is an asynchronous operation: a successful submission creates a task and returns before processing finishes. - Persist the returned task identifier and use the corresponding detail or list operation to observe progress. - Treat the detail endpoint as the source of truth even when webhook delivery is enabled. ### Response - A `200` response confirms task acceptance; it does not by itself mean media generation has completed. - Retain the returned identifier and wait for a documented terminal status before using output URLs. - JSON object responses, including error responses, normally carry a top-level `trace_id` string for this request; include it when contacting support. It is not a task identifier. - Do not infer undocumented fields or statuses; clients should tolerate additional response properties. ### Errors - `400` — Bad Request - Invalid parameters. - `401` — Unauthorized - Invalid or missing JWT token. ### Related Operations - `GET /api/v1/userText2Image/allRecords` — Get all text to image records. - `GET /api/v1/userText2Image/{_id}` — Get text to image record detail. - `DELETE /api/v1/userText2Image/{_id}` — Delete task. Authentication: set header Authorization: Bearer <token> (supports user JWT or sk_ API token).
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | No | Name of the text to image task (optional, auto-generated if not provided) |
| prompt | string | Yes | Text prompt for image generation |
| creation_mode | enum: text-to-image | image-edit | No | Optional compatibility field for history and mode reporting; callers may omit it. The server ignores any supplied value and records `image-edit` when `input_images` contains a valid HTTP(S) image URL, otherwise `text-to-image`. It is not forwarded to the model provider. |
| width | number | No | Image width; default: 1024 |
| height | number | No | Image height; default: 1024 |
| model_type | enum: a2e | zimage | seedream | No | Model type to use for generation. Use `a2e` for automatic model selection.; default: "a2e" |
| model_version | enum: 4.5 | 5.0 | 5.0-pro | No | Seedream model version. Required to select Seedream 4.5, 5.0, or 5.0 Pro when model_type is seedream.; default: "4.5" |
| input_images | array<string> | No | Reference images for the auto-selected or Seedream model. Auto selection supports at most 2 images; Seedream 5.0 Pro supports at most 10.; maxItems: 10 |
| skip_face_enhance | boolean | No | Whether to disable face similarity enhancement for auto-selected image editing. Defaults to false.; default: false |
| aspect_ratio | enum: 1:1 | 4:3 | 3:4 | 16:9 | 9:16 | 2:3 | 3:2 | 21:9 | No | Output aspect ratio for the Seedream family. Rejected with 400 when the value is outside this enum. Seedream 5.0 Pro resolves the size from this ratio first and only falls back to `width`/`height` when it is absent, and the backend defaults it to `9:16` for Seedream requests that omit it. |
| resolution | enum: 1K | 1080P | 2K | 3K | 4K | No | Output resolution tier. Rejected with 400 when the value is outside this enum. The billed tier is the higher of this value and the tier inferred from the short side of `width`/`height`, so a large `width`/`height` cannot be billed as a lower tier. `a2e` and `zimage` only have `1K`, `1080P`, and `2K`; `3K`/`4K` are treated as `2K` for them. For Seedream 5.0 Pro the output size comes from `aspect_ratio` plus this tier, so `width`/`height` never raise an explicitly requested tier there. Effective tiers per Seedream version: `5.0-pro` distinguishes only `1K` and `2K` and treats every other value as `2K`; `4.5` and `5.0` raise `1K`/`1080P` to `2K` because Seedream requires at least 3,686,400 pixels, and pass `3K`/`4K` through (`4.5` serves the `4K` tier, `5.0` serves `3K`). |
| max_images | integer | No | Maximum number of images to generate (creates multiple tasks internally); minimum: 1; maximum: 8 |
| minor_suspected_skip | boolean | No | Set to true when retrying after error code 1004 to confirm and bypass the suspected-minor soft block.; default: false |
| 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.; maxLength: 2048 |
| webhook_token | string | No | Optional plaintext token returned in the X-A2e-Webhook-Token header so receivers can verify the request originated from a2e.; maxLength: 256 |
Request schema and conditional rules
{
"allOf": [
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the text to image task (optional, auto-generated if not provided)",
"example": "My Generated Image"
},
"prompt": {
"type": "string",
"description": "Text prompt for image generation",
"example": "A beautiful sunset over mountains"
},
"creation_mode": {
"type": "string",
"enum": [
"text-to-image",
"image-edit"
],
"description": "Optional compatibility field for history and mode reporting; callers may omit it. The server ignores any supplied value and records `image-edit` when `input_images` contains a valid HTTP(S) image URL, otherwise `text-to-image`. It is not forwarded to the model provider."
},
"width": {
"type": "number",
"description": "Image width",
"default": 1024,
"example": 1024
},
"height": {
"type": "number",
"description": "Image height",
"default": 1024,
"example": 1024
},
"model_type": {
"type": "string",
"description": "Model type to use for generation. Use `a2e` for automatic model selection.",
"enum": [
"a2e",
"zimage",
"seedream"
],
"default": "a2e",
"example": "a2e"
},
"model_version": {
"type": "string",
"description": "Seedream model version. Required to select Seedream 4.5, 5.0, or 5.0 Pro when model_type is seedream.",
"enum": [
"4.5",
"5.0",
"5.0-pro"
],
"default": "4.5",
"example": "5.0-pro"
},
"input_images": {
"type": "array",
"description": "Reference images for the auto-selected or Seedream model. Auto selection supports at most 2 images; Seedream 5.0 Pro supports at most 10.",
"items": {
"type": "string"
},
"maxItems": 10,
"example": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
]
},
"skip_face_enhance": {
"type": "boolean",
"description": "Whether to disable face similarity enhancement for auto-selected image editing. Defaults to false.",
"default": false,
"example": false
},
"aspect_ratio": {
"type": "string",
"description": "Output aspect ratio for the Seedream family. Rejected with 400 when the value is outside this enum.\nSeedream 5.0 Pro resolves the size from this ratio first and only falls back to `width`/`height` when it is absent, and the backend defaults it to `9:16` for Seedream requests that omit it.\n",
"enum": [
"1:1",
"4:3",
"3:4",
"16:9",
"9:16",
"2:3",
"3:2",
"21:9"
],
"example": "1:1"
},
"resolution": {
"type": "string",
"description": "Output resolution tier. Rejected with 400 when the value is outside this enum.\nThe billed tier is the higher of this value and the tier inferred from the short side of `width`/`height`, so a large `width`/`height` cannot be billed as a lower tier. `a2e` and `zimage` only have `1K`, `1080P`, and `2K`; `3K`/`4K` are treated as `2K` for them. For Seedream 5.0 Pro the output size comes from `aspect_ratio` plus this tier, so `width`/`height` never raise an explicitly requested tier there.\nEffective tiers per Seedream version: `5.0-pro` distinguishes only `1K` and `2K` and treats every other value as `2K`; `4.5` and `5.0` raise `1K`/`1080P` to `2K` because Seedream requires at least 3,686,400 pixels, and pass `3K`/`4K` through (`4.5` serves the `4K` tier, `5.0` serves `3K`).\n",
"enum": [
"1K",
"1080P",
"2K",
"3K",
"4K"
],
"example": "2K"
},
"max_images": {
"type": "integer",
"description": "Maximum number of images to generate (creates multiple tasks internally)",
"minimum": 1,
"maximum": 8,
"example": 1
},
"minor_suspected_skip": {
"type": "boolean",
"default": false,
"description": "Set to true when retrying after error code 1004 to confirm and bypass the suspected-minor soft block."
}
},
"required": [
"prompt"
]
},
{
"$ref": "#/components/schemas/WebhookInput"
}
]
}Response Fields
- code: integer
- Response code. 0 means success.
- data: array<object>
- Created text-to-image task records.
- data[]._id: string
- Task id.
- data[].name: string
- Task name.
- data[].prompt: string
- Generation prompt.
- data[].current_status: string
- Current task status.
- data[].image_urls: array<string>
- Generated image URLs.
- data[].width: number
- Output image width.
- data[].height: number
- Output image height.
- data[].coins: number
- Credits charged for the task.
- trace_id: string
- Trace ID of this HTTP request. Include it when contacting support about this request. It is generated per request and is not a task identifier; use the returned task `_id` to query results.
Request Example
curl -X POST "https://www.a2e.com.cn/api/v1/userText2Image/start" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A beautiful sunset over mountains"
}'Related Endpoints
/api/v1/userText2Image/{_id}Get text to image record detail
/api/v1/userText2Image/startStart text to image generation
/api/v1/userText2Image/allRecordsGet all text to image records
/api/v1/userText2Image/batchDetailBatch query task details
/api/v1/userText2Image/{_id}Delete task
/api/v1/userText2Image/quickAddAvatarQuick add avatar from generated image
Responses
Text to image task started successfully
Bad Request - Invalid parameters
Unauthorized - Invalid or missing bearer token