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 find a list of the public and LoRA models available and their IDs here.

Request

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

Body

json
{  
  "key": "your_api_key",  
  "model_id": "f222-diffusion",  
  "prompt": "a female model doing photoshoot, ultra realistic face, ultra high resolution, 4K image",  
  "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": "31",  
  "safety_checker": "yes",  
  "seed": null,  
  "guidance_scale": 7.5,  
  "upscale": "no",  
  "lora_model": "ganyu-lora,more_details",  
  "lora_strength": "0.45,0.55",  
  "scheduler": "UniPCMultistepScheduler",  
  "webhook": null,  
  "track_id": null
}

Body

application/json

Response

Text-to-image generation response

The response is of type object.