Stability AI

The Stability AI AI connector enables you to connect the AI models served on the Stability AI Platform for the following tasks:

#Release Stage

Alpha

#Resource Configuration

The up-to-date configuration is maintained here.

FieldTypeNote
api_key*stringEnter your Stability AI API key. To find your keys, go to your DreamStudio's Account page.

#No-code Setup

PREREQUISITES

To create a Stability AI AI connector, you'll first need to create a Stability AI account by visiting dreamstudio.ai. Access to your API keys can then be managed through DreamStudio's Account page. All new users are granted 25 free credits upon creating an account.

To create a Stability AI AI connector:

  1. Go to the AI page and click Set up new AI

  2. In the Set Up New AI Connector page, fill an ID for your model, this will be the unique identifier of this connector

  3. [Optional] Give a short description of your connector in the Description field

  4. Click the AI Connector Type ▾ drop-down and choose Stability AI

  5. Fill the following information and click Set up

    • Fill API Key. Follow the Stability AI documentation to find your API key
  6. By default, the connector is disconnected. To connect and use AI connector, go to the connector page and click Connect.

#Low-code Setup

cURL(Instill-Cloud)
cURL(Instill-Core)
Copy

curl -X POST http://localhost:8080/vdp/v1alpha/users/<user-id>/connectors \
--header 'Authorization: Bearer <Instill-Cloud-API-Token>' \
--data '{
"id": "my-stable-diffusion",
"connector_definition_name": "connector-definitions/ai-stability-ai",
"configuration": {
"api_key": "<stability-ai-api-key>"
}
}'

For other operations, please refer to the VDP Protobufs.

#Connector Configuration

When using the Stability AI AI connector in your pipeline, certain fields of the input data need to be filled to trigger the pipeline effectively. Here are the expected input and output data fields for the Stability AI AI connector.

#Text to Image

InputTypeDescription
taskstringTASK_TEXT_TO_IMAGE
enginestringStability AI Engine (model) to be used. eg. stable-diffusion-xl-1024-v1-0, stable-diffusion-v1
promptsarray[string]This has the text prompt, required for all tasks.
cfg_scalenumberHow strictly the diffusion process adheres to the prompt text, optional for all tasks.
clip_guidance_presetstringOne from: FAST_BLUE, FAST_GREEN, NONE, SIMPLE, SLOW, SLOWER, SLOWEST, optional for all tasks.
samplerstringWhich sampler to use for the diffusion process, optional for all tasks.
samplesintegerNumber of images to generate, optional for all tasks.
seedintegerRandom noise seed, optional for all tasks.
stepsintegerNumber of diffusion steps to run, optional for all tasks.
style_presetstringTo guide the image model towards a particular style, optional for all tasks.
weightsarray[number]Weights for each of the prompts in texts, optional for all tasks.
heightintegerHeight of the output image, optional.
widthintegerWidth of the output image, optional.
OutputTypeDescription
imagesarray[image]Output images as base64 encoded string.
seedsarray[integer]Seeds for output images.

#Image to Image

InputTypeDescription
taskstringTASK_IMAGE_TO_IMAGE
enginestringStability AI Engine (model) to be used. eg. stable-diffusion-xl-1024-v1-0, stable-diffusion-v1
init_imagestringSpecify initial image
promptsarray[string]This has the text prompt
cfg_scalenumberHow strictly the diffusion process adheres to the prompt text, optional for all tasks.
clip_guidance_presetstringOne from: FAST_BLUE, FAST_GREEN, NONE, SIMPLE, SLOW, SLOWER, SLOWEST, optional for all tasks.
samplerstringWhich sampler to use for the diffusion process, optional for all tasks.
samplesintegerNumber of images to generate, optional for all tasks.
seedintegerRandom noise seed, optional for all tasks.
stepsintegerNumber of diffusion steps to run, optional for all tasks.
style_presetstringTo guide the image model towards a particular style, optional for all tasks.
weightsarray[number]Weights for each of the prompts in texts, optional for all tasks.
heightintegerHeight of the output image, optional.
widthintegerWidth of the output image, optional.
init_image_modestringWhether to use image_strength or step_schedule, optional.
image_strengthnumberHow much influence the init_image has on the diffusion process, optional.
OutputTypeDescription
imagesarray[image]This will contain the output images as base64 encoded string.
seedsarray[integer]This will contain the seeds for output images.

#Example

Example input and output data for each task:

TASK_TEXT_TO_IMAGE
TASK_IMAGE_TO_IMAGE
Copy

// Input
{
"prompts": ["A blue cat bakes a birthday cake"],
"cfg_scale": 7.0,
"clip_guidance_preset": "SLOWER",
"samples": 3,
"style_preset": "cinematic",
"weights": [0.5, 0.7],
"height": 512,
"width": 512
}
// Output
{
"images": ["<base64-encoded image>"],
"seeds": [1769541116]
}

Last updated: 1/15/2024, 2:25:21 PM