REST API for SD Models

The REST API for stable diffusion series models that allows easier integration into existing applications.

Currently we only support stabilityai/stable-diffusion-xl-base-1.0 for inference.

Request Example

curl --request POST \
     --url https://api.neurohero.io/api/v1/image/generation \
     --header 'Authorization: Bearer yourAPIkey' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "model": "stabilityai/stable-diffusion-xl-base-1.0",
  "prompt": "draw a cat",
  "width": 512,
  "height": 512,
  "seed": 2024
}
' --output cat.png

Input Parameters

  • model: The model to use for image generation.
  • prompt: A short description of the desired images.
  • width: Width of the image to generate in number of pixels. Between 64 and 1024. Default to 512.
  • height: Height of the image to generate in number of pixels. Between 64 and 1024. Default to 512.
  • seed: Seed used for generation. Can be used to reproduce image generations. Default to a random seed.
  • steps: The number of steps for image generation. Between 1 and 100. Defaults to 50.
  • negative_prompt: A few words or a short description of the undesired aspects of the images. Defaults to None.

Response Example

The response is a binary file containing a png image. The content of above request is like following,