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.
When calling the gRPC API, prompt is the only required variable. Provided alone, this call will generate an image according to our default generation settings. The gRPC response will contain a finish_reason specifying the outcome of your request in addition to the delivered asset. If the finish_reason is filter, this means our safety filter has been activated and the resulting image will be blurred. This is by design. These calls can be assigned a variety of parameters, some of which have an effect on pricing, as detailed below.

Prompt

Accepts singular as well as multiple prompts with weights. See the Multi-prompting documentation for more information.

Height

Measured in pixels. Pixel limit is 1048576, so technically any dimension is allowable within that amount.

Width

Measured in pixels. Pixel limit is 1048576, so technically any dimension is allowable within that amount.

About Dimensions

A minimum of 262k pixels and a maximum of 1.04m pixels are recommended when generating images with 512px models, and a minimum of 589k pixels and a maximum of 1.04m pixels for 768px models. The true pixel limit is 1048576. To avoid the dreaded 6N IndexError it is advised to use 64px increments when choosing an aspect ratio. Popular ratio combinations for 512px models include 1536 x 512 and 1536 x 384, while 1536 x 640 and 1024 x 576 are recommended for 768px models. For 512px models, the minimum useful sizes are 192-256 in one dimension. For 768px models the minimum useful size is 384 in one dimension. Generating images under the recommended dimensions may result in undesirable artifacts.

Steps

Affects the number of diffusion steps performed on the requested generation.

Samples

Number of images to generate. Allows for batch image generations.

CFG Scale

Dictates how closely the engine attempts to match a generation to the provided prompt. v2-x models respond well to lower CFG (IE: 4-8), where as v1-x models respond well to a higher range (IE: 7-14) and SDXL models respond well to a wider range (IE: 4-12).

Engine

Engine (model) to use. Available engines: Note: The models below have special pricing considerations. For additional information please check out the Pricing page.
  • (SDXL) stable-diffusion-xl-1024-v0-9
  • (SDXL) stable-diffusion-xl-1024-v1-0
  • esrgan-v1-x2plus
Note: Engines in the list below are now deprecated and can no longer be accessed. Please use one of the models listed above.
  • stable-diffusion-v1
  • stable-diffusion-v1-5
  • stable-diffusion-512-v2-0
  • stable-diffusion-768-v2-0
  • stable-diffusion-512-v2-1
  • stable-diffusion-768-v2-1
  • stable-diffusion-xl-beta-v2-2-2
  • stable-inpainting-v1-0
  • stable-inpainting-512-v2-0
  • stable-diffusion-x4-latent-upscaler

Image Upscaler

Dictates the parameters sent to our image upscaling engine. Check out the examples on our Image Upscaling documentation to learn how to execute an image upscaling call via our gRPC API.

Sampler

Sampling engine to use. If no sampler is declared, an appropriate default sampler for the declared inference engine will be applied automatically. Available samplers:
  • ddim
  • plms
  • k_euler
  • k_euler_ancestral
  • k_heun
  • k_dpm_2
  • k_dpm_2_ancestral
  • k_dpmpp_2s_ancestral
  • k_dpmpp_2m
  • k_dpmpp_sde

Seed

Seed for random latent noise generation. Deterministic if not being used in concert with CLIP Guidance. If not specified, or set to 0, then a random value will be used.

Initial Image

Image used to initialize the diffusion process, in lieu of random noise.

Mask Image

Grayscale mask to exclude diffusion from some pixels. Must be the same dimensions as init_image.

Start Schedule

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.)

End Schedule

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.

CLIP Guidance

CLIP guidance preset, use with ancestral sampler for best results.

Prefix

SDK CLI switch for assigning artifact prefixes.

Store

SDK CLI switch indicating whether to write out artifacts.

Show

SDK CLI switch for opening artifacts using PIL. Note: This is a living page and may not be representative of all of the parameters currently available for image generation. Please check out our protobuf reference for a complete list of parameters available for image generation.