curl --request POST \
--url https://api.maxapi.ai/sd/v2beta/stable-image/generate/core \
--header 'accept: <accept>' \
--header 'authorization: <authorization>' \
--header 'content-type: multipart/form-data' \
--form prompt=import requests
url = "https://api.maxapi.ai/sd/v2beta/stable-image/generate/core"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n\r\n-----011000010111000001101001--"
headers = {
"authorization": "<authorization>",
"content-type": "multipart/form-data",
"accept": "<accept>"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('prompt', '');
const options = {
method: 'POST',
headers: {authorization: '<authorization>', accept: '<accept>'}
};
options.body = form;
fetch('https://api.maxapi.ai/sd/v2beta/stable-image/generate/core', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.maxapi.ai/sd/v2beta/stable-image/generate/core"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
req.Header.Add("accept", "<accept>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.maxapi.ai/sd/v2beta/stable-image/generate/core")
.header("authorization", "<authorization>")
.header("accept", "<accept>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n\r\n-----011000010111000001101001--")
.asString();"<string>"{
"id": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"name": "bad_request",
"errors": [
"some-field: is required"
]
}{
"id": "ed14db44362126aab3cbd25cca51ffe3",
"name": "content_moderation",
"errors": [
"Your request was flagged by our content moderation system, as a result your request was denied and you were not charged."
]
}{
"id": "ff54b236a3acdde1522cb1ba641c43ed",
"name": "invalid_language",
"errors": [
"English is the only supported language for this service."
]
}{
"id": "rate_limit_exceeded",
"name": "rate_limit_exceeded",
"errors": [
"You have exceeded the rate limit of 150 requests within a 10 second period, and have been timed out for 60 seconds."
]
}{
"id": "2a1b2d4eafe2bc6ab4cd4d5c6133f513",
"name": "internal_error",
"errors": [
"An unexpected server error has occurred, please try again later."
]
}Stable Image Core
Our primary service for text-to-image generation, Stable Image Core represents the best quality achievable at high speed. No prompt engineering is required! Try asking for a style, a scene, or a character, and see what you get.
Try it out
Grab your API key and head over to
How to use
Please invoke this endpoint with a POST request.
The headers of the request must include an API key in the authorization field. The body of the request must be
multipart/form-data, and the accept header should be set to one of the following:
image/*to receive the image in the format specified by theoutput_formatparameter.application/jsonto receive the image encoded as base64 in a JSON response.
The body of the request should include:
prompt
The body may optionally include:
aspect_rationegative_promptseedstyle_presetoutput_format
Note: for more details about these parameters please see the request schema below.
Output
The resolution of the generated image will be 1.5 megapixels.
Credits
Flat rate of 3 credits per successful generation. You will not be charged for failed generations.
curl --request POST \
--url https://api.maxapi.ai/sd/v2beta/stable-image/generate/core \
--header 'accept: <accept>' \
--header 'authorization: <authorization>' \
--header 'content-type: multipart/form-data' \
--form prompt=import requests
url = "https://api.maxapi.ai/sd/v2beta/stable-image/generate/core"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n\r\n-----011000010111000001101001--"
headers = {
"authorization": "<authorization>",
"content-type": "multipart/form-data",
"accept": "<accept>"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const form = new FormData();
form.append('prompt', '');
const options = {
method: 'POST',
headers: {authorization: '<authorization>', accept: '<accept>'}
};
options.body = form;
fetch('https://api.maxapi.ai/sd/v2beta/stable-image/generate/core', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.maxapi.ai/sd/v2beta/stable-image/generate/core"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
req.Header.Add("accept", "<accept>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.maxapi.ai/sd/v2beta/stable-image/generate/core")
.header("authorization", "<authorization>")
.header("accept", "<accept>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\n\r\n-----011000010111000001101001--")
.asString();"<string>"{
"id": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"name": "bad_request",
"errors": [
"some-field: is required"
]
}{
"id": "ed14db44362126aab3cbd25cca51ffe3",
"name": "content_moderation",
"errors": [
"Your request was flagged by our content moderation system, as a result your request was denied and you were not charged."
]
}{
"id": "ff54b236a3acdde1522cb1ba641c43ed",
"name": "invalid_language",
"errors": [
"English is the only supported language for this service."
]
}{
"id": "rate_limit_exceeded",
"name": "rate_limit_exceeded",
"errors": [
"You have exceeded the rate limit of 150 requests within a 10 second period, and have been timed out for 60 seconds."
]
}{
"id": "2a1b2d4eafe2bc6ab4cd4d5c6133f513",
"name": "internal_error",
"errors": [
"An unexpected server error has occurred, please try again later."
]
}请求头
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.
1The content type of the request body. Do not manually specify this header; your HTTP client library will automatically include the appropriate boundary parameter.
1"multipart/form-data"
Specify image/* to get the image bytes directly. Otherwise specify application/json to receive the image as base64 encoded JSON.
application/json, image/* 请求体
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.
To control the weight of a given word use the format (word:weight),
where word is the word you'd like to control the weight of and weight
is a value between 0 and 1. For example: The sky was a crisp (blue:0.3) and (green:0.8)
would convey a sky that was blue and green, but more green than blue.
1 - 10000""
Controls the aspect ratio of the generated image.
16:9, 1:1, 21:9, 2:3, 3:2, 4:5, 5:4, 9:16, 9:21 "1:1"
A blurb of text describing what you do not wish to see in the output image.
This is an advanced feature.
10000""
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""
Guides the image model towards a particular style.
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, tile-texture ""
Dictates the content-type of the generated image.
jpeg, png, webp "png"
响应
图片生成成功。返回格式由请求中的 Accept 头决定。
The response is of type file.