Skip to main content
POST
/
text2img
Text-to-Image
curl --request POST \
  --url https://modelslab.com/api/v6/images/text2img \
  --header 'Content-Type: application/json' \
  --data '
{
  "key": "<string>",
  "model_id": "<string>",
  "prompt": "<string>",
  "negative_prompt": "<string>",
  "width": 1024,
  "height": 1024,
  "samples": 1,
  "num_inference_steps": 30,
  "guidance_scale": 7.5,
  "safety_checker": "yes",
  "seed": 123,
  "scheduler": "DPMSolverMultistepScheduler",
  "use_karras_sigmas": "yes",
  "algorithm_type": "sde-dpmsolver++",
  "clip_skip": 2,
  "webhook": "<string>",
  "track_id": "<string>"
}
'
{
  "generationTime": 123,
  "id": 123,
  "output": [
    "<string>"
  ],
  "proxy_links": [
    "<string>"
  ],
  "meta": {},
  "nsfw_content_detected": true,
  "webhook_status": "<string>",
  "tip": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.modelslab.com/llms.txt

Use this file to discover all available pages before exploring further.

Generate photorealistic images from text descriptions using Pony models. Pony models are known for their vibrant, high-quality outputs with excellent prompt adherence.
See available schedulers for Pony models.

Request

Make a POST request to the endpoint below with the required parameters.
POST https://modelslab.com/api/v6/images/text2img

Body

json
{
    "key": "your_api_key",
    "model_id": "pony_realism",
    "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": "blurry, low quality, distorted, deformed",
    "width": "1024",
    "height": "1024",
    "samples": "1",
    "num_inference_steps": "31",
    "safety_checker": "no",
    "seed": null,
    "guidance_scale": 7.5,
    "scheduler": "DPMSolverMultistepScheduler",
    "use_karras_sigmas": "yes",
    "algorithm_type": "sde-dpmsolver++",
    "clip_skip": "2",
    "webhook": null,
    "track_id": null
}

Body

application/json
key
string
required

Your API Key used for request authorization.

model_id
string
required

The ID of the Pony model to be used. Use pony_realism for the Pony Realism model.

prompt
string
required

A text description of what you want in the generated image.

negative_prompt
string

Items you don't want in the image.

width
integer
default:1024

The width of the image in pixels. Must be between 1024-2048 and divisible by 8.

Required range: 1024 <= x <= 2048
height
integer
default:1024

The height of the image in pixels. Must be between 1024-2048 and divisible by 8.

Required range: 1024 <= x <= 2048
samples
integer
default:1

The number of images to be returned in response. Maximum is 4.

Required range: x <= 4
num_inference_steps
integer
default:30

Number of denoising steps. Higher values produce more detailed images but take longer.

Required range: 20 <= x <= 50
guidance_scale
number
default:7.5

How closely to follow the prompt. Higher values = more literal interpretation.

Required range: 1 <= x <= 20
safety_checker
enum<string>
default:yes

Enable NSFW content filter.

Available options:
yes,
no
seed
integer | null

Random seed for reproducible results. Pass null for a random number.

scheduler
string
default:DPMSolverMultistepScheduler

Scheduler to use for denoising.

use_karras_sigmas
enum<string>
default:yes

Apply Karras sigmas to the scheduler.

Available options:
yes,
no
algorithm_type
string
default:sde-dpmsolver++

Algorithm type for the scheduler.

clip_skip
integer
default:2

Number of CLIP layers to skip. Affects style interpretation.

Required range: 1 <= x <= 4
webhook
string<uri>

URL to receive a POST API call once image generation is complete.

track_id
string

Unique ID used in webhook response to identify the request.

Response

Text-to-image generation response

status
enum<string>

Status of the image generation.

Available options:
success
generationTime
number

Time taken to generate the image in seconds.

id
integer

Unique identifier for the image generation request.

output
string<uri>[]

Array of generated image URLs.

Array of proxy image URLs.

meta
object

Metadata about the image generation including all parameters used.

nsfw_content_detected
boolean

Indicates if NSFW content was detected in the generated image.

webhook_status
string

Status of the webhook notification.

tip
string

Additional information or tips for the user.