How to use Stable Diffusion 3 API

8,348 views
Updated Categorized as Tutorial Tagged , 7 Comments on How to use Stable Diffusion 3 API

Stable Diffusion 3 is the latest text-to-image model by Stability AI. It promises to outperform previous models like Stable Cascade and Stable Diffusion XL in text generation and prompt following.

The model is widely anticipated and is now available through their API.

In this post, I will walk you through two options to use Stable Diffusion 3 API.

  • Colab notebook
  • ComfyUI

I will also share my first impression of the model.

Use SD3 API with Google Colab

Step 1: Create an account

Create an account on Stability AI Developer platform.

Step 2: Add credits

A new account should have come with some free credits when you sign up. Add more credits on the billing page.

Each image generation consumes credits. See the pricing page for credit usage for each image.

Step 3: Create an API key

Create an API key on your account’s API keys page. You can create a new one or use an existing one.

Copy the API key.

Step 4: Generate images

Open this Colab notebook.

Run the notebook by clicking the play button on the left next to the prompt.

Paste your API key and press Enter when prompted.

You should get an image generated with Stable Diffusion 3.

Rerun the cell to generate a new image.

When you are done, don’t forget to click Disconnect and delete runtime.

Use SD3 API with ComfyUI

Stability AI has an official ComfyUI node that uses its API.

Step 1: Install ComfyUI Manager

Install ComfyUI Manager (Instructions).

Step 2: Install the SAI API node

In ComfyUI, click Manager > Install Custom Nodes.

Search for “stability API”.

Find the node “Stability API nodes for ComfyUI“. Click the Install button on the right to install the node.

A Restart button should appear. Click Restart to restart ComfyUI.

Step 3: Define system-wide API key (optional but recommended)

You can define an Stability AI API key for every nodes in the Stability AI custom node. This saves you the trouble from entering the API key in each workflow, or accidentially sharing your API key when you share your workflow JSON file.

Go to the custom node’s folder: ComfyUI_windows_portable > ComfyUI > custom_nodes > ComfyUI-SAI_API.

Create a file called sai_platform_key.txt

Copy and paste your API key from here to the file.

Save the file.

Restart ComfyUI.

Step 4: Load and run the workflow

Download the Stable Diffusion 3 text-to-image workflow below.

Drop in the ComfyUI.

Additional resources

Here’s the image-to-image workflow.

Sample images

Here are a few images testing its text generation capability. Text generation is definitely the best among all Stable Diffusion models, although it still makes mistakes.

See the Stable Diffusion 3 Review for a detailed comparison against Stable Diffusion XL and Stable Cascade models.

Hands are still problematic, unfortunately.

Prompt following is a bit better than SDXL, but it still lags DALLE3.

A top view of a river like double helix DNA

The word bread made of bread

Avatar

By Andrew

Andrew is an experienced engineer with a specialization in Machine Learning and Artificial Intelligence. He is passionate about programming, art, photography, and education. He has a Ph.D. in engineering.

7 comments

  1. I am sorry, not sure why so much was hype about SD3. It is still very bad with 2 people in one image. Tried creating images with a superman and spiderman fighting, it is just as bad as it was earlier. I appreciate who contributed to this project, but it is nowhere near to DALLE3 and also, the fact that we can’t run it locally is a big bummer. If this is the way Stable Diffusion 3 can be accessed, then I would still be preferring SDXL over it on any day. DALLE3 generations are still free at least 15 for a day. Thanks for your tutorial, you are always wonderful.

      1. Wow! Could you please elaborate, that point got glossed over. Thus far, we have been able to use all models free of charge. Is the direction going forward is pay or Stable Diffusion can’t be used to create art. Will the support stop for earlier models?

        1. They said they are going to release SD3 when its ready, but the licensing unlikely to be commercial use. It won’t affect someone who are using it for fun and post on social media. At that time, we can generate images for free.

          The earlier models are already released under a permissive license. They can’t take them back.

  2. I love your work, but, come on, I was hoping for a more complete review. well, I’ll wait a week. until then.

Leave a comment

Your email address will not be published. Required fields are marked *