HiDream-I1 (Fast) Serverless API

HiDream-I1 is a next-generation, open-source image generative foundation model designed for text-to-image synthesis, especially for rendering text.

~10.43s
POST /v2/hidream-l1-fast Β· 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    "hidream-l1-fast",
 9    seed=-1,
10    prompt="a cute panda holding a sign that says \"Keep Calm and Keep Building\"",
11    model_type="fast",
12    resolution="1024 Γ— 1024 (Square)",
13    speed_mode="Lightly Juiced 🍊 (more consistent)",
14    output_format="webp",
15    output_quality=100,
16)
17print(result["status"])                      # COMPLETED
18print(result.get("output"))                  # model output (e.g. media URL)
19print(result["metrics"]["inference_time"])   # server compute seconds
20
21# --- Or submit + poll manually (track request_id, control the cadence) ---
22from segmind import SegmindClient, InferenceFailed, InferenceTimeout
23
24client = SegmindClient()                      # reads SEGMIND_API_KEY
25payload = {
26    "seed": -1,
27    "prompt": "a cute panda holding a sign that says \"Keep Calm and Keep Building\"",
28    "model_type": "fast",
29    "resolution": "1024 Γ— 1024 (Square)",
30    "speed_mode": "Lightly Juiced 🍊 (more consistent)",
31    "output_format": "webp",
32    "output_quality": 100,
33}
34job = client.submit_async("hidream-l1-fast", **payload)
35print(job.request_id)                         # available immediately
36try:
37    result = job.wait(timeout=600, interval=1.0)
38except InferenceTimeout as e:
39    print("still running:", e.request_id)
40except InferenceFailed as e:
41    print("failed:", e.detail)

API Endpoint

POSThttps://api.segmind.com/v1/hidream-l1-fast

Parameters

promptrequired
string

Prompt

Default: "a cute panda holding a sign that says \"Keep Calm and Keep Building\""
model_typeoptional
string

An enumeration.

Default: "fast"
Allowed values :
"fast"
output_formatoptional
string

Output format.

Default: "webp"
Allowed values :
"png""jpg""webp"
output_qualityoptional
integer

Output image quality (for jpg and webp)

Default: 100Range: 1 - 100
resolutionoptional
string

Image resolution

Default: "1024 Γ— 1024 (Square)"
Allowed values :
"1024 Γ— 1024 (Square)""768 Γ— 1360 (Portrait)""1360 Γ— 768 (Landscape)""880 Γ— 1168 (Portrait)""1168 Γ— 880 (Landscape)""1248 Γ— 832 (Landscape)""832 Γ— 1248 (Portrait)"
seedoptional
integer

Seed (-1 for random)

Default: -1
speed_modeoptional
string

Quality vs Speed

Default: "Lightly Juiced 🍊 (more consistent)"
Allowed values :
"Unsqueezed πŸ‹ (highest quality)""Lightly Juiced 🍊 (more consistent)""Juiced πŸ”₯ (more speed)""Extra Juiced πŸš€ (even more speed)"

Response 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. 1
    POST /v2/hidream-l1-fast

    Submit β€” returns request_id, status_url, response_url

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

    Poll β€” until COMPLETED or FAILED

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

    Result β€” final response body

Status states

QUEUEDβ€” Accepted, waiting for a worker
PROCESSINGβ€” Running on a worker
COMPLETEDβ€” Done β€” result body is ready
FAILEDβ€” Errored (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