POST
/
text2img
Text-to-Image
curl --request POST \
  --url https://modelslab.com/api/v6/images/text2img \
  --header 'Content-Type: application/json' \
  --data '{
  "key": "<string>",
  "prompt": "<string>",
  "negative_prompt": "<string>",
  "width": 512,
  "height": 512,
  "samples": 1,
  "num_inference_steps": 31,
  "safety_checker": false,
  "safety_checker_type": "sensitive_content_text",
  "seed": 123,
  "guidance_scale": 7.5,
  "use_karras_sigmas": true,
  "algorithm_type": "none",
  "vae": "<string>",
  "lora_strength": "<string>",
  "lora_model": "<string>",
  "clip_skip": 2,
  "base64": false,
  "temp": false,
  "webhook": "<string>",
  "track_id": "<string>",
  "ip_adapter_id": "ip-adapter_sdxl",
  "ip_adapter_scale": 0.5,
  "ip_adapter_image": "<string>",
  "scheduler": "DDPMScheduler",
  "model_id": "<string>",
  "multi_lingual": false,
  "upscale": false,
  "highres_fix": false
}'
{
  "status": "success",
  "generationTime": 123,
  "id": 123,
  "output": [
    "<string>"
  ],
  "proxy_links": [
    "<string>"
  ],
  "meta": {},
  "nsfw_content_detected": true,
  "webhook_status": "<string>",
  "tip": "<string>"
}
You can make an API call to your trained models as well as to any public model.
You can find a list of the public models available and their IDs here
Text to image endpoint result

Request

Make a POST request to endpoint and pass the required parameters as a request body.
curl
--request POST 'https://modelslab.com/api/v6/images/text2img' \

Body

The model_id:“flux” does not support the following parameters negative_prompt, enhance_prompt,enhance_style, lora trained on SD models, ip_adaptors, upscale and highres_fix .
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.

Body

json
{  
  "key": "your_api_key",  
  "model_id": "your_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": "",  
  "width": "512",  
  "height": "512",  
  "samples": "1",  
  "num_inference_steps": "31",  
  "safety_checker": "no", 
  "seed": null,  
  "guidance_scale": 7.5,     
  "upscale": "no",  
  "lora_model": null,
  "clip_skip": "2",  
  "use_karras_sigmas": "yes",  
  "vae": null,  
  "lora_strength": null,  
  "scheduler": "UniPCMultistepScheduler",  
  "webhook": null,  
  "track_id": null
}

Body

application/json

Response

Text-to-image generation response

The response is of type object.