Edit Image
edit_imageApply prompt-based edits to a local image, with optional mask and background settings. Upload the image file and receive edited versions saved to disk.
Instructions
Edit a local image via POST /v1/images/edits (multipart: image, mask?, prompt, model, n?, size?, background?). background=transparent is rejected (use generate_image instead).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | How many edited images to produce (integer >= 1). Defaults to 1. Capped by KENARI_MAX_IMAGE_N (default 4). Each image costs IDR. | |
| size | No | Output image dimensions, e.g. '1024x1024'. Optional and model-dependent. | |
| model | Yes | Kenari image model id, e.g. 'gpt-image-2'. Call list_media_models first for exact ids and per-image IDR costs. | |
| prompt | Yes | What to change in the image. Be specific about the edit. | |
| mask_path | No | Optional absolute path to a mask image (multipart 'mask'). Transparent areas of the mask mark where to edit. | |
| background | No | Background handling for the edited result: 'opaque' or 'auto' only. 'transparent' is rejected here — use generate_image instead. | |
| image_path | Yes | Absolute path to the local image file to edit (uploaded as multipart 'image'). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Kenari video job id, when relevant to the result or error. | |
| op | No | Tool operation name the error occurred in. | |
| code | No | Machine-readable code: an error code (e.g. unauthorized, bad_request, upstream_error) or a state marker (e.g. rendering, done, still_rendering). | |
| hint | No | Human-readable remediation hint (e.g. set KENARI_API_KEY). | |
| count | No | Number of images saved. | |
| model | No | Kenari image model id used. | |
| paths | No | Absolute local paths of the saved image files under KENARI_OUTPUT_DIR. | |
| status | No | HTTP status number (on API errors) or the Kenari job status string (on video status results). | |
| disabled | No | True when video tools are disabled via KENARI_ALLOW_VIDEO=0. |