Stable Diffusion 3.5 Turbo Text to Image
Stable Diffusion 3.5 Turbo offers exceptional customizability, efficient performance on consumer hardware, and diverse image outputs that accurately represent different skin tones and features, all while maintaining high-quality results and strong prompt adherence.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/stable-diffusion-3.5-turbo-txt2img"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "A panda in a glowing tech-infused jacket, standing in front of a bustling cyberpunk market, his T-shirt displaying 'Segmind'. Neon lights illuminate his face, with a futuristic cityscape behind him. Reflections shimmer on the wet pavement.",
12 "negative_prompt": "low quality, blurry",
13 "steps": 4,
14 "guidance_scale": 1,
15 "seed": 98552302,
16 "sampler": "dpmpp_2m",
17 "scheduler": "sgm_uniform",
18 "width": 1024,
19 "height": 1024,
20 "aspect_ratio": "custom",
21 "batch_size": 1,
22 "image_format": "jpeg",
23 "image_quality": 95,
24 "base64": false
25}
26
27response = requests.post(url, headers=headers, json=data)
28
29if response.status_code == 200:
30 result = response.json()
31 print(json.dumps(result, indent=2))
32else:
33 print(f"Error: {response.status_code}")
34 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/stable-diffusion-3.5-turbo-txt2img"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "A panda in a glowing tech-infused jacket, standing in front of a bustling cyberpunk market, his T-shirt displaying 'Segmind'. Neon lights illuminate his face, with a futuristic cityscape behind him. Reflections shimmer on the wet pavement.",
12 "negative_prompt": "low quality, blurry",
13 "steps": 4,
14 "guidance_scale": 1,
15 "seed": 98552302,
16 "sampler": "dpmpp_2m",
17 "scheduler": "sgm_uniform",
18 "width": 1024,
19 "height": 1024,
20 "aspect_ratio": "custom",
21 "batch_size": 1,
22 "image_format": "jpeg",
23 "image_quality": 95,
24 "base64": false
25}
26
27response = requests.post(url, headers=headers, json=data)
28
29if response.status_code == 200:
30 result = response.json()
31 print(json.dumps(result, indent=2))
32else:
33 print(f"Error: {response.status_code}")
34 print(response.text)API Endpoint
https://api.segmind.com/v1/stable-diffusion-3.5-turbo-txt2imgParameters
promptrequiredstringPrompt for image generation
"A panda in a glowing tech-infused jacket, standing in front of a bustling cyberpunk market, his T-shirt displaying 'Segmind'. Neon lights illuminate his face, with a futuristic cityscape behind him. Reflections shimmer on the wet pavement."samplerrequiredstringSampling method for image generation
"dpmpp_2m""euler""euler_cfg_pp""euler_ancestra""leuler_ancestral_cfg_pp""heun""heunpp2""dpm_2""dpm_2_ancestral""lms""dpm_fast"+16 moreschedulerrequiredstringScheduler for image generation
"sgm_uniform""normal""karras""exponential""sgm_uniform""simple""ddim_uniform""beta"aspect_ratiooptionalstringAspect ratio of the output image. Select 'custom' to specify the width and height manually.
"custom""custom""1:1 square 1024x1024""3:4 portrait 896x1152""5:8 portrait 832x1216""9:16 portrait 768x1344""9:21 portrait 640x1536""4:3 landscape 1152x896""3:2 landscape 1216x832""16:9 landscape 1344x768""21:9 landscape 1536x640"base64optionalbooleanOutput as base64 encoded string
falsebatch_sizeoptionalintegerNumber of images to generate in one batch
1Range: 1 - 10guidance_scaleoptionalnumberGuidance scale for controlling how closely the generation matches the prompt
1Range: 1 - 15heightoptionalintegerHeight of the output image in pixels
1024Range: 64 - 2048image_formatoptionalstringOutput image format
"jpeg""jpeg""png""webp"image_qualityoptionalintegerImage quality setting for output
95Range: 10 - 100negative_promptoptionalstringThe negative prompt to exclude unwanted details
"low quality, blurry"seedoptionalintegerRandom number,seed for image generation
98552302stepsoptionalintegerNumber of inference steps for generating the image
4Range: 10 - 70widthoptionalintegerWidth of the output image in pixels
1024Range: 64 - 2048Response Type
Returns: Text/JSON
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