Image-to-image with prompt
Produce an image from an existing image using a text prompt.
How to control strength of generation
To preserve only roughly 35% of the initial image, pass in either init_image_mode=IMAGE_STRENGTH and image_strength=0.35 or init_image_mode=STEP_SCHEDULE and step_schedule_start=0.65. Both of these are equivalent, however init_image_mode=STEP_SCHEDULE also lets you pass in step_schedule_end, which can provide an extra level of control for those who need it. For more details, see the specific fields below.
NOTE: Only Version 1 engines will work with this endpoint.
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
- Option 1
- Option 2
Represents the optional parameters that can be passed to any generation request.
An array of text prompts to use for generation.
Due to how arrays are represented in multipart/form-data requests, prompts must adhere to the format text_prompts[index][text|weight],
where index is some integer used to tie the text and weight together. While index does not have to be sequential, duplicate entries
will override previous entries, so it is recommended to use sequential indices.
Given a text prompt with the text A lighthouse on a cliff and a weight of 0.5, it would be represented as:
To add another prompt to that request simply provide the values under a new index:
1Image used to initialize the diffusion process, in lieu of random noise.
Whether to use image_strength or step_schedule_* to control how much influence the init_image has on the result.
IMAGE_STRENGTH, STEP_SCHEDULE How much influence the init_image has on the diffusion process. Values close to 1 will yield images very similar to the init_image while values close to 0 will yield images wildly different than the init_image. The behavior of this is meant to mirror DreamStudio's "Image Strength" slider.
This parameter is just an alternate way to set step_schedule_start, which is done via the calculation 1 - image_strength. For example, passing in an Image Strength of 35% (0.35) would result in a step_schedule_start of 0.65.
0 <= x <= 10.4
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.
Skips a proportion of the start of the diffusion steps, allowing the init_image to influence the final generated image. Lower values will result in more influence from the init_image, while higher values will result in more influence from the diffusion steps. (e.g. a value of 0 would simply return you the init_image, where a value of 1 would return you a completely different image.)
0 <= x <= 10.4
Skips a proportion of the end of the diffusion steps, allowing the init_image to influence the final generated image. Lower values will result in more influence from the init_image, while higher values will result in more influence from the diffusion steps.
0 <= x <= 10.01
Response
Generation successful.
An array of results from the generation request, where each image is a base64 encoded PNG.