General instructions for picture interface
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.
Select request format by model
| model | text generation | use reference image or edit |
|---|---|---|
| Seedream Lite / Pro | /v1/images/generations, top-level prompt | Same entry, add image string or array |
| Qwen Image 2.0 Pro / 3.0 | /v1/images/generations | /v1/images/edits |
| WAN2.7 Image Pro | /v1/images/generations | /v1/images/edits; also supports frame selection editing and multi-image reference |
| GPT Image 2.5 / 2.6 Flare / Sunburst | /v1/images/generations (JSON) |
/v1/images/edits (multipart/form-data) |
Qwen / WAN — The latter two categories support the JSON format of input.messages plus parameters, and also support the standard top-level prompt, image, n, and size fields. Just choose one writing method. Do not set the quantity or size repeatedly in two positions. Both entrances require POST and carry the site's Authorization token.
JSON request example
The following is an image editing request, submitted to POST /v1/images/edits:
curl --fail-with-body "$SHANHAI_BASE_URL/v1/images/edits" \
-H "Authorization: Bearer $SHANHAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-image-2.0-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"image": "https://example.com/reference.png"
},
{
"text": "将背景改成柔和的水彩风格,保留主体形状。"
}
]
}
]
},
"parameters": {
"n": 1,
"size": "1024*1024",
"watermark": false
}
}'
Remove the image content block when generating text, keep only text, and use /v1/images/generations. When using multiple images, add multiple image content blocks in sequence, and do not combine multiple addresses into one string.
| Field | Function |
|---|---|
| model | must be the exact name of this site |
| input.messages | A user message, in which content contains text and pictures |
| content[].text | Screen description or modification request |
| content[].image | The address of one picture, multiple images use multiple objects |
| parameters.n | Number of output pictures; range and group picture default values are according to the model page |
| parameters.size | width*height or the range allowed by the model, different models cannot be mixed |
| parameters.watermark | watermark switch |
| response_format | The top level optional url or b64_json, the default is url |
Upload local files
The editing interface of Qwen Image 2.0 Pro, 3.0 and WAN2.7 Image Pro can use multipart/form-data, that is, text and files can be submitted at the same time. curl will generate the correct Content-Type, don't override it manually.
curl --fail-with-body "$SHANHAI_BASE_URL/v1/images/edits" \
-H "Authorization: Bearer $SHANHAI_API_KEY" \
-F "model=qwen-image-2.0-pro" \
-F "prompt=将参考图背景改成水彩风格,保留主体。" \
-F "image=@reference.png" \
-F "n=1" \
-F "size=1024x1024"
Use multiple image[] file fields for multi-image upload:
curl --fail-with-body "$SHANHAI_BASE_URL/v1/images/edits" \
-H "Authorization: Bearer $SHANHAI_API_KEY" \
-F "model=wan2.7-image-pro" \
-F "prompt=保留图1中的杯子,放到图2的桌子上。" \
-F "image[]=@cup.png" \
-F "image[]=@desk.png" \
-F "n=1" \
-F "size=1024x1024"
The upper limit for each file in this form entry on this website is 10 MiB, that is, 10×1024×1024 bytes; please see the details page for the format, size, and size restrictions of the URL input and the model itself. The order of multiple images is consistent with the order of submission. The JSON address method is suitable for scenarios that require complex parameters such as bbox_list, color_palette, etc.
Picture composition, frame selection and color matching
WAN2.7 Image Pro's enable_sequential enables continuous group pictures; n is the maximum number of generated pictures, which may actually be less. bbox_list uses the absolute pixel coordinates of the original image, with up to two boxes per image; color_palette specifies 3 to 10 colors and a total color matching ratio of 100%. These parameters cannot be used directly with Qwen or Seedream. See WAN2.7 Picture Page for a complete example.
Return processing and errors
Read the data array item by item when successful. url is a temporary image address, which should be saved in time; b64_json is an image encoded text, which should be decoded first and then written into a binary file. Do not treat it as an address. The response may contain revised_prompt (the processed prompt word), which is not the image itself.
Check the HTTP status code first, and then read the result. 400 usually needs to correct parameters or pictures, 401/403 check token permissions, 429 should reduce the frequency and try again. Timeout does not prove that the task has not been generated. Check the record first and then resubmit to avoid repeated billing.
model details
gpt-image-2.5-flare-call · gpt-image-2.5-sunburst-call · gpt-image-2.6-flare-call · gpt-image-2.6-sunburst-call
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.