Stable Diffusion 3 Medium Image to Image Serverless API
Stable Diffusion 3 Medium image-to-image is a cutting-edge AI tool that uses advanced image-to-image technology to transform one image into another.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/sd3-med-img2img"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "photo of a boy holding phone on table,3d pixar style",
12 "negative_prompt": "low quality,less details",
13 "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/sd3-img2img-ip.jpg",
14 "num_inference_steps": 20,
15 "guidance_scale": 5,
16 "seed": 698845,
17 "samples": 1,
18 "strength": 0.7,
19 "sampler": "dpmpp_2m",
20 "scheduler": "sgm_uniform",
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/sd3-med-img2img"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "photo of a boy holding phone on table,3d pixar style",
12 "negative_prompt": "low quality,less details",
13 "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/sd3-img2img-ip.jpg",
14 "num_inference_steps": 20,
15 "guidance_scale": 5,
16 "seed": 698845,
17 "samples": 1,
18 "strength": 0.7,
19 "sampler": "dpmpp_2m",
20 "scheduler": "sgm_uniform",
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/sd3-med-img2imgParameters
imagerequiredstring (uri)Input image
"https://segmind-sd-models.s3.amazonaws.com/display_images/sd3-img2img-ip.jpg"promptrequiredstringText prompt for image generation
"photo of a boy holding phone on table,3d pixar style"base64optionalbooleanBase64 encoding of the output image
falseguidance_scaleoptionalnumberGuidance scale for image generation
5Range: 1 - 20negative_promptoptionalstringNegative text prompt to avoid certain qualities
"low quality,less details"num_inference_stepsoptionalintegerNumber of inference steps for image generation
20Range: 1 - 100sampleroptionalstringSampler for the image generation process
"dpmpp_2m""euler""euler_pp""euler_ancestral""euler_ancestral_pp""heun""heunpp2""dpm_2""dpm_2_ancestral""lms""dpm_fast"+17 moresamplesoptionalintegerNumber of samples to generate
1scheduleroptionalstringScheduler for the image generation process
"sgm_uniform""normal""karras""exponential""sgm_uniform""simple""ddim_uniform"seedoptionalintegerSeed for random number generation
698845strengthoptionalnumberStrength of the image transformation
0.7Range: 0 - 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