Synchronous Image Generation Call
/api/v1/image/generationHeader Parameters
Use Bearer Token authentication. Format: Authorization: Bearer sk-xxxxxx
Request Body
application/json
Model name. Must be: z-image-turbo.
"z-image-turbo"Basic input information.
Request content array. Currently, only single-turn conversations are supported, i.e., passing a single set of role and content parameters; multi-turn conversations are not supported.
The role of the message. This parameter must be set to user.
Message content array. Must contain exactly one text object.
Positive prompts are used to describe the desired content, style, and composition of the generated image. Both Chinese and English are supported, with a maximum length of 800 characters; 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.
Image processing parameters.
Resolution of the output image, in the format of widthheight. Default value: 10241536. Total pixel limit: total pixels must be within [512512, 20482048]. Recommended resolution range: total pixels within [10241024, 15361536] for better image quality. Example value: 10241536. Recommended resolutions for 10241024 total pixels: 1:1: 10241024 2:3: 8321248 3:2: 1248832 3:4: 8641152 4:3: 1152864 7:9: 8961152 9:7: 1152896 9:16: 7201280 9:21: 5761344 16:9: 1280720 21:9: 1344576 Recommended resolutions for 12801280 total pixels: 1:1: 12801280 2:3: 10241536 3:2: 15361024 3:4: 11041472 4:3: 14721104 7:9: 11201440 9:7: 14401120 9:16: 8641536 9:21: 7201680 16:9: 1536864 21:9: 1680720 Recommended resolutions for 15361536 total pixels: 1:1: 15361536 2:3: 12481872 3:2: 18721248 3:4: 12961728 4:3: 17281296 7:9: 13441728 9:7: 17281344 9:16: 11522048 9:21: 8642016 16:9: 20481152 21:9: 2016*864
Whether to enable intelligent prompt (text) rewriting. When enabled, a large model will be used to optimize the prompt and output the thinking process. false: Default value, disables intelligent rewriting. Outputs the image and the original text prompt. true: Enables intelligent rewriting. Outputs the image, the optimized text prompt, and the thinking process.
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 each generation.
Response Body
application/json
Success
TypeScript Definitions
Use the response body type in TypeScript.
Status Code
Data Object
Result Set
Usage Information
Number of Images
Video Seconds
Input Token Count
Total Tokens
Output token count
Validity Period
Task ID
Task Status
Status Information
Request ID
curl -X POST "https://api.ygw.ai/api/v1/image/generation" \ -H "Content-Type: application/json" \ -d '{ "model": "z-image-turbo", "input": { "messages": [ { "role": "string", "content": [ { "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"
}