Flux Pulid

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.11s
~$0.036
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/flux-pulid"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "seed": 720558,
12    "width": 896,
13    "height": 1152,
14    "prompt": "portrait of woman, neon color, cinematic",
15    "main_face_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/flux-pulid-ip.jpeg",
16    "true_cfg": 1,
17    "id_weight": 1.05,
18    "num_steps": 20,
19    "start_step": 0,
20    "num_outputs": 1,
21    "output_format": "webp",
22    "guidance_scale": 4,
23    "output_quality": 80,
24    "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",
25    "max_sequence_length": 128
26}
27
28response = requests.post(url, headers=headers, json=data)
29
30if response.status_code == 200:
31    result = response.json()
32    print(json.dumps(result, indent=2))
33else:
34    print(f"Error: {response.status_code}")
35    print(response.text)

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

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