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 (default)
- 1152x896
- 896x1152
- 1216x832
- 1344x768
- 768x1344
- 1536x640
- 640x1536
SDXL 1.0 Pricing
When specifying 30 steps or fewer, generation costs 0.9 credits.
When specifying above 30 steps, generation cost is determined using the following formula:
cost = 0.9 * (steps / 30)
Authorizations
Your Stability API key, sent as a bearer token in the Authorization header.
Headers
The format of the response. Leave blank for JSON, or set to 'image/png' for a PNG image.
application/json, image/png Allows for requests to be scoped to an organization other than the user's default. If not provided, the user's default organization will be used.
Used to identify the source of requests, such as the client application or sub-organization. Optional, but recommended for organizational clarity.
Used to identify the version of the application or service making the requests. Optional, but recommended for organizational clarity.
Path Parameters
Body
Represents the optional parameters that can be passed to any generation request.
An array of text prompts to use for generation.
Given a text prompt with the text A lighthouse on a cliff and a weight of 0.5, it would be represented as:
1Height of the image to generate, in pixels, in an increment divisible by 64.
x >= 128Must be a multiple of 64512
Width of the image to generate, in pixels, in an increment divisible by 64.
x >= 128Must be a multiple of 64512
How strictly the diffusion process adheres to the prompt text (higher values keep your image closer to your prompt)
0 <= x <= 357
FAST_BLUE, FAST_GREEN, NONE, SIMPLE, SLOW, SLOWER, SLOWEST "FAST_BLUE"
Which sampler to use for the diffusion process. If this value is omitted we'll automatically select an appropriate sampler for you.
DDIM, DDPM, K_DPMPP_2M, K_DPMPP_2S_ANCESTRAL, K_DPM_2, K_DPM_2_ANCESTRAL, K_EULER, K_EULER_ANCESTRAL, K_HEUN, K_LMS "K_DPM_2_ANCESTRAL"
Number of images to generate
1 <= x <= 101
Random noise seed (omit this option or use 0 for a random seed)
0 <= x <= 42949672950
Number of diffusion steps to run.
10 <= x <= 5050
Pass in a style preset to guide the image model towards a particular style. This list of style presets is subject to change.
enhance, anime, photographic, digital-art, comic-book, fantasy-art, line-art, analog-film, neon-punk, isometric, low-poly, origami, modeling-compound, cinematic, 3d-model, pixel-art, tile-texture Extra parameters passed to the engine. These parameters are used for in-development or experimental features and may change without warning, so please use with caution.
Response
Generation successful.
An array of results from the generation request, where each image is a base64 encoded PNG.