Managed Inference and Agent API with Stability AI Stable Image Ultra
Last updated January 24, 2025
This article is a work in progress, or documents a feature that is not yet released to all users. This article is unlisted. Only those with the link can access it.
Table of Contents
The Heroku Managed Inference and Agent add-on is currently in pilot. The products offered as part of the pilot aren’t intended for production use and are considered as a Beta Service and are subject to the Beta Services terms at https://www.salesforce.com/company/legal/agreements.jsp.
Stability AI Stable Image Ultra is a state-of-the-art image generation model designed to create high-quality, detailed images from text prompts. It offers improved resolution, finer details, and greater consistency compared to earlier versions.
- Model ID:
stability-image-ultra
- Region:
us
When to Use This Model
Stable Image Ultra is ideal for generating photorealistic images, concept art, and visual content based on text descriptions. It can be particularly useful for generating images for content like blog posts and marketing campaigns. Image generation models (including this one) are less well-suited for creating images with very specific properties. For example, current models struggle to generate images with very specific or consistent colors, numbers of objects, characters, layouts, or compositions.
Usage
Stable Image Ultra follows our Stability v1/images/generations API schema.
To provision access to the model, attach stability-image-ultra
to your app $APP_NAME
:
heroku ai:models:create -a $APP_NAME stability-image-ultra --as DIFFUSION
Using config variables, you can invoke stability-image-ultra
in multiple ways:
- Heroku CLI
ai
plugin (heroku ai:models:call
) - curl
- Python
- Ruby
- Javascript
Example curl Request
Get started quickly with an example request:
export DIFFUSION_MODEL_ID=$(heroku config:get -a $APP_NAME DIFFUSION_MODEL_ID)
export DIFFUSION_KEY=$(heroku config:get -a $APP_NAME DIFFUSION_KEY)
export DIFFUSION_URL=$(heroku config:get -a $APP_NAME DIFFUSION_URL)
curl $DIFFUSION_URL/v1/images/generations \
-H "Authorization: Bearer $DIFFUSION_KEY" \
-d @- <<EOF | jq -r '.data[0].b64_json' | base64 --decode > "x.png"
{
"model": "$DIFFUSION_MODEL_ID",
"prompt": "A surreal landscape with glowing mushrooms under a night sky.",
"aspect_ratio": "16:9",
"output_format": "png",
"seed": 12345,
"negative_prompt": "crowded, noisy, chaotic"
}
EOF
open x.png