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>"
}
To apply multiple LoRA models, provide a comma-separated list in the lora_model field, e.g., "more_details,anime".
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": "tamarin-xl-v1",  
  "prompt": "actual 8K portrait photo of gareth person, portrait, happy colors, bright eyes, clear eyes, warm smile, smooth soft skin, big dreamy eyes, beautiful intricate colored hair, symmetrical, anime wide eyes, soft lighting, detailed face, by makoto shinkai, stanley artgerm lau, wlop, rossdraws, concept art, digital painting, looking into camera",  
  "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": "no",    
  "seed": null,  
  "guidance_scale": 7.5,  
  "upscale": "no",  
  "lora_strength": "0.45",  
  "lora_model": "xl-realistic-cake-art-sty", 
  "scheduler": "UniPCMultistepScheduler",  
  "webhook": null,  
  "track_id": null
}

Body

application/json

Response

Text-to-image generation response

The response is of type object.