Skip to content

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.

Parameters below are the ones shared across editing models. For the full, model-specific parameter set of the GPT Image family, see GPT Image (Edits).

POST https://llm.siraya.ai/v1/images/edits
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.)
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

{
    "data": [
        {
            "url": "https://resources.siraya.ai/image/generated%2Fsiraya_abc123.png",
            "b64_json": "",
            "revised_prompt": ""
        }
    ],
    "created": 1760177063
}

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 optional mask_url. This is the mode used in the examples above.
  • multipart/form-data — upload the image file(s) and an optional mask file directly. This is compatible with the OpenAI SDK's client.images.edit(image=open(...)).
curl https://llm.siraya.ai/v1/images/edits \
  -H "Authorization: Bearer <API_KEY>" \
  -F "model=gpt-image-2" \
  -F "image=@base_image.png" \
  -F "mask=@mask.png" \
  -F "prompt=Replace the background with a beach at sunset"

Visit the Models Directory to see all supported image-to-image models.