SSD-1B Serverless API
SSD-1B efficiently generates high-quality, diverse images from text prompts in real-time.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/ssd-1b"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "a futuristic cityscape at dusk, neon lights, reflections in water, ultrarealistic, high contrast, vibrant",
12 "negative_prompt": "blurry,out of focus",
13 "samples": 1,
14 "scheduler": "DPM Multi",
15 "num_inference_steps": 45,
16 "guidance_scale": 7,
17 "seed": 9876543210,
18 "img_width": 1024,
19 "img_height": 1024,
20 "base64": false
21}
22
23response = requests.post(url, headers=headers, json=data)
24
25if response.status_code == 200:
26 result = response.json()
27 print(json.dumps(result, indent=2))
28else:
29 print(f"Error: {response.status_code}")
30 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/ssd-1b"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "a futuristic cityscape at dusk, neon lights, reflections in water, ultrarealistic, high contrast, vibrant",
12 "negative_prompt": "blurry,out of focus",
13 "samples": 1,
14 "scheduler": "DPM Multi",
15 "num_inference_steps": 45,
16 "guidance_scale": 7,
17 "seed": 9876543210,
18 "img_width": 1024,
19 "img_height": 1024,
20 "base64": false
21}
22
23response = requests.post(url, headers=headers, json=data)
24
25if response.status_code == 200:
26 result = response.json()
27 print(json.dumps(result, indent=2))
28else:
29 print(f"Error: {response.status_code}")
30 print(response.text)API Endpoint
https://api.segmind.com/v1/ssd-1bParameters
promptrequiredstringDescriptive phrases guide the model's output. Include vivid details and context for diverse results.
base64optionalbooleanEncodes images in Base64 for seamless integration. Enable if encoding is needed.
falseguidance_scaleoptionalnumberDetermines output fidelity to prompt. Higher for precision, lower for creative variance.
7Range: 1 - 25img_heightoptionalintegerDetermines output height; fixed at 1024 for optimal resolution.
10241024img_widthoptionalintegerDefines output width; set to 1024 for best clarity and detail.
10241024negative_promptoptionalstringFilters out unwanted elements. Use to enforce clarity and aesthetics.
"blurry,out of focus"num_inference_stepsoptionalintegerControls detail via denoising steps. Raise steps for intricate textures, lower for speed.
45Range: 20 - 100samplesoptionalintegerSpecifies the number of images to generate. More samples increase diversity, fewer for speed.
2Range: 1 - 4scheduleroptionalstringDetermines denoising pattern. 'DPM Multi' for balanced outputs, 'Euler' for sharper results.
"DPM Multi""DDIM""DPM Multi""DPM Single""Euler a""Euler""Heun""DPM2 a Karras""DPM2 Karras""LMS""PNDM"+2 moreseedoptionalintegerEnsures repeatable results by fixing randomness. User-defined or random for unique images.
9876543210Range: -1 - 999999999999999Response 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