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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 const axios = require('axios'); const FormData = require('form-data'); const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/pulid-base"; const reqBody = { "seed": 451312, "width": 1024, "height": 1024, "prompt": "anime middle aged professional guy", "face_image": "https://segmind-sd-models.s3.amazonaws.com/outputs/realvis_xl.jpeg", "face_style": "high-fidelity", "output_format": "png", "output_quality": 80, "negative_prompt": "None", "checkpoint_model": "general - dreamshaperXL_alpha2Xl10", "number_of_images": 1 }; (async function() { try { const formData = new FormData(); // Append regular fields for (const key in reqBody) { if (reqBody.hasOwnProperty(key)) { formData.append(key, reqBody[key]); } } // Convert and append images as Base64 if necessary const response = await axios.post(url, formData, { headers: { 'x-api-key': api_key, ...formData.getHeaders() } }); console.log(response.data); } catch (error) { console.error('Error:', error.response ? error.response.data : error.message); } })();
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: -1 )

Set a seed for reproducibility. Random by default.


widthint ( default: 1024 )

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


heightint ( default: 1024 )

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


promptstr ( default: anime middle aged professional guy )

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


face_imagestr *

The face image to use for the generation


face_styleenum:str ( default: high-fidelity )

An enumeration.

Allowed values:


output_formatenum:str ( default: webp )

An enumeration.

Allowed values:


output_qualityint ( default: 80 )

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

min : 0,

max : 100


negative_promptstr ( default: None )

Things you do not want to see in your image


checkpoint_modelenum:str ( default: general - dreamshaperXL_alpha2Xl10 )

An enumeration.

Allowed values:


number_of_imagesint ( default: 1 )

Number of images to generate

min : 1,

max : 10

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.

PuLID: Pure ID Customization via Contrastive Alignment

Pure and Lightning ID customization (PuLID) is a novel tuning-free ID customization method for text-to-image generation. By incorporating a Lightning T2I branch with a standard diffusion one, PuLID introduces both contrastive alignment loss and accurate ID loss, minimizing disruption to the original model and ensuring high ID fidelity.

Experiments show that PuLID achieves superior performance in both ID fidelity and editability. Another attractive property of PuLID is that the image elements (e.g., background, lighting, composition, and style) before and after the ID insertion are kept as consistent as possible.