Stability.ai

1. Overview

Stability.ai is a company focused on developing AI models. The company's flagship model is Stable Diffusion, which is an image generation model based on deep learning. It has garnered a lot of attention for its ability to generate high-quality images from text descriptions.

Note

The model in this series does not support Chinese very well. Try to use English for natural language descriptions.

Available model list:

  • sd-ultra

  • sd3-large

  • sd3.5-large

  • sd3-large-turbo

  • sd3.5-large-turbo

  • sd3-medium

  • sd3.5-medium

  • sd-core

2. Request Description

  • Request method: POST

  • Request address: https://gateway.theturbo.ai/v1/images/generations

3. Input Parameters

3.1 Header Parameters

Parameter Name
Type
Required
Description
Example Value

Content-Type

string

Yes

Set the request header type, which must be multipart/form-data

multipart/form-data; boundary=------------------------y0QNRDhXQUE3yHQi7DEbLz

Accept

string

Yes

Set the response type, which must be image/*

image/*

Authorization

string

Yes

API_KEY required for authentication. Format: Bearer $YOUR_API_KEY

Bearer $YOUR_API_KEY

3.2 Body Parameters (multipart/form-data)

Parameter Name
Type
Required
Description
Example (Default Value)

model

string

Yes

Model ID to use. See available models listed in the Overview for details, such as sd3-large.

sd3-large

prompt

string

Yes

A text describing the required image. The maximum description length is 10,000 characters.

A cute baby sea otter

mode

string

No

Confirm whether is text-to-image or image-to-image. text-to-image requires only prompt; image-to-image requires prompt, image and strength. sd-core does not support image-to-image.

text-to-image

image

string

(binary)

No

An image used as the starting point for generation. Only available for image-to-image. Supported formats: JPEG, PNG, WEBP. Supported dimensions: Each side must be at least 64 pixels.

strength

number

[0,1]

No

Sometimes referred to as denoising, this parameter controls the influence of the image parameters on the generated output. A value of 0 produces an output identical to the input image, while a value of 1 generates an image as if no input image was provided.

0.9

negative_prompt

string

No

Keywords for content you want to exclude from the output image. sd3-large-turbo does not support this parameter.

a cat

seed

number

[0,4294967294]

No

A specific value used to guide the randomness of generation. ( If this parameter is omitted or set to 0, a random seed will be used.)

0

aspect_ratio

string

No

Controls the aspect ratio of the generated image. Support 16:9, 1:1, 21:9, 2:3, 3:2, 4:5, 5:4, 9:16, and 9:21.

1:1

output_format

string

No

jpegorpng

png

style_preset

string

No

Guides the image model toward a specific style. Support 3d-model, analog-film, anime, cinematic, comic-book, digital-art, enhance, fantasy-art, isometric, line-art, low-poly, modeling-compound, neon-punk, origami, photographic, pixel-art, and tile-texture. Only sd-core support this parameter.

4. Request Example

text-to-image

curl https://gateway.theturbo.ai/v1/images/generations \
	-H "Accept: image/*" \
	-H "Authorization: Bearer $YOUR_API_KEY" \
	-F model="sd3-large" \
	-F prompt="A cute baby sea otter wearing a beret"

image-to-image

curl https://gateway.theturbo.ai/v1/images/generations \
	-H "Accept: image/*" \
	-H "Authorization: Bearer $YOUR_API_KEY" \
	-F model="sd3-large" \
	-F prompt="A cute baby sea otter wearing a beret" \
	-F mode="image-to-image" \
	-F image="@input.png" \
	-F strength=0.9 \

5. Response Example

HTTP/1.1 200 OK
Content-Type: image/png

Image binary file

Last updated