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 47 48 49 50 const axios = require('axios'); const FormData = require('form-data'); const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/infinite-you"; const reqBody = { "seed": 6255, "width": 864, "height": 1152, "prompt": "A sophisticated gentleman exuding confidence. He is dressed in a 1990s brown plaid jacket with a high collar, paired with a dark grey turtleneck. His trousers are tailored and charcoal in color, complemented by a sleek leather belt. The background showcases an elegant library with bookshelves, a marble fireplace, and warm lighting, creating a refined and cozy atmosphere. His relaxed posture and casual hand-in-pocket stance add to his composed and stylish demeanor", "id_image": "https://segmind-resources.s3.amazonaws.com/output/e533504e-4e22-4219-88a1-152e002e1a99-man2.png", "num_steps": 30, "model_version": "aes_stage2", "output_format": "webp", "enable_realism": true, "guidance_scale": 3.5, "output_quality": 80, "enable_anti_blur": false, "infusenet_guidance_end": 1, "infusenet_guidance_start": 0, "infusenet_conditioning_scale": 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: 6255 )

Sets the random seed for reproducibility. Use a specific number for repeatability or null for randomness.


widthint ( default: 864 )

Output image width in pixels. Choose 768 for portrait or 960 for landscape.

min : 256,

max : 1280


heightint ( default: 1152 )

Output image height in pixels. Use 960 for standard or 1280 for a more detailed view.

min : 256,

max : 1280


promptstr ( default: 1 )

Input your vision for the image. Example: 'Vibrant sunset over mountains, surreal, dream-like'.


id_imagestr *

Upload a portrait image for processing. Ensure it contains a clear human face.


num_stepsint ( default: 30 )

Controls image refinement steps. Use 30 for good quality, 50 for best details.

min : 1,

max : 100


control_imagestr ( default: 1 )

Optional: Use a secondary image for compositional control. Ideal for consistent layout.


model_versionenum:str ( default: aes_stage2 )

Selects model type. 'aes_stage2' for enhanced aesthetics or 'sim_stage1' for simplicity.

Allowed values:


output_formatenum:str ( default: webp )

Choose the image format. 'webp' for compressibility, 'png' for quality.

Allowed values:


enable_realismbool ( default: true )

Toggle realism enhancement feature. Enable for lifelike representation.


guidance_scalefloat ( default: 3.5 )

Adjustment on prompt adherence. Set higher for precise, lower for creative outputs.

min : 0,

max : 10


output_qualityint ( default: 80 )

Defines the output quality. 80 for general use, 100 for optimal.

min : 1,

max : 100


enable_anti_blurbool ( default: 1 )

Activate to reduce blur. Ideal for sharp, defined structures.


infusenet_guidance_endfloat ( default: 1 )

Defines when identity guidance stops. Generally kept at 1.0 for full application.

min : 0,

max : 1


infusenet_guidance_startfloat ( default: 1 )

Defines when to apply identity guidance. Typical range is 0.0-0.1.

min : 0,

max : 1


infusenet_conditioning_scalefloat ( default: 1 )

Controls identity influence. Lower for more creative deviation.

min : 0,

max : 1

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.

InfiniteYou – Identity-Preserving Text-to-Image Model

What is InfiniteYou?

InfiniteYou is an advanced generative AI model built on Diffusion Transformers (DiTs), optimized for high-fidelity portrait generation that faithfully preserves a subject’s identity. By integrating InfuseNet—an identity-conditioning network—directly into the diffusion process, InfiniteYou combines robust face similarity with strong text-to-image alignment. Its multi-stage training pipeline, which leverages both real and synthetic data, addresses common artifacts like face copy-pasting and improves overall image aesthetics. The plug-and-play architecture makes InfiniteYou compatible with popular AI frameworks, enabling seamless integration into existing workflows.

Key Features

• Identity Preservation: InfuseNet conditioning ensures the generated image maintains core facial features and unique identity details.
• Text-to-Image Alignment: High guidance scale support (0–10) guarantees accurate interpretation of prompts, from “Vibrant sunset portrait” to “Cinematic close-up.”
• Custom Resolution: Adjustable width (256–1280 px) and height (256–1280 px) let you target 768×960 for portraits or 960×1280 for detailed landscape compositions.
• Multi-Stage Model Versions:
– sim_stage1 for streamlined, fast outputs
– aes_stage2 for enhanced aesthetics and realism
• Realism & Sharpness Toggles: Boolean flags enable_realism and enable_anti_blur to control lifelike rendering and reduce blur.
• Output Quality Controls: Set output_quality (1–100) and choose output_format (png, jpg, webp) to balance file size and visual fidelity.
• Reproducibility: Use the optional seed parameter for deterministic results.

Best Use Cases

• Personalized Avatars & Profile Images: Generate consistent, brand-aligned headshots.
• Character Design & Concept Art: Preserve identity while exploring stylized or thematic variations.
• E-commerce & Marketing Creatives: Create product models with lifelike renders for catalogs or ads.
• Entertainment & Social Media Content: Quickly produce shareable portraits without manual retouching.

Prompt Tips and Output Quality

  1. Craft a clear prompt: e.g., “Studio portrait, soft lighting, warm tone, cinematic mood.”
  2. Adjust num_steps (30–50) for quality—more steps yield finer details.
  3. Control identity strength via infusenet_conditioning_scale (0.0–1.0): lower for creative freedom, higher for strict likeness.
  4. Fine-tune guidance_scale (2–6) for prompt adherence vs. artistic variation.
  5. For sharper edges, enable_anti_blur=true; for richer textures, set enable_realism=true.
  6. Preview with a control_image URL to maintain consistent framing across batches.

FAQs

Q: How do I ensure the subject’s identity is preserved?
Use InfuseNet parameters—infusenet_conditioning_scale close to 1.0 and infusenet_guidance_start/end at 0.0 and 1.0—to maximize identity conditioning throughout diffusion.

Q: What resolution should I choose?
Set width and height between 768×960 for portraits or up to 960×1280 for higher detail. The model scales smoothly across the 256–1280 px range.

Q: Which model_version is best?
Choose sim_stage1 for quick prototyping. Switch to aes_stage2 for advanced aesthetics and more nuanced lighting.

Q: How can I balance prompt fidelity vs. creativity?
Modify guidance_scale: values above 5.0 favor strict prompt follow-through, whereas lower values introduce interpretive creativity.

Q: Can I reproduce exact results?
Yes—provide a fixed seed integer. Omitting seed yields random variants.