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 const axios = require('axios'); const fs = require('fs'); const path = require('path'); async function toB64(imgPath) { const data = fs.readFileSync(path.resolve(imgPath)); return Buffer.from(data).toString('base64'); } const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/consistent-character-with-pose"; const data = { "base_64": false, "custom_height": 1024, "custom_width": 1024, "face_image": "toB64('https://segmind-sd-models.s3.amazonaws.com/display_images/ccpose_ip.png')", "output_format": "png", "pose_image": "toB64('https://segmind-sd-models.s3.amazonaws.com/display_images/cc_pose_img.png')", "prompt": "A candid photo of a woman , wearing a blue denim shirt and matching jeans. light smile on her face", "quality": 95, "samples": 1, "seed": 2778725438, "use_input_img_dimension": true }; (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


base_64bool ( default: 1 )

Output as base64 encoded string


custom_heightint ( default: 1024 )

Custom height for output image

min : 64,

max : 4096


custom_widthint ( default: 1024 )

Custom width for output image

min : 64,

max : 4096


face_imageimage *

Face image


output_formatenum:str ( default: png )

Output image format

Allowed values:


pose_imageimage *

Pose image


promptstr *

Textual description for the image generation


qualityint ( default: 95 )

Image quality setting for output

min : 10,

max : 100


samplesint ( default: 1 )

Number of images to generate

min : 1,

max : 4


seedint ( default: 2778725438 )

Random seed for generation


use_input_img_dimensionbool ( default: true )

Whether to use the input image's dimensions

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.

Consistent Character With Pose

Consistent Character lets you generate new images of a specific person with remarkable consistency. It takes just one reference image and a text description of the desired pose variations. The magic lies in its ability to seamlessly transfer the person's unique characteristics onto a new body in a different pose. Under the hood of Consistent Character model is a combination of IP Adapter Face and instant id and openpose controlnet for generating image with pose followed by upscaling.