Edit an image
edit_imageModify an existing image or create a new one from reference images with a Kunavo image-edit model, returning a result URL or task ID for tracking.
Instructions
Change an existing image, or make a new one from reference images, with a Kunavo image-edit model (endpoint image_edit in list_models). Spends the balance: one image is charged. What was charged is what get_usage reports. Returns the result's URL when it is ready within wait_seconds, otherwise a task id to follow with get_task. Sending it twice makes and charges two images, unless the second call carries the first one's idempotency_key.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"model": "<model>",
"prompt": "<prompt>",
"images": "<images>"
},
"name": "edit_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mask | No | Optional mask: an image of the source's dimensions that marks the part to change. Needs a model with the inpainting capability, and such a model may refuse an edit that brings none. An https:// URL, or the path of a local PNG, JPEG, WebP or GIF file (25 MB at most), which is uploaded for you. | |
| size | No | Shape of the image: a size such as "1536x1024" or a ratio such as "16:9", which the API turns into a shape the model takes; square when left out. An edit model that keeps its source's shape does not read it. | |
| model | Yes | A model id from list_models with endpoint image_edit. | |
| images | Yes | The source image first, then any further reference images. More than one needs a model with the multi-image-input capability, and no more than its max_input_images in list_models. Each: An https:// URL, or the path of a local PNG, JPEG, WebP or GIF file (25 MB at most), which is uploaded for you. | |
| prompt | Yes | What to change, or what to make from the images. | |
| resolution | No | Resolution tier on a model priced by resolution: one of the ids list_models gives under `tiers`, e.g. "2K". It sets the price. A resolution for a model priced by render speed is refused before anything is sent, and a value that is none of the model's tiers by the API, with a 400 that lists them; neither is charged. | |
| wait_seconds | No | How long to wait for the result before returning, in seconds (0 to 45, default 40). An unfinished task is returned with its id. | |
| idempotency_key | No | Any string of your own, 128 characters at most. Calling again with the same one and the same arguments returns the task that call started instead of starting, and charging, another. A key stands for one request for as long as the API keeps its task: the API refuses it for a request on another tool, for another model or with other arguments, so use a new one for each new request. When left out, one is made and given back in the answer. | |
| rendering_speed | No | Render-speed tier on a model priced by it: one of the ids list_models gives under `tiers`, e.g. "TURBO". It sets the price, like resolution. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Task id: img_… (image), vid_… (video) or msc_… (music). | |
| kind | Yes | ||
| urls | Yes | Result files once completed: the images, the video, or the audio of each track. | |
| error | Yes | ||
| model | Yes | ||
| status | Yes | queued, in_progress, completed or failed. Anything else is a task that is not finished. | |
| tracks | No | Music only: one entry for each track. | |
| stalled | Yes | true when the task has gone longer than expected without finishing. | |
| archived | Yes | true: every URL in `urls` is Kunavo's own copy and does not expire. false: a file could not be archived and its URL is the model provider's temporary one. null until completed. | |
| next_step | Yes | What to do with this result. | |
| created_at | Yes | ||
| resolution | No | Video only. | |
| completed_at | Yes | ||
| pollable_until | Yes | The task can be read with get_task at least until then. | |
| idempotency_key | No | The key this task was started under, in the answer of the tool that started it (get_task does not know it). Calling that tool again with it and the same arguments returns this task. | |
| duration_seconds | No | Video only. |