Skip to main content
StabilityAI logo

StabilityAI

Overview

Stability AI is an advanced artificial intelligence platform designed to empower organizations with cutting-edge generative technologies and tools. Focused on creating robust AI models, Stability AI enables users to develop innovative applications across various domains, from content generation to data analysis, enhancing operational efficiency and creativity.

Setting up StabilityAI

Create an access token

To get started you'll need a StabilityAI API key. To create an API key:

  1. Log in to Stability
  2. Go to API Keys
  3. Copy the API key to configure your integration's connection

Add integration

Once you have an access token, you're ready to set up your Superblocks integration.

  1. In the web app, navigate to the Integrations page
  2. Click on the StabilityAI tile
  3. Name the integration
  4. Paste your credentials into the relevant fields
  5. Optionally, add more configurations to set credentials for different environments
  6. Click Create
success

StabilityAI connected Now you can use StabilityAI in any Application, Workflow, or Scheduled Job.

Use StabilityAI in APIs

Once your StabilityAI integration is created, you can start calling StabilityAI actions in Superblocks APIs.

StabilityAI actions are REST requests. To learn more about REST requests in Superblocks, see the Building REST requests guide.

Certain StabilityAI actions support streaming. Learn more about building APIs in Superblocks that

stream data from REST APIs

.

Supported actions

Start generation

Generate a short video based on an initial image with [Stable Video Diffusion](https://static1.squarespace.com/static/6213c340453c3f502425776e/t/655ce779b9d47d342a93c890/1700587395994/stable_video_diffusion.pdf), a latent video diffusion model. ### How to use Please invoke this endpoint with a `POST` request. The headers of the request must include an API key in the `authorization` field. The body of the request must be `multipart/form-data`. The body of the request should include: - `image` The body may optionally include: - `seed` - `cfg_scale` - `motion_bucket_id` > **Note:** for more details about these parameters please see the request schema below. After invoking this endpoint with the required parameters, use the `id` in the response to poll for results at the [image-to-video/result/{id}](#tag/Image-to-Video/paths/~1v2beta~1image-to-video~1result~1%7Bid%7D/get) endpoint. Rate-limiting or other errors may occur if you poll more than once every 10 seconds. ### Credits Flat rate of 20 credits per successful generation. You will not be charged for failed generations.

Fetch generation result

Fetch the result of an image-to-video generation by ID. Make sure to use the same API key to fetch the generation result that you used to create the generation, otherwise you will receive a `404` response. ### How to use Please invoke this endpoint with a `GET` request. The headers of the request must include an API key in the `authorization` field and the ID of your generation must be in the path. ### How is progress reported? Your generation is either `in-progress` (i.e. status code `202`) or it is complete (i.e. status code `200`). We may add more fine-grained progress reporting in the future (e.g. a numerical progress). ### How long are results stored? Results are stored for 24 hours after generation. After that, the results are deleted and you will need to re-generate your video.

Stable Image Ultra

Our most advanced text to image generation service, Stable Image Ultra creates the highest quality images with unprecedented prompt understanding. Ultra excels in typography, complex compositions, dynamic lighting, vibrant hues, and overall cohesion and structure of an art piece. Made from the most advanced models, including Stable Diffusion 3, Ultra offers the best of the Stable Diffusion ecosystem. ### Try it out Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=yXhs626oZdr1) ### How to use Please invoke this endpoint with a `POST` request. The headers of the request must include an API key in the `authorization` field. The body of the request must be `multipart/form-data`. The accept header should be set to one of the following: - `image/*` to receive the image in the format specified by the `output_format` parameter. - `application/json` to receive the image in the format specified by the `output_format` parameter, but encoded to base64 in a JSON response. The only required parameter is the `prompt` field, which should contain the text prompt for the image generation. > **Note:** for the full list of optional parameters, please see the request schema below. ### Output The resolution of the generated image will be 1 megapixel. The default resolution is 1024x1024. ### Credits The Ultra service uses 8 credits per successful result. You will not be charged for failed results.

Stable Image Core

Our primary service for text-to-image generation, Stable Image Core represents the best quality achievable at high speed. No prompt engineering is required! Try asking for a style, a scene, or a character, and see what you get. ### Try it out Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=yXhs626oZdr1) ### How to use Please invoke this endpoint with a `POST` request. The headers of the request must include an API key in the `authorization` field. The body of the request must be `multipart/form-data`, and the `accept` header should be set to one of the following: - `image/*` to receive the image in the format specified by the `output_format` parameter. - `application/json` to receive the image encoded as base64 in a JSON response. The body of the request should include: - `prompt` The body may optionally include: - `aspect_ratio` - `negative_prompt` - `seed` - `style_preset` - `output_format` > **Note:** for more details about these parameters please see the request schema below. ### Output The resolution of the generated image will be 1.5 megapixels. ### Credits Flat rate of 3 credits per successful generation. You will not be charged for failed generations.

Stable Diffusion 3

Generate an image using a Stable Diffusion 3 model: - SD3 Medium - the 2 billion parameter model - SD3 Large - the 8 billion parameter model - SD3 Large Turbo - the 8 billion parameter model with a faster inference time This API is powered by [Fireworks AI](https://fireworks.ai/). API status can be reviewed [here](https://readme.fireworks.ai/page/application-status). ### Try it out Grab your [API key](https://platform.stability.ai/account/keys) and head over to one of the following sites: - [![Open Fireworks Playground](https://platform.stability.ai/svg/fireworks.svg)](https://fireworks.ai/models/stability/sd3) - [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/SD3_API.ipynb) ### How to use Please invoke this endpoint with a `POST` request. The headers of the request must include an API key in the `authorization` field. The body of the request must be `multipart/form-data`. The accept header should be set to one of the following: - `image/*` to receive the image in the format specified by the `output_format` parameter. - `application/json` to receive the image encoded as base64 in a JSON response. #### **Generating with a prompt** Commonly referred to as **text-to-image**, this mode generates an image from text alone. While the only required parameter is the `prompt`, it also supports an `aspect_ratio` parameter which can be used to control the aspect ratio of the generated image. #### **Generating with a prompt *and* an image** Commonly referred to as **image-to-image**, this mode also generates an image from text but uses an existing image as the starting point. The required parameters are: - `prompt` - text to generate the image from - `image` - the image to use as the starting point for the generation - `strength` - controls how much influence the `image` parameter has on the output image - `mode` - must be set to `image-to-image` > **Note:** maximum request size is 10MiB. #### **Optional Parameters:** Both modes support the following optional parameters: - `model` - the model to use (SD3 Medium, SD3 Large, or SD3 Large Turbo) - `output_format` - the the format of the output image - `seed` - the randomness seed to use for the generation - `negative_prompt` - keywords of what you **do not** wish to see in the output image > **Note:** for more details about these parameters please see the request schema below. ### Output The resolution of the generated image will be 1MP. The default resolution is 1024x1024. ### Credits - SD3 Medium: Flat rate of 3.5 credits per successful generation. - SD3 Large: Flat rate of 6.5 credits per successful generation. - SD3 Large Turbo: Flat rate of 4 credits per successful generation. As always, you will not be charged for failed generations.

Conservative

Takes images between 64x64 and 1 megapixel and upscales them all the way to 4K resolution. Put more generally, it can upscale images ~20-40x times while preserving all aspects. Conservative Upscale minimizes alterations to the image and should not be used to reimagine an image. ### Try it out Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=t1Q4w2uvvza0) ### How to use Please invoke this endpoint with a `POST` request. The headers of the request must include an API key in the `authorization` field. The body of the request must be `multipart/form-data`, and the `accept` header should be set to one of the following: - `image/*` to receive the image in the format specified by the `output_format` parameter. - `application/json` to receive the image encoded as base64 in a JSON response. The body of the request must include: - `image` - `prompt` Optionally, the body of the request may also include: - `negative_prompt` - `seed` - `output_format` - `creativity` > **Note:** for more details about these parameters please see the request schema below. ### Output The resolution of the generated image will be 4 megapixels. ### Credits Flat rate of 25 credits per successful generation. You will not be charged for failed generations.

Start Creative Upscale

Takes images between 64x64 and 1 megapixel and upscales them all the way to **4K** resolution. Put more generally, it can upscale images ~20-40x times while preserving, and often enhancing, quality. Creative Upscale **works best on highly degraded images and is not for photos of 1mp or above** as it performs heavy reimagining (controlled by creativity scale). ### Try it out Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=QXxi9tfI425t) ### How to use Please invoke this endpoint with a `POST` request. The headers of the request must include an API key in the `authorization` field. The body of the request must be `multipart/form-data`. The body of the request should include: - `image` - `prompt` The body may optionally include: - `seed` - `negative_prompt` - `output_format` - `creativity` > **Note:** for more details about these parameters please see the request schema below. After invoking this endpoint with the required parameters, use the `id` in the response to poll for results at the [upscale/result/{id}](#tag/Upscale/paths/~1v2beta~1stable-image~1upscale~1creative~1result~1%7Bid%7D/get) endpoint. Rate-limiting or other errors may occur if you poll more than once every 10 seconds. ### Credits Flat rate of 25 credits per successful generation. You will not be charged for failed generations.

Fetch Creative Upscale result

Fetch the result of an upscale generation by ID. Make sure to use the same API key to fetch the generation result that you used to create the generation, otherwise you will receive a `404` response. ### How to use Please invoke this endpoint with a `GET` request. The headers of the request must include an API key in the `authorization` field and the ID of your generation must be in the path. ### How is progress reported? Your generation is either `in-progress` (i.e. status code `202`) or it is complete (i.e. status code `200`). We may add more fine-grained progress reporting in the future (e.g. a numerical progress). ### How long are results stored? Results are stored for 24 hours after generation. After that, the results are deleted.

Erase

The Erase service removes unwanted objects, such as blemishes on portraits or items on desks, using image masks. The mask is provided in one of two ways: 1. Explicitly passing in a separate image via the `mask` parameter 2. Derived from the alpha channel of the `image` parameter. ### Try it out Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=t1Q4w2uvvza0) ### How to use Please invoke this endpoint with a `POST` request. The headers of the request must include an API key in the `authorization` field. The body of the request must be `multipart/form-data`, and the `accept` header should be set to one of the following: - `image/*` to receive the image in the format specified by the `output_format` parameter. - `application/json` to receive the image encoded as base64 in a JSON response. The body of the request must include: - `image` Optionally, the body of the request may also include: - `mask` - `seed` - `output_format` > **Note:** for more details about these parameters please see the request schema below. ### Output The resolution of the generated image will be 4 megapixels. ### Credits Flat rate of 3 credits per successful generation. You will not be charged for failed generations.

Inpaint

Intelligently modify images by filling in or replacing specified areas with new content based on the content of a "mask" image. The "mask" is provided in one of two ways: 1. Explicitly passing in a separate image via the `mask` parameter 2. Derived from the alpha channel of the `image` parameter. ### Try it out Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=t1Q4w2uvvza0) ### How to use Please invoke this endpoint with a `POST` request. The headers of the request must include an API key in the `authorization` field. The body of the request must be `multipart/form-data`, and the `accept` header should be set to one of the following: - `image/*` to receive the image in the format specified by the `output_format` parameter. - `application/json` to receive the image encoded as base64 in a JSON response. The body of the request must include: - `image` - `prompt` Optionally, the body of the request may also include: - `mask` - `negative_prompt` - `seed` - `output_format` > **Note:** for more details about these parameters please see the request schema below. ### Output The resolution of the generated image will be 4 megapixels. ### Credits Flat rate of 3 credits per successful generation. You will not be charged for failed generations.

Outpaint

The Outpaint service inserts additional content in an image to fill in the space in any direction. Compared to other automated or manual attempts to expand the content in an image, the Outpaint service should minimize artifacts and signs that the original image has been edited. ### Try it out Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=bZ2yK7VQSgLw) ### How to use Please invoke this endpoint with a POST request. The headers of the request must include an API key in the `authorization` field. The body of the request must be `multipart/form-data`, and the `accept` header should be set to one of the following: - `image/*` to receive the image in the format specified by the `output_format` parameter. - `application/json` to receive the image encoded as base64 in a JSON response. The body of the request must include: - `image` Along with _at least one_ outpaint direction: - `left` - `right` - `up` - `down` > **Note:** for best quality use outpaint direction values smaller or equal to your source image dimensions. Each of these parameters should be set to a number between 0 and 2000, representing the number of pixels to outpaint in that direction. Optionally, the body of the request may also include: - `prompt` - `seed` - `output_format` - `creativity` > **Note:** for more details about these parameters please see the request schema below. ### Credits Flat rate of 4 credits per successful generation. You will not be charged for failed generations.

Search and Replace

The Search and Replace service is a specific version of inpainting that does not require a mask. Instead, users can leverage a `search_prompt` to identify an object in simple language to be replaced. The service will automatically segment the object and replace it with the object requested in the prompt. ### Try it out Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=0lDpGa2jAmAs) ### How to use Please invoke this endpoint with a `POST` request. The headers of the request must include an API key in the `authorization` field. The body of the request must be `multipart/form-data`, and the `accept` header should be set to one of the following: - `image/*` to receive the image in the format specified by the `output_format` parameter. - `application/json` to receive the image encoded as base64 in a JSON response. The body of the request should include: - `image` - `prompt` - `search_prompt` The body may optionally include: - `seed` - `negative_prompt` - `output_format` > **Note:** for more details about these parameters please see the request schema below. ### Output The resolution of the generated image will be 4 megapixels. ### Credits Flat rate of 4 credits per successful generation. You will not be charged for failed generations.

Remove Background

The Remove Background service accurately segments the foreground from an image and implements and removes the background. ### Try it out Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=VHofb3LAVmqi) ### How to use Please invoke this endpoint with a `POST` request. The headers of the request must include an API key in the `authorization` field. The body of the request must be `multipart/form-data`, and the `accept` header should be set to one of the following: - `image/*` to receive the image in the format specified by the `output_format` parameter. - `application/json` to receive the image encoded as base64 in a JSON response. The body of the request must include: - `image` Optionally, the body of the request may also include: - `output_format` > **Note:** for more details about these parameters please see the request schema below. ### Credits Flat rate of 2 credits per successful generation. You will not be charged for failed generations.

Sketch

This service offers an ideal solution for design projects that require brainstorming and frequent iterations. It upgrades rough hand-drawn sketches to refined outputs with precise control. For non-sketch images, it allows detailed manipulation of the final appearance by leveraging the contour lines and edges within the image. ### Try it out Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=ZKIAqHzJzzUo) ### How to use Please invoke this endpoint with a `POST` request. The headers of the request must include an API key in the `authorization` field. The body of the request must be `multipart/form-data`, and the `accept` header should be set to one of the following: - `image/*` to receive the image in the format specified by the `output_format` parameter. - `application/json` to receive the image encoded as base64 in a JSON response. The body of the request should include: - `image` - `prompt` The body may optionally include: - `control_strength` - `negative_prompt` - `seed` - `output_format` > **Note:** for more details about these parameters please see the request schema below. ### Output The resolution of the generated image will match that of the input image. ### Credits Flat rate of 3 credits per successful generation. You will not be charged for failed generations.

Structure

This service excels in generating images by maintaining the structure of an input image, making it especially valuable for advanced content creation scenarios such as recreating scenes or rendering characters from models. ### Try it out Grab your [API key](https://platform.stability.ai/account/keys) and head over to [![Open Google Colab](https://platform.stability.ai/svg/google-colab.svg)](https://colab.research.google.com/github/stability-ai/stability-sdk/blob/main/nbs/Stable_Image_API_Public.ipynb#scrollTo=59RaZazXz0AU) ### How to use Please invoke this endpoint with a `POST` request. The headers of the request must include an API key in the `authorization` field. The body of the request must be `multipart/form-data`, and the `accept` header should be set to one of the following: - `image/*` to receive the image in the format specified by the `output_format` parameter. - `application/json` to receive the image encoded as base64 in a JSON response. The body of the request should include: - `image` - `prompt` The body may optionally include: - `control_strength` - `negative_prompt` - `seed` - `output_format` > **Note:** for more details about these parameters please see the request schema below. ### Output The resolution of the generated image will match that of the input image. ### Credits Flat rate of 3 credits per successful generation. You will not be charged for failed generations.

Text-to-image

Generate an image from a text prompt. ### Using SDXL 1.0 Use `stable-diffusion-xl-1024-v1-0` as the `engine_id` of your request and pass in `height` & `width` as one of the following combinations: - 1024x1024 - 1152x896 - 896x1152 - 1216x832 - 1344x768 - 768x1344 - 1536x640 - 640x1536. ### Using SD 1.6 Pass in `stable-diffusion-v1-6` as the `engine_id` of your request and ensure the `height` & `width` you pass in adhere to the following restrictions: - No dimension can be less than 320 pixels - No dimension can be greater than 1536 pixels ### Using SD Beta Pass in `stable-diffusion-xl-beta-v2-2-2` as the `engine_id` of your request and ensure the `height` & `width` you pass in adhere to the following restrictions: - dimensions must be between 128x128 and 512x896 (or 896x512) - only one dimension can be greater than 512, but not both > NOTE: Only **Version 1** engines will work with this endpoint.

Image-to-image with prompt

Produce an image from an existing image using a text prompt. ### How to control strength of generation To preserve only roughly 35% of the initial image, pass in either `init_image_mode=IMAGE_STRENGTH` and `image_strength=0.35` or `init_image_mode=STEP_SCHEDULE` and `step_schedule_start=0.65`. Both of these are equivalent, however `init_image_mode=STEP_SCHEDULE` also lets you pass in `step_schedule_end`, which can provide an extra level of control for those who need it. For more details, see the specific fields below. > NOTE: Only **Version 1** engines will work with this endpoint.

Image-to-image with a mask

Selectively modify portions of an image using a mask. The `mask` must be the same shape and size as the init image. This endpoint also supports `image` parameters with alpha channels. See below for more details. > NOTE: Only **Version 1** engines will work with this endpoint.

Image-to-image upscale

Create a higher resolution version of an input image. This operation outputs an image with a maximum pixel count of **4,194,304**. This is equivalent to dimensions such as `2048x2048` and `4096x1024`. By default, the input image will be upscaled by a factor of 2. For additional control over the output dimensions, a `width` or `height` parameter may be specified.

List engines

List all engines available to your organization/user

Account details

Get information about the account associated with the provided API key

Account balance

Get the credit balance of the account/organization associated with the API key
and 7 more

Generic HTTP Request

Every SaaS integration in Superblocks comes with a built in Generic HTTP Request Action. This is a powerful action you can use to call StabilityAI API endpoints not in the Superblocks supported actions.

To use this action simply add the method, path, required query parameters, and body for the desired endpoint.

info

Learn more about REST requests in Superblocks in our Building REST requests guide.

Generic HTTP Requests use the authentication set up and base URL you've configured for your integration, making it an easy for your team to extend Superblocks Integrations to meet their needs.