典名词元DMTOKENSHome
API DocumentationThird-Party Tools Tutorial
AI Model APIImageWanxiang

Synchronous Image Generation Call

POST/api/v1/image/generation

Header Parameters

Authorization?string

Use Bearer Token authentication. Format: Authorization: Bearer sk-xxxxxx

Request Body

application/json

model*string

Model name, fixed value: wan2.6-t2i wan2.5-t2i-preview

Value in"wan2.6-t2i" | "wan2.5-t2i-preview"
input*object

Basic input information.

messages*array<object>

Request content array. Currently, only single-turn conversations are supported, which means passing a single set of role and content parameters; multi-turn conversations are not supported.

[]?object
role*string

The role of the message. This parameter must be set to user.

text*string

Positive prompt used to describe the desired content, style, and composition of the generated image. Supports both Chinese and English with a maximum length of 2100 characters, where each Chinese character, letter, number, or symbol counts as one character, and any excess will be automatically truncated. Example value: A sitting orange cat with a cheerful expression, lively and cute, realistic and accurate. Note: Only one text parameter is supported; passing none or multiple will result in an error.

parameters?object

Image processing parameters.

negative_prompt?string

Negative prompt, used to describe unwanted content in the image and constrain the visual output. Supports both Chinese and English, with a maximum length of 500 characters; any excess will be automatically truncated. Example values: low resolution, low quality, deformed limbs, deformed fingers, oversaturated image, waxy appearance, lack of facial details, overly smooth, AI-generated look. Messy composition. Blurry and distorted text.

size?string

The resolution of the output image, in the format of widthheight. The default value is 12801280. The total pixel count must be between [12801280, 14401440] and the aspect ratio must be within [1:4, 4:1]. For example, 7682700 meets the requirements. Example value: 12801280. Recommended resolutions for common aspect ratios: 1:1: 12801280 3:4: 11041472 4:3: 14721104 9:16: 9601696 16:9: 1696*960

n?integer

The number of images to generate. Valid values range from 1 to 4, with a default of 4. Note: Billed per image; it is recommended to set this to 1 for testing.

prompt_extend?boolean

Whether to enable intelligent prompt rewriting. When enabled, a large model is used to optimize positive prompts, significantly improving results for shorter prompts but adding 3-4 seconds of latency. true: Default value, enables intelligent rewriting. false: Disables intelligent rewriting.

watermark?boolean

Whether to add a watermark. The watermark is located in the bottom-right corner of the image, with the fixed text "AI-generated". false: Default value, no watermark is added. true: Add a watermark.

seed?integer

Random seed, value range [0, 2147483647]. Using the same seed parameter value keeps the generated content relatively stable. If not provided, the algorithm will automatically use a random seed. Note: The model generation process is probabilistic, so even with the same seed, identical results cannot be guaranteed for every generation.

Response Body

application/json

Success

TypeScript Definitions

Use the response body type in TypeScript.

code*integer

Status Code

data*object

Data Object

urls*array<string>

Result Set

[]?string
usage*object

Usage Information

images*integer

Image Count

seconds*integer

Video Seconds

input_tokens*integer

Input Token Count

total_tokens*integer

Total Tokens

output_tokens*integer

Output Token Count

expired*string

Validity Period

task_id*string

Task ID

task_status*string

Task Status

message*string

Status Information

request_id*string

Request ID

curl -X POST "https://api.ygw.ai/api/v1/image/generation" \  -H "Content-Type: application/json" \  -d '{    "model": "wan2.6-t2i",    "input": {      "messages": [        {          "role": "string",          "text": "string"        }      ]    }  }'
{
  "code": 0,
  "data": {
    "urls": [
      "string"
    ],
    "usage": {
      "images": 0,
      "seconds": 0,
      "input_tokens": 0,
      "total_tokens": 0,
      "output_tokens": 0
    },
    "expired": "string",
    "task_id": "string",
    "task_status": "string"
  },
  "message": "string",
  "request_id": "string"
}