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>"
}
Text to image endpoint result

Request

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

Body

json
{  
    "key": "your_api_key",  
    "model_id": "flux",  
    "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",  
    "width": "512",  
    "height": "512",  
    "samples": "1",  
    "num_inference_steps": "31",  
    "safety_checker": "no",    
    "seed": null,  
    "guidance_scale": 7.5,   
    "clip_skip": "2",  
    "vae": null,  
    "webhook": null,  
    "track_id": null
}

Body

application/json

Response

Text-to-image generation response

The response is of type object.