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.

~53.11s
~$0.055
 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

POSThttps://api.segmind.com/v1/chroma

Parameters

promptrequired
string

Describes the imagery scene; specific details yield rich images. Use for artistic depiction.

Default: "Close-up portrait of a young knight in shining armor, holding a sword, set against a medieval castle background, dramatic lighting."
aspect_ratiooptional
string

Selects image shape; square fits media platforms well.

Default: "1:1 square 1024x1024"
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

Outputs image as base64 string; useful for embedding.

Default: false
cfgoptional
number

Guides prompt adherence; higher values mean more accuracy.

Default: 7Range: 1 - 20
heightoptional
integer

Sets image height; balance with width for proper ratio.

Default: 1024Range: 768 - 2048
image_formatoptional
string

Output format choice; 'png' offers high quality.

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

Sets image detail level; 95 for fine detail.

Default: 95Range: 1 - 100
negative_promptoptional
string

Excludes undesirable elements; keeps image focus clear. Useful for professional look.

Default: "low quality, ugly, deformed, blurry, bad anatomy, distorted, unrealistic"
sampler_nameoptional
string

Selects image sampling; 'euler' for balanced quality and speed.

Default: "euler"
Allowed values (12 total):
"euler""euler_a""heun""dpm_2""dpm_2_a""lms""dpm_fast""dpm_adaptive""dpmpp_2s_a""dpmpp_sde"+2 more
samplesoptional
integer

Number of images generated; adjust for more options.

Default: 1
scheduleroptional
string

Manages noise schedule; 'beta' for smooth transitions.

Default: "beta"
Allowed values :
"normal""karras""exponential""beta""sgm_uniform""simple"
seedoptional
integer

Fixes randomness; set for replicable outcomes.

Default: 123456789
stepsoptional
integer

Changes denoising steps; more steps for enhanced detail.

Default: 40Range: 10 - 75
widthoptional
integer

Defines image width in pixels; adjust for different display needs.

Default: 1024Range: 768 - 2048

Response Type

Returns: Text/JSON

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