Skip to main content

Start Your First Server

Deploy a diffusion model with one command:
The server will start on http://localhost:8000. You’ll see:
The first run will download the model from HuggingFace, which may take several minutes.

Generate Images

Using OpenAI Python Client

Install the OpenAI client if you don’t have it:
Then generate images:

Using cURL

Test with cURL:

Using Requests

Server Options

With Authentication

Secure your server with an API key:
Then use it from your client:
Generate a secure API key with: openssl rand -hex 32

Custom Port

Run on a different port:

Custom Data Type

Use bfloat16 for better quality on supported GPUs:

With LoRA

Serve a model with a LoRA adapter:

Common Use Cases

Serve SDXL

Default settings work well for SDXL.

Serve FLUX.1

Use bfloat16 for FLUX models.

Serve SD 1.5

Smaller model, faster inference.

Serve with Custom Settings

Production-ready configuration.

Advanced Generation Parameters

Control Inference Steps

Use Negative Prompts

Set Random Seed

For reproducible results:

Adjust Guidance Scale

Control adherence to prompt:

Generate Multiple Images

Health Checks

Check Server Status

Response:

List Available Models

Response:

Complete Example Script

Save as generate.py:
Run it:

Troubleshooting

Server won’t start

Issue: Port already in use Solution:

CUDA out of memory

Issue: Model too large for GPU Solutions:
  1. Use a smaller model:
  2. Use float16:
  3. Close other GPU applications

Slow generation

Issue: Generation takes too long Solutions:
  1. Reduce inference steps:
  2. Use a faster model:

Connection refused

Issue: Can’t connect to server Checks:
  1. Is the server running?
  2. Is the port correct?
  3. Is the host correct?

Next Steps

Configuration

All server configuration options

Serving Overview

Understand the server architecture

Training

Train custom LoRAs to serve

Supported Models

See all compatible models