Expand image
Endpoint: POST https://4zapi.com/kling/v1/images/editing/expand
Parameters
Content-Type(header, string): Request body Content-Type, usually application/jsonAuthorization(header, string): Bearer API Key
Request body (application/json)
down_expansion_ratio(number, required): Expand downward; multiplier of original height range: [0,2], new image area must not exceed 3× original e.g. if original height is20, and this parameter is0.2, then: distance from original bottom to new bottom =20 x 0.2 = 4, that region is the expansion areaimage(string, required): Reference image accepts image Base64 or a reachable image URLleft_expansion_ratio(number, required): Expand left; multiplier of original width range: [0,2], new image area must not exceed 3× original e.g. if original width is30, and this parameter is0.3, then: distance from original left to new left =30 x 0.3 = 9, that region is the expansion arean(integer, required): Number of images to generate range: [1,9]right_expansion_ratio(number, required): Expand right; multiplier of original width range: [0,2], new image area must not exceed 3× original e.g. if original width is30, and this parameter is0.4, then: distance from original right to new right =30 x 0.4 = 12, that region is the expansion areaup_expansion_ratio(number, required): Expand upward; multiplier of original height range: [0,2], new image area must not exceed 3× original e.g. if original height is20, and this parameter is0.1, then: distance from original top to new top =20 x 0.1 = 2, that region is the expansion areacallback_url(string): Callback URL invoked on task completionexternal_task_id(string): Custom external task ID for business-side correlationprompt(string): Positive text prompt max 2500 characters
Request example
{
"callback_url": "",
"down_expansion_ratio": 0.1,
"external_task_id": "",
"image": "https://h2.inkwai.com/bs2/upload-ylab-stunt/se/ai_portal_queue_mmu_image_upscale_aiweb/3214b798-e1b4-4b00-b7af-72b5b0417420_raw_image_0.jpg",
"left_expansion_ratio": 0.1,
"n": 1,
"prompt": "聚焦中心",
"right_expansion_ratio": 0.1,
"up_expansion_ratio": 0.1
}