> ## Documentation Index
> Fetch the complete documentation index at: https://docs.deepinfra.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Stable Diffusion

> Generate images with Stable Diffusion and SDXL on DeepInfra.

DeepInfra supports a wide variety of text-to-image models. This page walks through SDXL Turbo; the catalog also carries the FLUX, Qwen-Image and Nano Banana families.

Browse [all text-to-image models](https://deepinfra.com/models/text-to-image).

## Quick start

This example uses `stabilityai/sdxl-turbo`:

<CodeGroup>
  ```javascript JavaScript theme={null}
  import { TextToImage } from "deepinfra";
  import { createWriteStream } from "fs";
  import { Readable } from "stream";

  const DEEPINFRA_API_KEY = process.env.DEEPINFRA_API_KEY;

  const model = new TextToImage("stabilityai/sdxl-turbo", DEEPINFRA_API_KEY);

  const response = await model.generate({
    prompt: "a burger with a funny hat on the beach",
  });

  const result = await fetch(response.images[0]);

  if (result.ok && result.body) {
    Readable.fromWeb(result.body).pipe(createWriteStream("image.jpg"));
  }
  ```

  ```bash cURL theme={null}
  curl "https://api.deepinfra.com/v1/inference/stabilityai/sdxl-turbo" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $DEEPINFRA_API_KEY" \
    -d '{"prompt": "a burger with a funny hat on the beach"}'
  ```
</CodeGroup>

`images[0]` is a `data:` URI containing the encoded image, not an HTTP link — `fetch()` accepts it directly, as above.

## Advanced options

Each model has its own set of parameters including negative prompts, number of inference steps, guidance scale, seed, and more. Check the model's page for all available options:

* [stabilityai/sdxl-turbo](https://deepinfra.com/stabilityai/sdxl-turbo)

## Using the OpenAI-compatible API

You can also use the OpenAI images API for image generation — see [Image Generation](/apis/image-generation).

## Custom LoRA adapters

To use custom style LoRA adapters for image generation, see [LoRA for Image Generation](/private-models/lora-image).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.