Stable Diffusion 3 Medium Image to Image

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.

~7.43s
~$0.008
 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

POSThttps://api.segmind.com/v1/sd3-med-img2img

Parameters

imagerequired
string (uri)

Input image

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/sd3-img2img-ip.jpg"
promptrequired
string

Text prompt for image generation

Default: "photo of a boy holding phone on table,3d pixar style"
base64optional
boolean

Base64 encoding of the output image

Default: false
guidance_scaleoptional
number

Guidance scale for image generation

Default: 5Range: 1 - 20
negative_promptoptional
string

Negative text prompt to avoid certain qualities

Default: "low quality,less details"
num_inference_stepsoptional
integer

Number of inference steps for image generation

Default: 20Range: 1 - 100
sampleroptional
string

Sampler for the image generation process

Default: "dpmpp_2m"
Allowed values (27 total):
"euler""euler_pp""euler_ancestral""euler_ancestral_pp""heun""heunpp2""dpm_2""dpm_2_ancestral""lms""dpm_fast"+17 more
samplesoptional
integer

Number of samples to generate

Default: 1
scheduleroptional
string

Scheduler for the image generation process

Default: "sgm_uniform"
Allowed values :
"normal""karras""exponential""sgm_uniform""simple""ddim_uniform"
seedoptional
integer

Seed for random number generation

Default: 698845
strengthoptional
number

Strength of the image transformation

Default: 0.7Range: 0 - 1

Response Type

Returns: Image

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out