---
title: "Text To Image"
method: POST
path: "/api/generate/text-to-image"
tags: ["generate"]
---

# Text To Image

`POST /api/generate/text-to-image`

Generate images from text prompts.

## Request body

- TextToImageParams
  - `model_id` string — Hugging Face model ID used for image generation.
  - `loras` string — A LoRA (Low-Rank Adaptation) model and its corresponding weight for image generation. Example: { "latent-consistency/lcm-lora-sdxl": 1.0, "nerijs/pixel-art-xl": 1.2}.
  - `prompt` string, required — Text prompt(s) to guide image generation. Separate multiple prompts with '|' if supported by the model.
  - `height` integer — The height in pixels of the generated image.
  - `width` integer — The width in pixels of the generated image.
  - `guidance_scale` number — Encourages model to generate images closely linked to the text prompt (higher values may reduce image quality).
  - `negative_prompt` string — Text prompt(s) to guide what to exclude from image generation. Ignored if guidance_scale < 1.
  - `safety_check` boolean — Perform a safety check to estimate if generated images could be offensive or harmful.
  - `seed` integer — Seed for random number generation.
  - `num_inference_steps` integer — Number of denoising steps. More steps usually lead to higher quality images but slower inference. Modulated by strength.
  - `num_images_per_prompt` integer — Number of images to generate per prompt.

## Response `200`

Successful Response

- ImageResponse — Response model for image generation.
  - `images` Media[], required — The generated images.
    - `url` string, required — The URL where the media can be accessed.
    - `seed` integer, required — The seed used to generate the media.
    - `nsfw` boolean, required — Whether the media was flagged as NSFW.

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `422` — Validation Error
- `500` — Internal Server Error
- `default` — Error

---

[API](https://skmtc.net/livepeer/apis/untitled-api.md) · [All operations](https://skmtc.net/livepeer/apis/untitled-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/livepeer/untitled-api/versions/dfc937fc0d2c/schema)
