POST
javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 const axios = require('axios'); const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/flux-pulid"; const data = { "seed": 720558, "width": 896, "height": 1152, "prompt": "portrait of woman, neon color, cinematic", "main_face_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/flux-pulid-ip.jpeg", "true_cfg": 1, "id_weight": 1.05, "num_steps": 20, "start_step": 0, "num_outputs": 1, "output_format": "webp", "guidance_scale": 4, "output_quality": 80, "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", "max_sequence_length": 128 }; (async function() { try { const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } }); console.log(response.data); } catch (error) { console.error('Error:', error.response.data); } })();
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


seedint ( default: 720558 )

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


widthint ( default: 896 )

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

min : 256,

max : 1536


heightint ( default: 1152 )

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

min : 256,

max : 1536


promptstr *

Enter a text prompt to guide image generation


main_face_imagestr *

Upload an ID image for face generation


true_cfgfloat ( default: 1 )

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.

min : 1,

max : 10


id_weightfloat ( default: 1.05 )

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

min : 0,

max : 3


num_stepsint ( default: 20 )

Set the number of denoising steps (1-20)

min : 1,

max : 20


start_stepint ( default: 1 )

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

min : 0,

max : 10


num_outputsint ( default: 1 )

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

min : 1,

max : 4


output_formatenum:str ( default: webp )

An enumeration.

Allowed values:


guidance_scalefloat ( default: 4 )

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

min : 1,

max : 10


output_qualityint ( default: 80 )

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

min : 1,

max : 100


negative_promptstr ( 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 )

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


max_sequence_lengthint ( default: 128 )

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

min : 128,

max : 512

To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.

Flux PuLID: Pure and Lightning ID Customization via Contrastive Alignment

Flux PuLID (Pure and Lightning ID Customization) is an advanced AI model designed to seamlessly integrate specific identities, such as faces, into text-to-image models without altering their core functionalities. This model is particularly effective for generating high-fidelity images that maintain the unique identity features while allowing extensive customization through text prompts.

Key Features

  • High Identity Fidelity: Ensures that the generated images closely resemble the input identity, maintaining high similarity and naturalness.

  • Tuning-Free Customization: Provides a hassle-free ID customization solution for FLUX.1-dev, eliminating the need for extensive parameter tuning.

  • Versatile Editing: Allows users to modify attributes, styles, and backgrounds using simple text prompts, making it ideal for both realistic and stylized image generation.

Best Settings for Image Creation with Flux PuLID

  • Timestep for ID Insertion (Start_Step): For Realistic Images: Set the timestep to 4. This ensures high fidelity to the input identity while maintaining a natural look. For Stylized Images: Set the timestep to 0-1. This allows for more creative and artistic interpretations of the identity.

  • CFG Scale: For Photorealistic Scenes: Use the “fake CFG” setting. This helps in generating scenes that look more realistic and natural. High ID Fidelity in Stylized Scenes: Use the “true CFG” setting. This ensures that the identity features are prominent even in stylized images.

    *Use detailed and specific text prompts to guide the model in generating the desired attributes, styles, and backgrounds.

Use cases

  • Personalized Avatars: Create avatars that closely resemble real individuals for use in virtual environments, games, and social media.

  • Digital Art: Generate customized digital art pieces with specific identity features, enhancing creativity and personalization.

  • Marketing and Advertising: Produce targeted marketing materials with personalized visuals that resonate with specific audiences.