wan2.7-image-pro
Before use, press Access Basics to set
SHANHAI_BASE_URL(this site’s root address) andSHANHAI_API_KEY(this site’s token). The following command is suitable for Bash; the material example address must be replaced with a real address that can be downloaded directly.
Support text-generated pictures, picture-generated pictures and multi-picture reference. Use POST /v1/images/generations for text generation; use POST /v1/images/edits for image editing. Both can use the JSON structures of input.messages and parameters below.
request parameters
| Parameter | Type | Required | Value and behavior |
|---|---|---|---|
model |
The string | is | wan2.7-image-pro. |
input.messages |
array | is | exactly one role: "user" message; multiple rounds of messages are not accepted. |
input.messages[0].content[].text |
The string | is exactly one text command of | ; the text diagram describes the screen, and the diagram describes the modification requirements. |
input.messages[0].content[].image |
String | Required when editing | Public network picture direct link or picture data address with format prefix; up to 9 pictures. Vincent Picture does not upload pictures. |
parameters.n |
Integer | No | Normal mode 1 |
parameters.size |
String | No | 1K , 2K or 宽*高; 4K is only supported by Vincent pictures without input pictures and with group pictures turned off. Photo composition and editing are up to 2K. |
parameters.watermark |
Boolean value | No | Whether to add a visible watermark, the default is false. |
parameters.seed |
Integer | No | 0~2147483647; random when omitted. Identical seeds are not guaranteed to be identical. |
parameters.enable_sequential |
Boolean value | No | Default false; true Generate coherent group diagrams. |
parameters.thinking_mode |
Boolean value | No | Default true; only effective when there is no input picture and the group picture is turned off, add thinking to improve the picture. |
parameters.bbox_list |
Three-layer array | No | Frame selection editing area, corresponding to the input pictures one by one; each picture has a maximum of two [x1,y1,x2,y2] box, fill in [] for pictures that are not to be edited. |
parameters.color_palette |
Object array | No | 3~10 colors, each item contains hex and percentage string ratio, total 100.00%; only available in non-photographic mode. |
Image input and output size
The reference picture can use the public network address or the image data address. For the form writing method for uploading local files, see General Description of Image Interface. When editing multiple pictures, explain the respective uses of "Picture 1" and "Picture 2" in array order. Don't treat web page addresses as image file addresses.
The default size range is 2K. When there is no image input, the gear output is square; when there is an image input, the output is based on the proportion of the last image. When using size gears, the model determines the specific width and height; use 宽*高 when a fixed width and height is required. The minimum total pixels are 768*768, the maximum total pixels are 2048*2048, and can only reach 4096*4096 when meeting the aforementioned 4K conditions, and the aspect ratio does not exceed 8:1 or 1:8.
Enter the prompt word up to 5000 characters. Reference images support JPEG, JPG, PNG (excluding transparent channels), BMP, and WebP; the width and height are 240 to 8000 pixels respectively, the aspect ratio is 1:8 to 8:1, and each image does not exceed 20 MB. Please see the general page for restrictions on files uploaded through this site's form.
Request Example
Text generated image
curl --fail-with-body "$SHANHAI_BASE_URL/v1/images/generations" \
-H "Authorization: Bearer $SHANHAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-image-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"text": "一只红色陶瓷杯,米色背景,柔和摄影棚灯光。"
}
]
}
]
},
"parameters": {
"n": 1,
"size": "1024*1024",
"watermark": false
}
}'
Single picture editing
curl --fail-with-body "$SHANHAI_BASE_URL/v1/images/edits" \
-H "Authorization: Bearer $SHANHAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "wan2.7-image-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"image": "https://example.com/reference.png"
},
{
"text": "保留主体,把背景改成海边日落。"
}
]
}
]
},
"parameters": {
"n": 1,
"size": "1024*1024",
"watermark": false,
"seed": 42
}
}'
Multiple pictures for reference
{
"model": "wan2.7-image-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"image": "https://example.com/person.png"
},
{
"image": "https://example.com/scene.png"
},
{
"text": "保留图1的人物外观,让人物置于图2的场景中。"
}
]
}
]
},
"parameters": {
"n": 1,
"size": "1024*1024"
}
}
Consecutive pictures
{
"model": "wan2.7-image-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"text": "同一只橘猫的春夏秋冬四张照片,角色外观一致。"
}
]
}
]
},
"parameters": {
"enable_sequential": true,
"n": 4,
"size": "2K",
"watermark": false
}
}
Frame selection editing and color matching
bbox_list Use the original image pixel coordinates, with the upper left corner as the origin; do not use scale coordinates from 0 to 1. The following example edits a rectangular area of the first image. Color proportions must be accurate to two decimal places and sum to 100%.
{
"model": "wan2.7-image-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"image": "https://example.com/reference.png"
},
{
"text": "把框选的杯子改成蓝色,其他区域保持不变。"
}
]
}
]
},
"parameters": {
"n": 1,
"bbox_list": [[[100, 100, 400, 500]]],
"color_palette": [
{
"hex": "#1F4E79",
"ratio": "50.00%"
},
{
"hex": "#FFFFFF",
"ratio": "30.00%"
},
{
"hex": "#D9E2F3",
"ratio": "20.00%"
}
],
"size": "2K"
}
}
Return results
Successfully returns the picture result object and reads all pictures in the data array instead of only saving the first one. Each item usually has url; if b64_json is returned, it must be decoded first and then saved. The direct link to the picture has a time limit and should be downloaded in time. The actual number of pictures in the group may be less than n. If the request fails, check the HTTP status code and error.message first, and do not save the error JSON as an image.
encountered a problem
If you encounter problems with calling or configuration, please contact the site customer service and provide the model name, task number, error time and error message. Do not provide the complete token.