Chroma Serverless API
Chroma is an open-source, 8.9B parameter text-to-image model (based on FLUX.1-schnell) designed for diverse and uncensored content generation, including anime, furry art, and photography.
POST /v2/chroma · 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 "chroma",
9 prompt="Close-up portrait of a young knight in shining armor, holding a sword, set against a medieval castle background, dramatic lighting.",
10 negative_prompt="low quality, ugly, deformed, blurry, bad anatomy, distorted, unrealistic",
11 width=1024,
12 height=1024,
13 aspect_ratio="1:1 square 1024x1024",
14 cfg=7,
15 sampler_name="euler",
16 scheduler="beta",
17 steps=40,
18 seed=123456789,
19 samples=1,
20 image_format="png",
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": "Close-up portrait of a young knight in shining armor, holding a sword, set against a medieval castle background, dramatic lighting.",
34 "negative_prompt": "low quality, ugly, deformed, blurry, bad anatomy, distorted, unrealistic",
35 "width": 1024,
36 "height": 1024,
37 "aspect_ratio": "1:1 square 1024x1024",
38 "cfg": 7,
39 "sampler_name": "euler",
40 "scheduler": "beta",
41 "steps": 40,
42 "seed": 123456789,
43 "samples": 1,
44 "image_format": "png",
45 "image_quality": 95,
46 "base64": False,
47}
48job = client.submit_async("chroma", **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 "chroma",
9 prompt="Close-up portrait of a young knight in shining armor, holding a sword, set against a medieval castle background, dramatic lighting.",
10 negative_prompt="low quality, ugly, deformed, blurry, bad anatomy, distorted, unrealistic",
11 width=1024,
12 height=1024,
13 aspect_ratio="1:1 square 1024x1024",
14 cfg=7,
15 sampler_name="euler",
16 scheduler="beta",
17 steps=40,
18 seed=123456789,
19 samples=1,
20 image_format="png",
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": "Close-up portrait of a young knight in shining armor, holding a sword, set against a medieval castle background, dramatic lighting.",
34 "negative_prompt": "low quality, ugly, deformed, blurry, bad anatomy, distorted, unrealistic",
35 "width": 1024,
36 "height": 1024,
37 "aspect_ratio": "1:1 square 1024x1024",
38 "cfg": 7,
39 "sampler_name": "euler",
40 "scheduler": "beta",
41 "steps": 40,
42 "seed": 123456789,
43 "samples": 1,
44 "image_format": "png",
45 "image_quality": 95,
46 "base64": False,
47}
48job = client.submit_async("chroma", **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/chromaParameters
promptrequiredstringDescribes the imagery scene; specific details yield rich images. Use for artistic depiction.
"Close-up portrait of a young knight in shining armor, holding a sword, set against a medieval castle background, dramatic lighting."aspect_ratiooptionalstringSelects image shape; square fits media platforms well.
"1:1 square 1024x1024""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"base64optionalbooleanOutputs image as base64 string; useful for embedding.
falsecfgoptionalnumberGuides prompt adherence; higher values mean more accuracy.
7Range: 1 - 20heightoptionalintegerSets image height; balance with width for proper ratio.
1024Range: 768 - 2048image_formatoptionalstringOutput format choice; 'png' offers high quality.
"png""jpeg""png""webp"image_qualityoptionalintegerSets image detail level; 95 for fine detail.
95Range: 1 - 100negative_promptoptionalstringExcludes undesirable elements; keeps image focus clear. Useful for professional look.
"low quality, ugly, deformed, blurry, bad anatomy, distorted, unrealistic"sampler_nameoptionalstringSelects image sampling; 'euler' for balanced quality and speed.
"euler""euler""euler_a""heun""dpm_2""dpm_2_a""lms""dpm_fast""dpm_adaptive""dpmpp_2s_a""dpmpp_sde"+2 moresamplesoptionalintegerNumber of images generated; adjust for more options.
1scheduleroptionalstringManages noise schedule; 'beta' for smooth transitions.
"beta""normal""karras""exponential""beta""sgm_uniform""simple"seedoptionalintegerFixes randomness; set for replicable outcomes.
123456789stepsoptionalintegerChanges denoising steps; more steps for enhanced detail.
40Range: 10 - 75widthoptionalintegerDefines image width in pixels; adjust for different display needs.
1024Range: 768 - 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/chromaSubmit — 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