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.06s
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)

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

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. 1
    POST /v2/chroma

    Submitreturns request_id, status_url, response_url

  2. 2
    GET /v2/requests/{id}/status

    Polluntil COMPLETED or FAILED

  3. 3
    GET /v2/requests/{id}

    Resultfinal response body

Status states

QUEUEDAccepted, waiting for a worker
PROCESSINGRunning on a worker
COMPLETEDDone — result body is ready
FAILEDErrored (incl. content/RAI blocks)
  • 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.

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