Stable Diffusion 3.5 Large Text to Image Serverless API

Stable Diffusion 3.5 Large 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.

~17.51s
POST /v2/stable-diffusion-3.5-large-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-large-txt2img",
 9    prompt="~*~ aesthetic ~*~ #boho #fashion full-body 30-something woman laying on microfloral grass, candid pose, overlay reads Stable Diffusion 3.5, cheerful cursive typography font,",
10    negative_prompt="low quality, blurry",
11    steps=25,
12    guidance_scale=5.5,
13    seed=98552302,
14    sampler="euler",
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": "~*~ aesthetic ~*~ #boho #fashion full-body 30-something woman laying on microfloral grass, candid pose, overlay reads Stable Diffusion 3.5, cheerful cursive typography font,",
34    "negative_prompt": "low quality, blurry",
35    "steps": 25,
36    "guidance_scale": 5.5,
37    "seed": 98552302,
38    "sampler": "euler",
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-large-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

POSThttps://api.segmind.com/v1/stable-diffusion-3.5-large-txt2img

Parameters

promptrequired
string

Prompt for image generation

Default: "~*~ aesthetic ~*~ #boho #fashion full-body 30-something woman laying on microfloral grass, candid pose, overlay reads Stable Diffusion 3.5, cheerful cursive typography font,"
samplerrequired
string

Sampling method for image generation

Default: "euler"
Allowed values (26 total):
"euler""euler_cfg_pp""euler_ancestra""leuler_ancestral_cfg_pp""heun""heunpp2""dpm_2""dpm_2_ancestral""lms""dpm_fast"+16 more
schedulerrequired
string

Scheduler for image generation

Default: "sgm_uniform"
Allowed values :
"normal""karras""exponential""sgm_uniform""simple""ddim_uniform""beta"
aspect_ratiooptional
string

Aspect ratio of the output image. Select 'custom' to specify the width and height manually.

Default: "custom"
Allowed values :
"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"
base64optional
boolean

Output as base64 encoded string

Default: false
batch_sizeoptional
integer

Number of images to generate in one batch

Default: 1Range: 1 - 10
guidance_scaleoptional
number

Guidance scale for controlling how closely the generation matches the prompt

Default: 5.5Range: 1 - 15
heightoptional
integer

Height of the output image in pixels

Default: 1024Range: 64 - 2048
image_formatoptional
string

Output image format

Default: "jpeg"
Allowed values :
"jpeg""png""webp"
image_qualityoptional
integer

Image quality setting for output

Default: 95Range: 10 - 100
negative_promptoptional
string

The negative prompt to exclude unwanted details

Default: "low quality, blurry"
seedoptional
integer

Random number,seed for image generation

Default: 98552302
stepsoptional
integer

Number of inference steps for generating the image

Default: 30Range: 10 - 70
widthoptional
integer

Width of the output image in pixels

Default: 1024Range: 64 - 2048

Response 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. 1
    POST /v2/stable-diffusion-3.5-large-txt2img

    Submitreturns request_id, status_url, response_url

  2. 2
    GET /v2/requests/{id}/status

    Polluntil COMPLETED or FAILED

  3. 3
    GET /v2/requests/{id}

    Resultfinal response body

Status states

QUEUEDAccepted, waiting for a worker
PROCESSINGRunning on a worker
COMPLETEDDone — result body is ready
FAILEDErrored (incl. content/RAI blocks)
  • 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.

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