Skip to content

Image to Image (Edits)

Siraya AI 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.

API Specification

To edit images, send a POST request to our image edits endpoint.

Example: Image Transformation

curl https://image.siraya.pro/v1/images/edits \
  -H "Content-Type: application/json" \
  -H "Authorization: <API_KEY>" \
  --data-raw '{
    "model": "dreamomni2-image-to-image",
    "prompt": "Replace the first image have the same image style as the second image.",
    "image_urls": [
        "https://resource.siraya.pro/image/example1.png",
        "https://resource.siraya.pro/image/example2.png"
    ],
    "n": 1,
    "output_format": "url"
}'
from openai import OpenAI

client = OpenAI(
    api_key="<API_KEY>",
    base_url="https://image.siraya.pro/v1"
)

result = client.images.edit(
    model="dreamomni2-image-to-image",
    image=open("base_image.png", "rb"), # Note: Some models use image_urls in extra_body
    prompt="Apply the style of the reference image.",
    extra_body={
        "image_urls": [
            "https://resource.siraya.pro/image/example1.png",
            "https://resource.siraya.pro/image/example2.png"
        ],
        "output_format": "url"
    }
)

print(result.data[0].url)

Request Parameters

Parameter Type Default Description
model string - The ID of the image editing model (e.g., dreamomni2-image-to-image).
prompt string - Instructions for the edit or transformation.
image_urls array - A list of URLs for input images for editing/reference.
n integer 1 The number of images to generate.
output_format string url The format of the output (url or b64_json).

Example Response

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

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