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