Image Generation
curl --request POST \
--url https://api.siliconflow.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "black-forest-labs/FLUX.2-pro",
"prompt": "A serene landscape with mountains and a lake at sunset",
"image_size": "512x512"
}
'import requests
url = "https://api.siliconflow.com/v1/images/generations"
payload = {
"model": "black-forest-labs/FLUX.2-pro",
"prompt": "A serene landscape with mountains and a lake at sunset",
"image_size": "512x512"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'black-forest-labs/FLUX.2-pro',
prompt: 'A serene landscape with mountains and a lake at sunset',
image_size: '512x512'
})
};
fetch('https://api.siliconflow.com/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"images": [
{
"url": "<string>"
}
],
"timings": {
"inference": 123
},
"seed": 123
}{
"code": 20012,
"message": "<string>",
"data": "<string>"
}"Invalid token""404 page not found"{
"message": "Request was rejected due to rate limiting. If you want more, please contact contact@siliconflow.com. Details:TPM limit reached.",
"data": "<string>"
}{
"code": 50505,
"message": "Model service overloaded. Please try again later.",
"data": "<string>"
}"<string>"图像系列
创建图片生成请求
Creates an image response for the given prompt. The URL for the generated image is valid for one hour. Please make sure to download and store it promptly to avoid any issues due to URL expiration.
POST
/
images
/
generations
Image Generation
curl --request POST \
--url https://api.siliconflow.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "black-forest-labs/FLUX.2-pro",
"prompt": "A serene landscape with mountains and a lake at sunset",
"image_size": "512x512"
}
'import requests
url = "https://api.siliconflow.com/v1/images/generations"
payload = {
"model": "black-forest-labs/FLUX.2-pro",
"prompt": "A serene landscape with mountains and a lake at sunset",
"image_size": "512x512"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'black-forest-labs/FLUX.2-pro',
prompt: 'A serene landscape with mountains and a lake at sunset',
image_size: '512x512'
})
};
fetch('https://api.siliconflow.com/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"images": [
{
"url": "<string>"
}
],
"timings": {
"inference": 123
},
"seed": 123
}{
"code": 20012,
"message": "<string>",
"data": "<string>"
}"Invalid token""404 page not found"{
"message": "Request was rejected due to rate limiting. If you want more, please contact contact@siliconflow.com. Details:TPM limit reached.",
"data": "<string>"
}{
"code": 50505,
"message": "Model service overloaded. Please try again later.",
"data": "<string>"
}"<string>"Body
application/json
- FLUX.2-pro
- FLUX.2-flex
- Qwen-Image
- Z-Image
- FLUX.1-Kontext
- FLUX.1-Kontext-dev
- FLUX-1.1-pro
- FLUX-1.1-pro-Ultra
- FLUX.1-schnell
- FLUX.1-dev
Corresponding Model Name. To better enhance service quality, we will make periodic changes to the models provided by this service, including but not limited to model on/offlining and adjustments to model service capabilities. We will notify you of such changes through appropriate means such as announcements or message pushes where feasible.
Available options:
black-forest-labs/FLUX.2-pro