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-upscale-fast (Fast Upscaler) Official Docs Quadruple the image resolution with predictive and generative AI. The service is lightweight and fast (processing time is about 1 second), which is very suitable for improving the quality of compressed images for social media publishing and other application scenarios.

  • sd-upscale-conservative (Conservative) Official Docs It can enlarge images with resolutions between 64x64 and 1 megapixel to 4K resolution. More generally, it can enlarge the image about 20-40 times while preserving all the details. This method minimizes changes to the image and is not suitable for image reconstruction.

  • sd-erase (Erase) Official Docs Removes unnecessary objects, such as blemishes in portraits or items on the desktop, by using image masks.

  • sd-inpaint (Inpaint) Official Docs Intelligently modify the image by filling or replacing the specified area with new content according to the content of the mask image.

  • sd-outpaint (Outpaint) Official Docs Fill space by inserting additional content in any direction of the image. Compared with other automatic or manual image content expansion methods, this service minimizes the traces of artifacts and the original image being edited.

  • sd-search-and-replace (Search and Replace) Official Docs This service is a specific version of repair technology that does not require the use of mask. Instead, users can describe the object to be replaced in simple language through search_prompt. The service automatically segments the object and replaces it with the requested content in the prompt.

  • sd-search-and-recolor (Search and Recolor) Official Docs This service allows you to change the color of specific objects in an image through prompts. This service is a specific repair technology version that does not require masking. The service automatically segments the object and recolors it according to the color requested in the prompt.

  • sd-remove-background (Remove Background) Official Docs This service can accurately segment the foreground from the image and remove the background.

  • sd-sketch (Sketch) Official Docs This service provides an ideal solution for design projects that require brainstorming and frequent iteration. It refines rough hand-drawn sketches into detailed outputs with precise control. For non-sketch images, it utilizes contours and edges to allow precise adjustments to the final appearance.

  • sd-structure (Structure) Official Docs This service excels at image generation by preserving the structure of the input image, making it especially valuable for advanced content creation, such as recreating scenes or rendering characters from models.

  • sd-style (Style) Official Docs The service extracts style elements from the input (control) image and uses them to guide the output image generation based on prompts. The result is a new image that matches the style of the control image.

2. Request Description

  • Request method: POST

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

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

sd-upscale-fast

image

string

(binary)

Yes

An image used as the starting point for generation.

Note

For other required or optional parameters, refer to the official documentation link in the Overview.

4. Request Example

curl https://gateway.theturbo.ai/v1/images/generations \
	-H "Accept: image/*" \
	-H "Authorization: Bearer $YOUR_API_KEY" \
	-F model="sd-upscale-fast" \
	-F image="@input.png" \
	-F ... Other parameters

5. Response Example

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

Image binary file

Last updated