SDXL Img2Img
SDXL Img2Img is used for text-guided image-to-image translation. This model uses the weights from Stable Diffusion to generate new images from an input image using StableDiffusionImg2ImgPipeline from diffusers
1import requests
2import json
3
4url = "https://api.segmind.com/v1/sdxl-img2img"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/sdxl-img2img-ip.jpg",
12 "samples": 1,
13 "prompt": "photorealistic, high-quality, ultra-detailed, image of (an origami bird with a layer that makes each folded polygonal section of the origami a different vivid c olor, an origami rainbow of color in a forest of origami plants and trees in the background), best quality, masterpiece, masterful composition, award, extremely detailed, incredibly high resolution, 32k, 16k, 8k, 4k, UHD, HDR, hyperrealistic, photo studio quality, amazing clarity, tack sharp, sharp focus, volumetric lighting, cinematic style",
14 "negative_prompt": "nude, disfigured, blurry",
15 "scheduler": "UniPC",
16 "base_model": "juggernaut",
17 "num_inference_steps": 30,
18 "guidance_scale": 6.5,
19 "strength": 0.65,
20 "seed": 98877465625,
21 "base64": false
22}
23
24response = requests.post(url, headers=headers, json=data)
25
26if response.status_code == 200:
27 result = response.json()
28 print(json.dumps(result, indent=2))
29else:
30 print(f"Error: {response.status_code}")
31 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/sdxl-img2img"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/sdxl-img2img-ip.jpg",
12 "samples": 1,
13 "prompt": "photorealistic, high-quality, ultra-detailed, image of (an origami bird with a layer that makes each folded polygonal section of the origami a different vivid c olor, an origami rainbow of color in a forest of origami plants and trees in the background), best quality, masterpiece, masterful composition, award, extremely detailed, incredibly high resolution, 32k, 16k, 8k, 4k, UHD, HDR, hyperrealistic, photo studio quality, amazing clarity, tack sharp, sharp focus, volumetric lighting, cinematic style",
14 "negative_prompt": "nude, disfigured, blurry",
15 "scheduler": "UniPC",
16 "base_model": "juggernaut",
17 "num_inference_steps": 30,
18 "guidance_scale": 6.5,
19 "strength": 0.65,
20 "seed": 98877465625,
21 "base64": false
22}
23
24response = requests.post(url, headers=headers, json=data)
25
26if response.status_code == 200:
27 result = response.json()
28 print(json.dumps(result, indent=2))
29else:
30 print(f"Error: {response.status_code}")
31 print(response.text)API Endpoint
https://api.segmind.com/v1/sdxl-img2imgParameters
imagerequiredstring (uri)Input Image.
promptrequiredstringPrompt to render
base_modeloptionalstringbase model for image generation
"juggernaut""juggernaut""realvis""protovision""yamers_realistic"base64optionalbooleanBase64 encoding of the output image.
falseguidance_scaleoptionalnumberScale for classifier-free guidance
6.5Range: 0.1 - 25negative_promptoptionalstringPrompts to exclude, eg. 'bad anatomy, bad hands, missing fingers'
num_inference_stepsoptionalintegerNumber of denoising steps.
30Range: 20 - 100samplesoptionalintegerNumber of samples to generate.
1Range: 1 - 4scheduleroptionalstringType of scheduler.
"UniPC""DPM++ SDE Karras""DPM++ 2M Karras""DPM++ 2M SDE Karras""DPM++ 2M SDE Heun Karras""DPM++ 3M SDE Karras""LMS Karras""DPM2 Karras""DPM2 a Karras""DPM++ 2S a Karras""DPM++ 2M SDE Exponential"+19 moreseedoptionalintegerSeed for image generation.
-1strengthoptionalnumberHow much to transform the reference image
0.65Range: 0.1 - 1Response Type
Returns: Image
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out