Flux Pulid Serverless API

Flux PuLID: Customize AI-generated images with your unique identity. Seamlessly integrate faces into text-to-image models for realistic and customizable results. High fidelity, tuning-free customization, and versatile editing options.

~13.10s
POST /v2/flux-pulid · 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    "flux-pulid",
 9    seed=720558,
10    width=896,
11    height=1152,
12    prompt="portrait of woman, neon color, cinematic",
13    main_face_image="https://segmind-sd-models.s3.amazonaws.com/display_images/flux-pulid-ip.jpeg",
14    true_cfg=1,
15    id_weight=1.05,
16    num_steps=20,
17    start_step=0,
18    num_outputs=1,
19    output_format="webp",
20    guidance_scale=4,
21    output_quality=80,
22    negative_prompt="bad quality, worst quality, text, signature, watermark, extra limbs, low resolution, partially rendered objects, deformed or partially rendered eyes, deformed, deformed eyeballs, cross-eyed, blurry",
23    max_sequence_length=128,
24)
25print(result["status"])                      # COMPLETED
26print(result.get("output"))                  # model output (e.g. media URL)
27print(result["metrics"]["inference_time"])   # server compute seconds
28
29# --- Or submit + poll manually (track request_id, control the cadence) ---
30from segmind import SegmindClient, InferenceFailed, InferenceTimeout
31
32client = SegmindClient()                      # reads SEGMIND_API_KEY
33payload = {
34    "seed": 720558,
35    "width": 896,
36    "height": 1152,
37    "prompt": "portrait of woman, neon color, cinematic",
38    "main_face_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/flux-pulid-ip.jpeg",
39    "true_cfg": 1,
40    "id_weight": 1.05,
41    "num_steps": 20,
42    "start_step": 0,
43    "num_outputs": 1,
44    "output_format": "webp",
45    "guidance_scale": 4,
46    "output_quality": 80,
47    "negative_prompt": "bad quality, worst quality, text, signature, watermark, extra limbs, low resolution, partially rendered objects, deformed or partially rendered eyes, deformed, deformed eyeballs, cross-eyed, blurry",
48    "max_sequence_length": 128,
49}
50job = client.submit_async("flux-pulid", **payload)
51print(job.request_id)                         # available immediately
52try:
53    result = job.wait(timeout=600, interval=1.0)
54except InferenceTimeout as e:
55    print("still running:", e.request_id)
56except InferenceFailed as e:
57    print("failed:", e.detail)

API Endpoint

POSThttps://api.segmind.com/v1/flux-pulid

Parameters

main_face_imagerequired
string (uri)

Upload an ID image for face generation

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/flux-pulid-ip.jpeg"
promptrequired
string

Enter a text prompt to guide image generation

Default: "portrait of woman, neon color, cinematic"
guidance_scaleoptional
number

Set the guidance scale for text prompt influence (1.0-10.0)

Default: 4Range: 1 - 10
heightoptional
integer

Set the height of the generated image (256-1536 pixels)

Default: 1152Range: 256 - 1536
id_weightoptional
number

Set the weight of the ID image influence (0.0-3.0)

Default: 1.05Range: 0 - 3
max_sequence_lengthoptional
integer

Set the max sequence length for prompt (T5), smaller is faster (128-512)

Default: 128Range: 128 - 512
negative_promptoptional
string

Enter a negative prompt to specify what to avoid in the image

Default: "bad quality, worst quality, text, signature, watermark, extra limbs, low resolution, partially rendered objects, deformed or partially rendered eyes, deformed, deformed eyeballs, cross-eyed, blurry"
num_outputsoptional
integer

Set the number of images to generate (1-4)

Default: 1Range: 1 - 4
num_stepsoptional
integer

Set the number of denoising steps (1-20)

Default: 20Range: 1 - 20
output_formatoptional
string

An enumeration.

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

Set the quality of the output image for jpg and webp (1-100)

Default: 80Range: 1 - 100
seedoptional
integer

Set a random seed for generation (leave blank or -1 for random)

Default: 720558
start_stepoptional
integer

Set the timestep to start inserting ID (0-4 recommended, 0 for highest fidelity, 4 for more editability)

Default: 0Range: 0 - 10
true_cfgoptional
number

Set the Classifier-Free Guidance (CFG) scale. 1.0 uses standard CFG, while values >1.0 enable True CFG for more precise control over generation. Higher values increase adherence to the prompt at the cost of image quality.

Default: 1Range: 1 - 10
widthoptional
integer

Set the width of the generated image (256-1536 pixels)

Default: 896Range: 256 - 1536

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/flux-pulid

    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