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.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/chroma"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "Close-up portrait of a young knight in shining armor, holding a sword, set against a medieval castle background, dramatic lighting.",
12 "negative_prompt": "low quality, ugly, deformed, blurry, bad anatomy, distorted, unrealistic",
13 "width": 1024,
14 "height": 1024,
15 "aspect_ratio": "1:1 square 1024x1024",
16 "cfg": 7,
17 "sampler_name": "euler",
18 "scheduler": "beta",
19 "steps": 40,
20 "seed": 123456789,
21 "samples": 1,
22 "image_format": "png",
23 "image_quality": 95,
24 "base64": false
25}
26
27response = requests.post(url, headers=headers, json=data)
28
29if response.status_code == 200:
30 result = response.json()
31 print(json.dumps(result, indent=2))
32else:
33 print(f"Error: {response.status_code}")
34 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/chroma"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "prompt": "Close-up portrait of a young knight in shining armor, holding a sword, set against a medieval castle background, dramatic lighting.",
12 "negative_prompt": "low quality, ugly, deformed, blurry, bad anatomy, distorted, unrealistic",
13 "width": 1024,
14 "height": 1024,
15 "aspect_ratio": "1:1 square 1024x1024",
16 "cfg": 7,
17 "sampler_name": "euler",
18 "scheduler": "beta",
19 "steps": 40,
20 "seed": 123456789,
21 "samples": 1,
22 "image_format": "png",
23 "image_quality": 95,
24 "base64": false
25}
26
27response = requests.post(url, headers=headers, json=data)
28
29if response.status_code == 200:
30 result = response.json()
31 print(json.dumps(result, indent=2))
32else:
33 print(f"Error: {response.status_code}")
34 print(response.text)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
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