Stability.Ai
  1. generation
Stability.Ai
  • Getting Started
  • v1
    • user
      • account
      • balance
    • engines
      • list
    • generation
      • text-to-image
        POST
      • image-to-image
        POST
      • image-to-image/upscale
        POST
      • image-to-image/masking
        POST
  • v2alpha
    • generation
      • image-to-video
      • image-to-video/result
      • stable-image/upscale
      • stable-image/upscale/result
      • stable-image/inpaint
  • Schemas
    • Schemas
      • Engine
      • Error
      • CfgScale
      • ClipGuidancePreset
      • UpscaleImageHeight
      • UpscaleImageWidth
      • DiffuseImageHeight
      • DiffuseImageWidth
      • Sampler
      • Samples
      • Seed
      • Steps
      • Extras
      • StylePreset
      • TextPrompt
      • TextPrompts
      • TextPrompts
      • InputImage
      • InitImage
      • InitImageStrength
      • InitImageMode
      • StepScheduleStart
      • StepScheduleEnd
      • MaskImage
      • MaskSource
      • GenerationRequestOptionalParams
      • RealESRGANUpscaleRequestBody
      • LatentUpscalerUpscaleRequestBody
      • ImageToImageRequestBody
      • ImageToImageUsingImageStrengthRequestBody
      • ImageToImageUsingStepScheduleRequestBody
      • MaskingRequestBody
      • MaskingUsingMaskImageRequestBody
      • MaskingUsingInitImageAlphaRequestBody
      • TextToImageRequestBody
      • AccountResponseBody
      • BalanceResponseBody
      • ListEnginesResponseBody
      • FinishReason
      • Image
      • OrganizationMembership
      • GenerationID
      • ImageToVideoRequest
      • ContentModerationResponse
      • InpaintingSearchModeRequestBody
      • InpaintingMaskingModeRequestBody
    • Response
      • 401
      • 403
      • 404
      • 500
      • GenerationResponse
      • 400FromGeneration
      • 400FromUpscale
  1. generation

text-to-image

https://api.stability.ai
https://api.stability.ai
https://api.stability.ai
https://api.stability.ai
POST
/v1/generation/{engine_id}/text-to-image
Generate a new image from a text prompt

Request

Path Params

Header Params

Body Params application/json

Examples

Responses

🟢200Success
application/json
Body

🟠400400
🟠401401
🟠403403
🟠404404
🔴500500
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image' \
--header 'Content-Type: application/json' \
--data-raw '{
    "cfg_scale": 7,
    "clip_guidance_preset": "FAST_BLUE",
    "height": 512,
    "width": 512,
    "sampler": "K_DPM_2_ANCESTRAL",
    "samples": 1,
    "steps": 30,
    "text_prompts": [
        {
            "text": "A lighthouse on a cliff",
            "weight": 1
        }
    ]
}'
Response Response Example
200 - Example 1
{
    "artifacts": [
        [
            {
                "base64": "...very long string...",
                "finishReason": "SUCCESS",
                "seed": 1050625087
            },
            {
                "base64": "...very long string...",
                "finishReason": "CONTENT_FILTERED",
                "seed": 1229191277
            }
        ]
    ]
}
Modified at 2024-03-11 07:12:09
Previous
list
Next
image-to-image
Built with