Skip to main content
POST
Stable Diffusion 3

请求头

authorization
string
必填

Your Stability API key, used to authenticate your requests. Although you may have multiple keys in your account, you should use the same key for all requests to this API.

Minimum string length: 1
content-type
string
必填

The content type of the request body. Do not manually specify this header; your HTTP client library will automatically include the appropriate boundary parameter.

Minimum string length: 1
示例:

"multipart/form-data"

accept
enum<string>
默认值:image/*
必填

Specify image/* to get the image bytes directly. Otherwise specify application/json to receive the image as base64 encoded JSON.

可用选项:
application/json,
image/*

请求体

multipart/form-data
prompt
string
必填

What you wish to see in the output image. A strong, descriptive prompt that clearly defines elements, colors, and subjects will lead to better results.

Required string length: 1 - 10000
示例:

""

mode
enum<string>
默认值:text-to-image

Controls whether this is a text-to-image or image-to-image generation, which affects which parameters are required:

  • text-to-image requires only the prompt parameter
  • image-to-image requires the prompt, image, and strength parameters
可用选项:
image-to-image,
text-to-image
示例:

"text-to-image"

image
file

The image to use as the starting point for the generation.

Supported formats:

  • jpeg
  • png
  • webp

Supported dimensions:

  • Every side must be at least 64 pixels

Important: This parameter is only valid for image-to-image requests.

strength
number

Sometimes referred to as denoising, this parameter controls how much influence the image parameter has on the generated image. A value of 0 would yield an image that is identical to the input. A value of 1 would be as if you passed in no image at all.

Important: This parameter is only valid for image-to-image requests.

必填范围: 0 <= x <= 1
示例:

""

aspect_ratio
enum<string>
默认值:1:1

Controls the aspect ratio of the generated image. Defaults to 1:1.

Important: This parameter is only valid for text-to-image requests.

可用选项:
16:9,
1:1,
21:9,
2:3,
3:2,
4:5,
5:4,
9:16,
9:21
示例:

"1:1"

model
enum<string>
默认值:sd3-large

The model to use for generation.

  • sd3-medium requires 3.5 credits per generation
  • sd3-large requires 6.5 credits per generation
  • sd3-large-turbo requires 4 credits per generation
可用选项:
sd3-large,
sd3-large-turbo,
sd3-medium
示例:

"sd3-large"

seed
number
默认值:0

A specific value that is used to guide the 'randomness' of the generation. (Omit this parameter or pass 0 to use a random seed.)

必填范围: 0 <= x <= 4294967294
示例:

""

output_format
enum<string>
默认值:png

Dictates the content-type of the generated image.

可用选项:
jpeg,
png
示例:

"png"

negative_prompt
string

Keywords of what you do not wish to see in the output image. This is an advanced feature.

Important: This parameter does not work with sd3-large-turbo.

Maximum string length: 10000
示例:

""

响应

图片生成成功。返回格式由请求中的 Accept 头决定。

The response is of type file.