This endpoint allows users to generate images from text prompts.
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
string
required
Your enterprise API Key used for request authorization.
string
required
The ID of the model to be used. It can be public or your trained model.
string
required
Text prompt describing the image you want to generate.
string
Items you don’t want in the image.
number
default:"512"
Width of the generated image. Maximum: 1024.
number
default:"512"
Height of the generated image. Maximum: 1024.
number
default:"1"
Number of images to return. Maximum: 4.
number
default:"21"
Number of denoising steps. Allowed values: 21, 31, or 41.
string
default:"yes"
NSFW checker. If detected, replaces the image with blank. Default: yes.
string
default:"sensitive_content_text"
Action if NSFW content is detected. Default: sensitive_content_text.
string
default:"yes"
Enhance prompts for better results. Default: yes.
number
Seed for reproducibility. Pass null for random generation.
number
default:"7.5"
Scale for classifier-free guidance.
string
default:"no"
Generate a panorama image. Default: no.
string
default:"no"
Enable self-attention for higher quality images (slower). Default: no.
string
default:"no"
Upscale generated images 2×. Default: no.
string
default:"yes"
Enable ToMeSD for faster generation. Default: yes.
string
default:"yes"
Use Karras sigmas for improved results. Default: yes.
string
default:"none"
Algorithm type used in DPMSolverMultistepScheduler. Default: none.