{"servers":[{"url":"https://api.modellix.ai/api/v1/kling/kling-4.0-image-edit"}],"post":{"description":"Kling's image-editing model for changing objects, style, or composition using one or more reference images.","operationId":"kling4ImageEditAsync","requestBody":{"content":{"application/json":{"example":{"images":["https://storage.googleapis.com/cloud-samples-data/generative-ai/image/scones.jpg"],"n":1,"prompt":"Keep the scones and composition, and give the image a warm morning light.","resolution":"2k"},"schema":{"additionalProperties":false,"properties":{"aspect_ratio":{"description":"Use `auto` or a supported width-to-height ratio such as `1:1` or `16:9`.","pattern":"^(auto|[1-9][0-9]*:[1-9][0-9]*)$","type":"string"},"images":{"description":"Each image can be a URL string or an object with `image_url`. Use public HTTP(S) URLs without credentials, query strings, or fragments. If you include `reference_type`, use `refer_image`.","items":{"oneOf":[{"format":"uri","type":"string"},{"allOf":[{"additionalProperties":false,"properties":{"id":{"description":"Optional image identifier. Refer to it in `prompt` with `@id`, for example `@id1`.","pattern":"\\S","type":"string"},"image_url":{"description":"Public URL of the reference image.","format":"uri","type":"string"},"reference_type":{"description":"Role of the reference image.","enum":["refer_image","style_refer_image","subject_refer_image"],"type":"string"}},"required":["image_url"],"type":"object"},{"properties":{"reference_type":{"const":"refer_image"}}}]}]},"minItems":1,"type":"array"},"n":{"description":"Number of images to generate.","maximum":9,"minimum":1,"type":"integer"},"prompt":{"description":"Instructions for the edit. Provide non-blank text when you include this field.","pattern":"\\S","type":"string"},"resolution":{"description":"Output resolution.","enum":["2k","4k"],"type":"string"}},"required":["images"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"example":{"code":0,"data":{"get_result":{"method":"GET","url":"https://api.modellix.ai/api/v1/tasks/task-kling-4-0-image-edit-001"},"model_id":"kling/kling-4.0-image-edit","status":"pending","task_id":"task-kling-4-0-image-edit-001"},"message":"success"},"schema":{"properties":{"code":{"description":"Response code, 0 indicates success","example":0,"type":"integer"},"data":{"description":"Detailed data about the submitted asynchronous task.","properties":{"get_result":{"description":"API information to query the task result","properties":{"method":{"description":"HTTP method","example":"GET","type":"string"},"url":{"description":"Full URL to query the task result","example":"https://api.modellix.ai/api/v1/tasks/task-abc123","type":"string"}},"type":"object"},"model_id":{"description":"Model ID","example":"model-123","type":"string"},"status":{"description":"Task status","enum":["pending","processing"],"example":"pending","type":"string"},"task_id":{"description":"Unique task identifier","example":"task-abc123","type":"string"}},"required":["status","task_id","model_id"],"type":"object"},"message":{"description":"Response message","example":"success","type":"string"}},"required":["code","message","data"],"type":"object"}}},"description":"Task submitted successfully"},"400":{"content":{"application/json":{"example":{"code":400,"message":"Invalid parameters: parameter 'image' is required"},"schema":{"properties":{"code":{"description":"Error code (equals HTTP status code)","example":400,"type":"integer"},"message":{"description":"Error message in format 'Category: detail'","example":"Invalid parameters: parameter 'image' is required","type":"string"}},"required":["code","message"],"type":"object"}}},"description":"Invalid request parameters"},"401":{"content":{"application/json":{"example":{"code":401,"message":"Authentication failed: invalid API key"},"schema":{"properties":{"code":{"description":"Error code (equals HTTP status code)","example":400,"type":"integer"},"message":{"description":"Error message in format 'Category: detail'","example":"Invalid parameters: parameter 'image' is required","type":"string"}},"required":["code","message"],"type":"object"}}},"description":"Unauthorized - Invalid or missing API Key"},"429":{"content":{"application/json":{"example":{"code":429,"message":"Rate limit exceeded: 100 requests per minute, retry after 60 seconds"},"schema":{"properties":{"code":{"description":"Error code (equals HTTP status code)","example":400,"type":"integer"},"message":{"description":"Error message in format 'Category: detail'","example":"Invalid parameters: parameter 'image' is required","type":"string"}},"required":["code","message"],"type":"object"}}},"description":"Too many requests - Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests per minute","schema":{"example":100,"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining quota in current window","schema":{"example":0,"type":"integer"}},"X-RateLimit-Reset":{"description":"Rate limit window reset time (Unix timestamp)","schema":{"example":1704067260,"type":"integer"}}}},"500":{"content":{"application/json":{"example":{"code":500,"message":"Internal server error"},"schema":{"properties":{"code":{"description":"Error code (equals HTTP status code)","example":400,"type":"integer"},"message":{"description":"Error message in format 'Category: detail'","example":"Invalid parameters: parameter 'image' is required","type":"string"}},"required":["code","message"],"type":"object"}}},"description":"Internal server error"}},"summary":"Kling 4.0 Image Edit","x-mint":{"content":"Poll the returned task URL to retrieve the images. See [Query Task Result](https://docs.modellix.ai/api/get-task-result).","href":"kling/kling-4-0-image-edit"}}}