image generation

ByteDance logoSDXL Lightning

A variant of Stable Diffusion XL that generates 1024x1024 px images in 4 UNet steps, enabling near real-time image creation.

Model details

View repository

Example usage

The model accepts a single input, prompt, and returns a base64 string of the image as the key result.

This implementation uses the 4-step UNet checkpoint to balance speed and quality. You can deploy your own version with either 2 steps for even faster results or 8 steps for even higher quality.

Input
1import base64
2import requests
3import os
4
5# Replace the empty string with your model id below
6model_id = ""
7baseten_api_key = os.environ["BASETEN_API_KEY"]
8BASE64_PREAMBLE = "data:image/png;base64,"
9
10data = {
11    "prompt": "a picture of a rhino wearing a suit",
12}
13
14# Call model endpoint
15res = requests.post(
16    f"https://model-{model_id}.api.baseten.co/production/predict",
17    headers={"Authorization": f"Api-Key {baseten_api_key}"},
18    json=data
19)
20
21# Get output image
22res = res.json()
23img_b64 = res.get("result")
24img = base64.b64decode(img_b64)
25
26# Save the base64 string to a PNG
27img_file = open("sdxl-output-1.png", "wb")
28img_file.write(img)
29img_file.close()
30os.system("open sdxl-output-1.png")
JSON output
1{
2    "result": "iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAA..."
3}
Preview
Preview image

image generation models

See all
Fotographer AI
Image generation

ZenCtrl

Custom Server - H100
ByteDance logo
Image generation

SDXL Lightning

1.0 - Lightning - A100
Stability AI logo
Image generation

Stable Diffusion 3 Medium

3 - A100

ByteDance models

See all
ByteDance logo
Image generation

SDXL Lightning

1.0 - Lightning - A100

🔥 Trending models