Kolors Serverless API
Kolors is a cutting-edge text-to-image model that bridges language and visual art. Transform your textual ideas into photorealistic images with semantic precision.
POST /v2/kolors · 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 "kolors",
9 cfg=6,
10 seed=441234134,
11 steps=25,
12 width=1024,
13 height=1024,
14 prompt="In this lively 2D illustration, three animated boys joyfully have their laughter filling the air. , adding warmth and charm. The agave field behind them radiates warmth, emphasizing the authenticity of this gathering spot and the togetherness of the boys sharing a moment of joy.",
15 scheduler="EulerDiscreteScheduler",
16 output_format="webp",
17 output_quality=80,
18 number_of_images=1,
19)
20print(result["status"]) # COMPLETED
21print(result.get("output")) # model output (e.g. media URL)
22print(result["metrics"]["inference_time"]) # server compute seconds
23
24# --- Or submit + poll manually (track request_id, control the cadence) ---
25from segmind import SegmindClient, InferenceFailed, InferenceTimeout
26
27client = SegmindClient() # reads SEGMIND_API_KEY
28payload = {
29 "cfg": 6,
30 "seed": 441234134,
31 "steps": 25,
32 "width": 1024,
33 "height": 1024,
34 "prompt": "In this lively 2D illustration, three animated boys joyfully have their laughter filling the air. , adding warmth and charm. The agave field behind them radiates warmth, emphasizing the authenticity of this gathering spot and the togetherness of the boys sharing a moment of joy.",
35 "scheduler": "EulerDiscreteScheduler",
36 "output_format": "webp",
37 "output_quality": 80,
38 "number_of_images": 1,
39}
40job = client.submit_async("kolors", **payload)
41print(job.request_id) # available immediately
42try:
43 result = job.wait(timeout=600, interval=1.0)
44except InferenceTimeout as e:
45 print("still running:", e.request_id)
46except InferenceFailed as e:
47 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 "kolors",
9 cfg=6,
10 seed=441234134,
11 steps=25,
12 width=1024,
13 height=1024,
14 prompt="In this lively 2D illustration, three animated boys joyfully have their laughter filling the air. , adding warmth and charm. The agave field behind them radiates warmth, emphasizing the authenticity of this gathering spot and the togetherness of the boys sharing a moment of joy.",
15 scheduler="EulerDiscreteScheduler",
16 output_format="webp",
17 output_quality=80,
18 number_of_images=1,
19)
20print(result["status"]) # COMPLETED
21print(result.get("output")) # model output (e.g. media URL)
22print(result["metrics"]["inference_time"]) # server compute seconds
23
24# --- Or submit + poll manually (track request_id, control the cadence) ---
25from segmind import SegmindClient, InferenceFailed, InferenceTimeout
26
27client = SegmindClient() # reads SEGMIND_API_KEY
28payload = {
29 "cfg": 6,
30 "seed": 441234134,
31 "steps": 25,
32 "width": 1024,
33 "height": 1024,
34 "prompt": "In this lively 2D illustration, three animated boys joyfully have their laughter filling the air. , adding warmth and charm. The agave field behind them radiates warmth, emphasizing the authenticity of this gathering spot and the togetherness of the boys sharing a moment of joy.",
35 "scheduler": "EulerDiscreteScheduler",
36 "output_format": "webp",
37 "output_quality": 80,
38 "number_of_images": 1,
39}
40job = client.submit_async("kolors", **payload)
41print(job.request_id) # available immediately
42try:
43 result = job.wait(timeout=600, interval=1.0)
44except InferenceTimeout as e:
45 print("still running:", e.request_id)
46except InferenceFailed as e:
47 print("failed:", e.detail)API Endpoint
https://api.segmind.com/v1/kolorsParameters
promptrequiredstring"In this lively 2D illustration, three animated boys joyfully have their laughter filling the air. , adding warmth and charm. The agave field behind them radiates warmth, emphasizing the authenticity of this gathering spot and the togetherness of the boys sharing a moment of joy."cfgoptionalnumberGuidance scale
6Range: 0 - 20heightoptionalintegerHeight of the image
1024Range: 512 - 2048negative_promptoptionalstringThings you do not want to see in your image
""number_of_imagesoptionalintegerNumber of images to generate
1Range: 1 - 10output_formatoptionalstringAn enumeration.
"webp""webp""jpg""png"output_qualityoptionalintegerQuality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.
80Range: 0 - 100scheduleroptionalstringAn enumeration.
"EulerDiscreteScheduler""EulerDiscreteScheduler""EulerAncestralDiscreteScheduler""DPMSolverMultistepScheduler""DPMSolverMultistepScheduler_SDE_karras""UniPCMultistepScheduler""DEISMultistepScheduler"seedoptionalintegerSet a seed for reproducibility. Random by default.
441234134stepsoptionalintegerNumber of inference steps
25Range: 1 - 50widthoptionalintegerWidth of the image
1024Range: 512 - 2048Response Type
Returns: Image
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/kolorsSubmit — 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