v1

latestOpenAPI 3.0.3raw.githubusercontent.com2023-03-2662235.2 KB
v1alpha/generation

text-to-image

Generate an image from text - deprecated, use v1beta/text-to-image instead

post/generation/{engine_id}/text-to-image

Path parameters

engine_idstring required
Example:stable-diffusion-512-v2-0

Headers

Accept'application/json' | 'image/png'
Example:application/json
Organizationstring

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.

Authorizationstring required

Request body

cfg_scalenumber

How strictly the diffusion process adheres to the prompt text (higher values keep your image closer to your prompt)

clip_guidance_preset'FAST_BLUE' | 'FAST_GREEN' | 'NONE' | 'SIMPLE' | 'SLOW' | 'SLOWER' | 'SLOWEST'
heightinteger

Width of the image in pixels. Must be in increments of 64 and pass the following validation:

  • For 768 engines: <span style='display: flex; justify-content: flex-start; gap:8px'>589,824 <span></span> height * width <span></span> 1,048,576</span>
  • All other engines: <span style='display: flex; justify-content: flex-start; gap:8px'>262,144 <span></span> height * width <span></span> 1,048,576</span>
widthinteger

Height of the image in pixels. Must be in increments of 64 and pass the following validation:

  • For 768 engines: <span style='display: flex; justify-content: flex-start; gap:8px'>589,824 <span></span> height * width <span></span> 1,048,576</span>
  • All other engines: <span style='display: flex; justify-content: flex-start; gap:8px'>262,144 <span></span> height * width <span></span> 1,048,576</span>
sampler'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'

Which sampler to use for the diffusion process. If this value is omitted we'll automatically select an appropriate sampler for you.

samplesinteger

Number of images to generate

seedinteger

Random noise seed (omit this option or use 0 for a random seed)

stepsinteger

Number of diffusion steps to run

Example request

{
  "cfg_scale": 7,
  "clip_guidance_preset": "FAST_BLUE",
  "height": 512,
  "sampler": "K_DPM_2_ANCESTRAL",
  "samples": 1,
  "seed": 0,
  "steps": 75,
  "text_prompts": [
    {
      "text": "A lighthouse on a cliff",
      "weight": 1
    }
  ],
  "width": 512
}

Response

OK response.

base64string

Image encoded in base64

finishReason'SUCCESS' | 'ERROR' | 'CONTENT_FILTERED'
seednumber

The seed associated with this image

Example response

[
  {
    "base64": "Sed corporis modi et.",
    "finishReason": "CONTENT_FILTERED",
    "seed": 1229191277
  }
]