Skip to main content
The gRPC API is in legacy maintenance mode and won’t receive new features. For new projects, use the REST v2beta API.
One of the core foundations of our API is the ability to generate images. Check out the examples below to learn how to execute a basic image generation call via our gRPC API.
Try it out live by clicking the link below to open the notebook in Google Colab!Open In Colab

1. Install the Stability SDK package…

2. Import our dependencies and set up our environment variables and API Key…

3. Establish our connection to the API…

4. Set up initial generation parameters, save image on generation, and warn if the safety filter is tripped…

Resulting image written to <seed>.png:

Generated image.Note: This is not representative of all of the parameters available for image generation.Please check out our protobuf reference for a complete list of parameters available for image generation.