Request

Make a POST request to below endpoint and pass the required parameters as a request body.
curl
--request POST 'https://modelslab.com/api/v1/enterprise/text2img' \
To use the load balancer, you need to have more than 1 server. Pass the first server’s API key, and it will handle the load balancing with the other servers.
You can also use multi Lora. Just make sure to pass comma saparated lora model ids to the lora_model as "more_details,animie" in the request body.
You can find a list of the public models available and their IDs here.

Schedulers

This endpoint also supports schedulers. Use the “scheduler” parameter in the request body to pass a specific scheduler from the list below:
  • DDPMScheduler
  • DDIMScheduler
  • PNDMScheduler
  • LMSDiscreteScheduler
  • EulerDiscreteScheduler
  • EulerAncestralDiscreteScheduler
  • DPMSolverMultistepScheduler
  • HeunDiscreteScheduler
  • KDPM2DiscreteScheduler
  • DPMSolverSinglestepScheduler
  • KDPM2AncestralDiscreteScheduler
  • UniPCMultistepScheduler
  • DDIMInverseScheduler
  • DEISMultistepScheduler
  • IPNDMScheduler
  • KarrasVeScheduler
  • ScoreSdeVeScheduler
  • LCMScheduler

Body

json
{  
  "key": "enterprise_api_key",  
  "model_id": "model_id",  
  "prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner)), blue eyes, shaved side haircut, hyper detail, cinematic lighting, magic neon, dark red city, Canon EOS R3, nikon, f/1.4, ISO 200, 1/160s, 8K, RAW, unedited, symmetrical balance, in-frame, 8K",  "negative_prompt": "painting, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, deformed, ugly, blurry, bad anatomy, bad proportions, extra limbs, cloned face, skinny, glitchy, double torso, extra arms, extra hands, mangled fingers, missing lips, ugly face, distorted face, extra legs, anime",  
  "width": "512",  
  "height": "512",  
  "samples": "1",  
  "num_inference_steps": "20",  
  "safety_checker": "no",  
  "enhance_prompt": "yes",  
  "seed": null,  
  "guidance_scale": 7.5,  
  "panorama": "no",  
  "self_attention": "no",  
  "upscale": "no",  
  "lora_model": null,  
  "clip_skip": "2",  
  "tomesd": "yes",  
  "use_karras_sigmas": "yes",  
  "vae": null,  
  "lora_strength": null,  
  "scheduler": "UniPCMultistepScheduler",  
  "webhook": null,  
  "track_id": null
}

Body Attributes

key
string
required
Your enterprise API Key used for request authorization.
model_id
string
required
The ID of the model to be used. It can be public or your trained model.
prompt
string
required
Text prompt describing the image you want to generate.
negative_prompt
string
Items you don’t want in the image.
width
number
default:"512"
Width of the generated image. Maximum: 1024.
height
number
default:"512"
Height of the generated image. Maximum: 1024.
samples
number
default:"1"
Number of images to return. Maximum: 4.
num_inference_steps
number
default:"21"
Number of denoising steps. Allowed values: 21, 31, or 41.
safety_checker
string
default:"yes"
NSFW checker. If detected, replaces the image with blank. Default: yes.
safety_checker_type
string
default:"sensitive_content_text"
Action if NSFW content is detected. Default: sensitive_content_text.
enhance_prompt
string
default:"yes"
Enhance prompts for better results. Default: yes.
seed
number
Seed for reproducibility. Pass null for random generation.
guidance_scale
number
default:"7.5"
Scale for classifier-free guidance.
panorama
string
default:"no"
Generate a panorama image. Default: no.
self_attention
string
default:"no"
Enable self-attention for higher quality images (slower). Default: no.
upscale
string
default:"no"
Upscale generated images 2×. Default: no.
tomesd
string
default:"yes"
Enable ToMeSD for faster generation. Default: yes.
use_karras_sigmas
string
default:"yes"
Use Karras sigmas for improved results. Default: yes.
algorithm_type
string
default:"none"
Algorithm type used in DPMSolverMultistepScheduler. Default: none.
vae
string
Custom VAE to use. Default: null.
lora_strength
string
LoRa strength(s). Multiple values supported, comma-separated. Range: 0.1–1.
lora_model
string
LoRa model(s) to use. Multiple supported, comma-separated. Example: contrast-fix,yae-miko-genshin.
scheduler
string
Scheduler to use. See Schedulers.
webhook
string
URL to receive a POST callback once image generation is complete.
track_id
string
ID returned in webhook callback to identify the request.
clip_skip
number
Clip Skip value. Range: 1–8.
base64
string
default:"no"
Return response as base64 string. Default: no.
highres_fix
string
default:"no"
Apply high-resolution fix for generated images. Default: no.
temp
string
default:"no"
Generate a temporary image link valid for 24 hours. Default: no.