---
title: Stable Diffusion XL
---

# Stable Diffusion XL
POST *https://api.turing.sh/image/sdxl*

## Parameters


- **prompt**
  - Type: string
  - Required: true

- **negative_prompt**
  - Type: string
  - Required: false

- **image**
  - Type: string
  - Required: false

- **action**
  - Type: string
  - Required: true
  - Options: generate, img2img, upscale
  - Default: generate

- **width**
  - Type: number
  - Required: false
  - Default: 512

- **height**
  - Type: number
  - Required: false
  - Default: 512

- **steps**
  - Type: number
  - Required: false
  - Default: 100

- **number**
  - Type: number
  - Required: false
  - Default: 1

- **sampler**
  - Type: string
  - Required: false
  - Options: DDIM, DDPM, K_DPMPP_2M, K_DPMPP_2S_ANCESTRAL, K_DPM_2, K_DPM_2_ANCESTRAL, K_EULER, K_EULER_ANCESTRAL, K_HEUN, K_LMS

- **cfg_scale**
  - Type: number
  - Required: false
  - Default: 7

- **seed**
  - Type: number
  - Required: false

- **style**
  - Type: string
  - Required: false
  - Description: Style to use for generating the image
  - Options: 3d-model, analog-film, anime, cinematic, comic-book, digital-art, enhance, fantasy-art, isometric, line-art, low-poly, modeling-compound, neon-punk, origami, photographic, pixel-art, title-texture

- **model**
  - Type: string
  - Required: false
  - Options: sdxl, sd-1.5, sd, sd-768, stable-diffusion-xl-1024-v0-9, stable-diffusion-v1, stable-diffusion-v1-5, stable-diffusion-512-v2-0, stable-diffusion-768-v2-0, stable-diffusion-depth-v2-0, stable-diffusion-512-v2-1, stable-diffusion-768-v2-1, stable-diffusion-xl-beta-v2-2-2
  - Default: sdxl

- **strength**
  - Type: number
  - Required: false

- **stream**
  - Type: boolean
  - Required: false
  - Default: true

## Response


- **cost**
  - Type: number
  - Description: Cost of the request in USD

- **results**
  - Type: array
  - Description: Results of the request

- **status**
  - Type: string
  - Description: Status of the request

- **progress**
  - Type: number
  - Description: Progress of the request

- **id**
  - Type: string
  - Description: ID of the request

- **error**
  - Type: string
  - Description: Error of the request

## Examples

<CodeGroup title="Stable Diffusion XL example">
  ```typescript
  import axios from "axios";
  (async () => {
    let response = await axios({
      method: "post",
      url: 'https://api.turing.sh/image/sdxl',
      headers: {
        "Content-Type": "application/json",
        Authorization: "Bearer YOUR_API_KEY",
        "x-captcha-token": "Captcha key"
      },
      data: {
  "prompt": "string",
  "action": "generate",
  "width": 512,
  "height": 512,
  "steps": 100,
  "number": 1,
  "sampler": "DDIM",
  "cfg_scale": 7,
  "style": "3d-model",
  "model": "sdxl",
  "stream": true
},
    })
  })();
  ```
  ```python
  import requests
  import json
  response = requests.post(
    "https://api.turing.sh/image/sdxl",
    headers={
      "Content-Type": "application/json",
      "Authorization": "Bearer YOUR_API_KEY",
      "x-captcha-token": "Captcha key"
    },
    data=json.dumps({
  "prompt": "string",
  "action": "generate",
  "width": 512,
  "height": 512,
  "steps": 100,
  "number": 1,
  "sampler": "DDIM",
  "cfg_scale": 7,
  "style": "3d-model",
  "model": "sdxl",
  "stream": true
}),
  )
  ```
</CodeGroup>