PuLID Lightning Serverless API

Faster version of PuLID, a novel tuning-free face customization method for text-to-image generation

~210.80s
POST /v2/pulid-lightning · 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    "pulid-lightning",
 9    seed=412431,
10    width=1024,
11    height=1024,
12    prompt="A photo of a person",
13    face_image="https://segmind-sd-models.s3.amazonaws.com/display_images/Pid_ip.png.png",
14    face_style="high-fidelity",
15    output_format="png",
16    output_quality=80,
17    checkpoint_model="default",
18    number_of_images=1,
19)
20print(result["status"])                      # COMPLETED
21print(result.get("output"))                  # model output (e.g. media URL)
22print(result["metrics"]["inference_time"])   # server compute seconds
23
24# --- Or submit + poll manually (track request_id, control the cadence) ---
25from segmind import SegmindClient, InferenceFailed, InferenceTimeout
26
27client = SegmindClient()                      # reads SEGMIND_API_KEY
28payload = {
29    "seed": 412431,
30    "width": 1024,
31    "height": 1024,
32    "prompt": "A photo of a person",
33    "face_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/Pid_ip.png.png",
34    "face_style": "high-fidelity",
35    "output_format": "png",
36    "output_quality": 80,
37    "checkpoint_model": "default",
38    "number_of_images": 1,
39}
40job = client.submit_async("pulid-lightning", **payload)
41print(job.request_id)                         # available immediately
42try:
43    result = job.wait(timeout=600, interval=1.0)
44except InferenceTimeout as e:
45    print("still running:", e.request_id)
46except InferenceFailed as e:
47    print("failed:", e.detail)

API Endpoint

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

Parameters

face_imagerequired
string (uri)

The face image to use for the generation

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/Pid_ip.png.png"
checkpoint_modeloptional
string

An enumeration.

Default: "default"
Allowed values :
"default""artistic""realistic"
face_styleoptional
string

An enumeration.

Default: "high-fidelity"
Allowed values :
"high-fidelity""stylized"
heightoptional
integer

Height of the output image (ignored if structure image given)

Default: 1024
negative_promptoptional
string

Things you do not want to see in your image

number_of_imagesoptional
integer

Number of images to generate

Default: 1Range: 1 - 10
output_formatoptional
string

An enumeration.

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

Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.

Default: 80Range: 0 - 100
promptoptional
string

You might need to include a gender in the prompt to get the desired result

Default: "A photo of a person"
seedoptional
integer

Set a seed for reproducibility. Random by default.

Default: -1
widthoptional
integer

Width of the output image (ignored if structure image given)

Default: 1024

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

    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