Switchx Image To Image
Model id: beeble/switchx-image-to-image. SwitchX is an image-to-image compositing model by Beeble that replaces a scene element while preserving the original subject, with automatic subject detection
Model Overview
SwitchX is an image-to-image compositing model by Beeble that replaces a scene element while preserving the original subject, with automatic subject detection and seamless relighting to match a reference image. Does not support tools/function calling.
Setup your API Key
If you don’t have an API key for the AI/ML API yet, feel free to use our Quickstart guide.
API Schema
URL of the source image to recomposite. Allowed formats: JPEG, PNG, WEBP. Source must not exceed 2,770,000 total pixels.
URL of the alpha mask. Required when alpha_mode is "custom" or "select"; ignored for "auto" and "fill". A mask video for video-to-video, a mask image for image-to-image.
URL of the reference image defining the target look and lighting for the replaced region. Allowed formats: JPEG, PNG, WEBP. At least one of reference_image_url or prompt must be provided.
Subject masking strategy: "auto" (AI auto-detects the subject), "fill" (no masking), "select" (propagate a mask from one keyframe), or "custom" (frame-by-frame mask supplied via alpha_url). Defaults to "auto".
autoPossible values: Maximum output resolution (longer side) in pixels: 720 or 1080. Defaults to 1080. 1080 costs more than 720.
1080Possible values: Frame index (0-based) whose mask is propagated when alpha_mode is "select" on a video. Defaults to the first frame. Ignored for image generation and for the auto, fill, and custom modes.
Random seed (0–4294967295) for reproducibility. Omit for a random seed. The seed used is always returned in the response.
Text description of the desired output to guide the generation (max 2000 characters). At least one of prompt or reference_image_url must be provided.
Successful response.
curl --request POST \
--url 'https://api.aimlapi.com/v1/images/generations' \
--header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \
--header 'Content-Type: application/json' \
--data '{"model": "beeble/switchx-image-to-image", "image_url": "https://example.com/input.jpg", "prompt": "Describe what you want the model to generate."}'Successful response.
{
"data": [
{
"url": "https://cdn.aimlapi.com/generations/hedgehog/1749730923700-29fe35d2-4aef-4bc5-a911-6c39884d16a8.png",
"b64_json": null
}
],
"meta": {
"usage": {
"credits_used": 120000,
"usd_spent": 0.06
}
}
}Quick Example
Let's generate a new image using the one from the flux/dev Quick Example as a reference — and make a simple change to it with a prompt.


Example #2: Combine two images
This time, we’ll pass two images to the model: our dinosaur and a solid blue mug. We'll ask the model to place the dinosaur onto the mug as a print.

"Place this image with the t-rex on this mug from the second image as a print. Make it look fit and natural."Last updated
Was this helpful?




