/fal-ai/imagen4/preview
▼
Authorization
在 Header 添加参数 Authorization,其值为 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
官方文档: https://fal.ai/models/fal-ai/imagen4/preview
请求参数
Header 参数
Authorization
string
必需
示例: Bearer {{YOUR_API_KEY}}
Body 参数 application/json
prompt
string
必需
提示词
aspect_ratio
string
可选
图片比例。枚举值:1:1、16:9、9:16、3:4、4:3
num_images
integer
可选
生成图片数量。默认值:1 范围值:1-4
resolution
string
可选
分辨率。枚举值:"1K"、"2K"
示例
{
"prompt": "Capture an intimate close-up bathed in warm, soft, late-afternoon sunlight filtering into a quintessential 1960s kitchen. The focal point is a charmingly designed vintage package of all-purpose flour, resting invitingly on a speckled Formica countertop.",
"aspect_ratio": "1:1",
"num_images": 1,
"resolution": "1K"
}
请求示例代码
curl --location --request POST 'https://api.quickrouter.ai/fal-ai/imagen4/preview' --header 'Authorization: Bearer YOUR_API_KEY' --header 'Content-Type: application/json' --data-raw '{
"prompt": "Capture an intimate close-up bathed in warm, soft, late-afternoon sunlight filtering into a quintessential 1960s kitchen. The focal point is a charmingly designed vintage package of all-purpose flour, resting invitingly on a speckled Formica countertop.",
"aspect_ratio": "1:1",
"num_images": 1,
"resolution": "1K"
}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer YOUR_API_KEY");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"prompt": "Capture an intimate close-up bathed in warm, soft, late-afternoon sunlight filtering into a quintessential 1960s kitchen. The focal point is a charmingly designed vintage package of all-purpose flour, resting invitingly on a speckled Formica countertop.",
"aspect_ratio": "1:1",
"num_images": 1,
"resolution": "1K"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.quickrouter.ai/fal-ai/imagen4/preview", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
import http.client
import json
conn = http.client.HTTPSConnection("api.quickrouter.ai")
payload = json.dumps({
"prompt": "Capture an intimate close-up bathed in warm, soft, late-afternoon sunlight filtering into a quintessential 1960s kitchen. The focal point is a charmingly designed vintage package of all-purpose flour, resting invitingly on a speckled Formica countertop.",
"aspect_ratio": "1:1",
"num_images": 1,
"resolution": "1K"
})
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
conn.request("POST", "/fal-ai/imagen4/preview", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
返回响应
响应参数 application/json
status
string
可选
任务状态
request_id
string
可选
请求ID
response_url
string
可选
获取结果的URL
status_url
string
可选
状态查询URL
cancel_url
string
可选
取消任务URL
logs
null
可选
日志
metrics
object
可选
指标数据
queue_position
integer
可选
队列位置
示例
{
"status": "IN_QUEUE",
"request_id": "484ccb37-5477-44fe-8e75-6d6f6e9160b3",
"response_url": "https://queue.fal.run/fal-ai/imagen4/requests/484ccb37-5477-44fe-8e75-6d6f6e9160b3",
"status_url": "https://queue.fal.run/fal-ai/imagen4/requests/484ccb37-5477-44fe-8e75-6d6f6e9160b3/status",
"cancel_url": "https://queue.fal.run/fal-ai/imagen4/requests/484ccb37-5477-44fe-8e75-6d6f6e9160b3/cancel",
"logs": null,
"metrics": {},
"queue_position": 0
}