Image to Image (Edits)
SIRAYA Model Router provides a unified API for image editing and transformation. This interface allows you to modify existing images or combine multiple images using natural language prompts.
POST
https://llm.siraya.ai/v1/images/edits
Header
Authorization
string
Required
Your API Key (e.g.,
Bearer <API_KEY>).
Body
model
string
Required
The ID of the image editing model (e.g.,
dreamomni2-image-to-image).
prompt
string
Required
Instructions for the edit or transformation.
image_urls
array
Required
JSON mode: a list of input image URLs or base64 data URLs for editing or reference. (In multipart mode, send the
image file field instead — see Input Modes.)
mask_url
string
JSON mode: a mask URL or base64 data URL marking the region to edit. (In multipart mode, send the
mask file field instead.)
input_fidelity
string
high or low — how closely the edit preserves the input image (gpt-image-1).
n
integer
Default: 1
The number of images to generate.
output_format
string
Default: url
The format of the output (
url or b64_json).
curl https://llm.siraya.ai/v1/images/edits \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
--data-raw '{
"model": "dreamomni2-image-to-image",
"prompt": "Replace the first image with the same style as the second image.",
"image_urls": [
"https://resources.siraya.ai/image/example1.png",
"https://resources.siraya.ai/image/example2.png"
],
"n": 1,
"output_format": "url"
}'
from openai import OpenAI
client = OpenAI(
api_key="<API_KEY>",
base_url="https://llm.siraya.ai/v1"
)
result = client.images.edit(
model="dreamomni2-image-to-image",
image=open("base_image.png", "rb"),
prompt="Apply the style of the reference image.",
extra_body={
"image_urls": [
"https://resources.siraya.ai/image/example1.png",
"https://resources.siraya.ai/image/example2.png"
],
"output_format": "url"
}
)
print(result.data[0].url)
Example Response
Input Modes
The edits endpoint accepts input images in two modes:
- JSON — pass image references as
image_urls(an array of URLs or base64 data URLs) and an optionalmask_url. This is the mode used in the examples above. - multipart/form-data — upload the
imagefile(s) and an optionalmaskfile directly. This is compatible with the OpenAI SDK'sclient.images.edit(image=open(...)).
curl https://llm.siraya.ai/v1/images/edits \
-H "Authorization: Bearer <API_KEY>" \
-F "model=gpt-image-1" \
-F "image=@base_image.png" \
-F "mask=@mask.png" \
-F "prompt=Replace the background with a beach at sunset" \
-F "input_fidelity=high"
Visit the Models Directory to see all supported image-to-image models.