Kokon
v0.13.0Generate and edit images offline with Qwen-Image 2.1 on your GPU.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
generate_image Generate image
Generate an image from a text prompt with the local Qwen-Image 2.1 model, optionally using reference images (a person, a product, a style) in a new scene. Write the full, detailed prompt yourself (see the prompt field): it is used as is. Dimensions are chosen automatically (aspect ratio can be inferred from the prompt, e.g. '16:9 hero image') unless width/height or aspect_ratio are given. Returns the absolute path of the saved PNG. Runs fully offline; typically 45 s–4 min.
| Parameter | Type | Description |
|---|---|---|
prompt * | string | The final prompt, written by you in English and used as is (Kokon does not rewrite it): one paragraph of about 60-200 words describing the finished image: medium and style first, the subject and what… |
aspect_ratio | string | Aspect ratio such as 1:1, 4:3, 3:4, 16:9, 9:16, or auto (inferred from the prompt) |
height | integer | Output height in pixels (needs width too). |
include_preview | boolean | Also return a small JPEG preview in the tool result. Default false: images stay local and are not sent to the model. |
output_path | string | Optional destination (absolute, or relative to the project). Must be inside the project or the app output folder. Existing files are never overwritten; a numbered name is used instead. |
quality | string | All run Qwen-Image 2.1 Turbo (8 steps): fast = ~1 MP (the default, fastest); balanced = ~1.5K; quality = native 2K (slowest; edits share 2K with their references) |
reference_images | array | Optional images the new image uses (a person, a product, a place, a style), in order; refer to them as image 1, image 2, ... in the prompt. The output is sized like any new image, not like the referen… |
seed | integer | Seed for reproducible results; omit or -1 for random |
width | integer | Output width in pixels (needs height too). Omit to choose automatically. |
edit_image Edit image
Edit an existing image with a natural-language instruction (e.g. 'make the background nighttime, keep the foreground unchanged'). Preserves the input's width, height and aspect ratio by default. The input file is never overwritten.
| Parameter | Type | Description |
|---|---|---|
image_path * | string | Image to edit (absolute, or relative to the project) |
prompt * | string | The edit instruction, written by you in English and used as is (Kokon does not rewrite it): start with the operation (Change, Replace, Remove, Add, Turn...), say exactly what changes, where, and what… |
include_preview | boolean | Also return a small JPEG preview in the tool result. Default false: images stay local and are not sent to the model. |
output_path | string | Optional destination (absolute, or relative to the project). Must be inside the project or the app output folder. Existing files are never overwritten; a numbered name is used instead. |
preserve_dimensions | boolean | Keep the input's exact width/height (default true) |
quality | string | All run Qwen-Image 2.1 Turbo (8 steps): fast = ~1 MP (the default, fastest); balanced = ~1.5K; quality = native 2K (slowest; edits share 2K with their references) |
seed | integer | Seed for reproducible results; omit or -1 for random. Never reuse the seed the source image was generated with: use a different one or omit it |
edit_images Edit with multiple references
Edit image 1 with the help of other images (up to 10 in all) and an instruction, e.g. put the product from image 2 in the hand of the person in image 1. Order matters: refer to them as image 1, image 2, ... in the prompt. The output follows image 1's aspect ratio unless width/height or aspect_ratio are given. For a new scene that only uses the images as references, use generate_image with reference_images.
| Parameter | Type | Description |
|---|---|---|
image_paths * | array | Reference images in order; refer to them as image 1, image 2, ... in the prompt |
prompt * | string | The edit instruction, written by you in English and used as is (Kokon does not rewrite it): image 1 is the image being changed; start with Place or Combine, say what is taken from each image (image 2,… |
aspect_ratio | string | Aspect ratio such as 1:1, 4:3, 3:4, 16:9, 9:16, or auto (inferred from the prompt) |
height | integer | |
include_preview | boolean | Also return a small JPEG preview in the tool result. Default false: images stay local and are not sent to the model. |
output_path | string | Optional destination (absolute, or relative to the project). Must be inside the project or the app output folder. Existing files are never overwritten; a numbered name is used instead. |
quality | string | All run Qwen-Image 2.1 Turbo (8 steps): fast = ~1 MP (the default, fastest); balanced = ~1.5K; quality = native 2K (slowest; edits share 2K with their references) |
seed | integer | Seed for reproducible results; omit or -1 for random. Never reuse the seed the source image was generated with: use a different one or omit it |
width | integer |
outpaint_image Expand image (outpaint)
Extend an image beyond its borders. Give the expansion per side in pixels or percent; the canvas, mask and model-aligned sizes are built automatically and the original pixels are preserved exactly.
| Parameter | Type | Description |
|---|---|---|
image_path * | string | |
prompt * | string | What the extended area should contain |
bottom | number | |
include_preview | boolean | Also return a small JPEG preview in the tool result. Default false: images stay local and are not sent to the model. |
left | number | |
output_path | string | Optional destination (absolute, or relative to the project). Must be inside the project or the app output folder. Existing files are never overwritten; a numbered name is used instead. |
quality | string | All run Qwen-Image 2.1 Turbo (8 steps): fast = ~1 MP (the default, fastest); balanced = ~1.5K; quality = native 2K (slowest; edits share 2K with their references) |
right | number | |
seed | integer | Seed for reproducible results; omit or -1 for random. Never reuse the seed the source image was generated with: use a different one or omit it |
top | number | |
units | string | Units for left/right/top/bottom; percent is relative to the image width (left/right) or height (top/bottom) |
inpaint_image Inpaint image
Change only the masked area of an image (mask: white = change, black = keep): edit it, remove what is there, replace it, or add something inside it. The model is shown the area marked on a copy of the image; pixels outside the mask are preserved exactly.
| Parameter | Type | Description |
|---|---|---|
image_path * | string | |
mask_path * | string | Mask image: white = area to change, black = keep (or opaque strokes on a transparent layer) |
action | string | edit: change the area as the prompt says; remove: erase what is there and fill with background (prompt optional, e.g. 'the bin'); replace: put the prompt's subject in its place; add: add the prompt's… |
include_preview | boolean | Also return a small JPEG preview in the tool result. Default false: images stay local and are not sent to the model. |
output_path | string | Optional destination (absolute, or relative to the project). Must be inside the project or the app output folder. Existing files are never overwritten; a numbered name is used instead. |
prompt | string | The change, or the subject to add/replace with; optional for remove |
quality | string | All run Qwen-Image 2.1 Turbo (8 steps): fast = ~1 MP (the default, fastest); balanced = ~1.5K; quality = native 2K (slowest; edits share 2K with their references) |
seed | integer | Seed for reproducible results; omit or -1 for random. Never reuse the seed the source image was generated with: use a different one or omit it |
upscale_image Upscale image
Enlarge an image (default 2x, or to a width/height up to 8192 px). Runs the upscaler model chosen in Kokon (Superscale-SP by default; seconds on a PC GPU, longer on a Mac; adds no new content). Saves a new file; the input is never overwritten.
| Parameter | Type | Description |
|---|---|---|
image_path * | string | Image to upscale (absolute, or relative to the project) |
height | integer | Target height in pixels; width follows the aspect ratio unless also given |
include_preview | boolean | Also return a small JPEG preview in the tool result. Default false: images stay local and are not sent to the model. |
output_path | string | Optional destination (absolute, or relative to the project). Must be inside the project or the app output folder. Existing files are never overwritten; a numbered name is used instead. |
scale | number | Enlargement factor, e.g. 2 (default 2 when no width/height is given) |
width | integer | Target width in pixels; height follows the aspect ratio unless also given |
get_image_info Image info
Width, height, aspect ratio, file type and, for images made by Kokon, the generation metadata (prompt, seed, model, steps...).
| Parameter | Type | Description |
|---|---|---|
image_path * | string |
get_generator_status Generator status
Whether the local inference server is running and the model loaded, GPU and VRAM, the active job and the queue.