Stable Diffusion 3.5 Turbo Text to Image Serverless API
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.
POST /v2/stable-diffusion-3.5-turbo-txt2img · submit + poll 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3import segmind
4
5# Async (v2): submit to the queue and block until COMPLETED.
6# run() returns the final result dict (600s deadline, 1.0s poll by default).
7result = segmind.run(
8 "stable-diffusion-3.5-turbo-txt2img",
9 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.",
10 negative_prompt="low quality, blurry",
11 steps=4,
12 guidance_scale=1,
13 seed=98552302,
14 sampler="dpmpp_2m",
15 scheduler="sgm_uniform",
16 width=1024,
17 height=1024,
18 aspect_ratio="custom",
19 batch_size=1,
20 image_format="jpeg",
21 image_quality=95,
22 base64=False,
23)
24print(result["status"]) # COMPLETED
25print(result.get("output")) # model output (e.g. media URL)
26print(result["metrics"]["inference_time"]) # server compute seconds
27
28# --- Or submit + poll manually (track request_id, control the cadence) ---
29from segmind import SegmindClient, InferenceFailed, InferenceTimeout
30
31client = SegmindClient() # reads SEGMIND_API_KEY
32payload = {
33 "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.",
34 "negative_prompt": "low quality, blurry",
35 "steps": 4,
36 "guidance_scale": 1,
37 "seed": 98552302,
38 "sampler": "dpmpp_2m",
39 "scheduler": "sgm_uniform",
40 "width": 1024,
41 "height": 1024,
42 "aspect_ratio": "custom",
43 "batch_size": 1,
44 "image_format": "jpeg",
45 "image_quality": 95,
46 "base64": False,
47}
48job = client.submit_async("stable-diffusion-3.5-turbo-txt2img", **payload)
49print(job.request_id) # available immediately
50try:
51 result = job.wait(timeout=600, interval=1.0)
52except InferenceTimeout as e:
53 print("still running:", e.request_id)
54except InferenceFailed as e:
55 print("failed:", e.detail) 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3import segmind
4
5# Async (v2): submit to the queue and block until COMPLETED.
6# run() returns the final result dict (600s deadline, 1.0s poll by default).
7result = segmind.run(
8 "stable-diffusion-3.5-turbo-txt2img",
9 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.",
10 negative_prompt="low quality, blurry",
11 steps=4,
12 guidance_scale=1,
13 seed=98552302,
14 sampler="dpmpp_2m",
15 scheduler="sgm_uniform",
16 width=1024,
17 height=1024,
18 aspect_ratio="custom",
19 batch_size=1,
20 image_format="jpeg",
21 image_quality=95,
22 base64=False,
23)
24print(result["status"]) # COMPLETED
25print(result.get("output")) # model output (e.g. media URL)
26print(result["metrics"]["inference_time"]) # server compute seconds
27
28# --- Or submit + poll manually (track request_id, control the cadence) ---
29from segmind import SegmindClient, InferenceFailed, InferenceTimeout
30
31client = SegmindClient() # reads SEGMIND_API_KEY
32payload = {
33 "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.",
34 "negative_prompt": "low quality, blurry",
35 "steps": 4,
36 "guidance_scale": 1,
37 "seed": 98552302,
38 "sampler": "dpmpp_2m",
39 "scheduler": "sgm_uniform",
40 "width": 1024,
41 "height": 1024,
42 "aspect_ratio": "custom",
43 "batch_size": 1,
44 "image_format": "jpeg",
45 "image_quality": 95,
46 "base64": False,
47}
48job = client.submit_async("stable-diffusion-3.5-turbo-txt2img", **payload)
49print(job.request_id) # available immediately
50try:
51 result = job.wait(timeout=600, interval=1.0)
52except InferenceTimeout as e:
53 print("still running:", e.request_id)
54except InferenceFailed as e:
55 print("failed:", e.detail)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
Asynchronous requests (v2)
Use Async for video, long-running (>~60s), or high-concurrency workloads; Sync is simplest for fast image & LLM calls. Async submits a request and you poll it to completion.
- 1
POST /v2/stable-diffusion-3.5-turbo-txt2imgSubmit — returns request_id, status_url, response_url
- 2
GET /v2/requests/{id}/statusPoll — until COMPLETED or FAILED
- 3
GET /v2/requests/{id}Result — final response body
Status states
- A FAILED request is served as HTTP 422 — the body still carries the error detail.
- An unknown or expired request_id returns HTTP 404.
- Results are retained for 1 hour, then expire.
- Content / RAI blocks surface as FAILED, not a separate state.
- Track completion by polling the status endpoint.
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