Skip to main content

Stability AI

Stability AI is a Generative AI service that generates text to images using the open source Stable Diffusion model. Generate images using one of the available models and provide a text prompt. Stability AI will then generate an image based on the text prompt.

The Stability AI provider allows you to generate assets using the Create API and includes the following services:

  • Text to Image: Generate an image from a text prompt.

Setup

Sign up for a free Stability AI API account and then go to the account keys page to generate an API key.

Adding credentials

Login to the dashboard and navigate to the integrations page, find the Stability AI integration under Generative AI and click configure.

Enter the Stability AI API key as shown below. You can add different keys for each Shotstack environment; sandbox and v1 (production).

Stability AI credentials

Services

The Stability AI provider includes is a single service:

Text to image

Generate an image using a text prompt using the selected engine and options.

Using the Create API the following payload can be used to generate an image file:

{
"provider": "stability-ai",
"options": {
"type": "text-to-image",
"prompt": "An illustration of a camera from 1816",
"width": 1024,
"height": 1024
}
}

This will generate a png image file using the default stable-diffusion-xl-1024-v1-0 engine from the provided text prompt. The image will be 1024px by 1024px.

Additional options

The following request includes all teh available options including the engine, steps and style preset:

{
"provider": "stability-ai",
"options": {
"type": "text-to-image",
"prompt": "An illustration of a camera from 1816",
"width": 512,
"height": 512,
"engine": "stable-diffusion-v1-5",
"steps": 30,
"stylePreset": "digital-art"
}
}

This will generate a png image file using the stable-diffusion-v1-5 engine from the provided text prompt. The image will be 512px by 512px and will use the digital-art style preset. The image will be generated over 30 steps.