注册

Replicate Imagen 4 功能

POST https://api.quickrouter.ai/replicate/v1/models/google/imagen-4/predictions 在线调试 →
Authorization

在 Header 添加参数 Authorization,其值为 Bearer 之后拼接 Token

示例: Authorization: Bearer ********************

请求参数

Header 参数
Authorization string
可选
示例: Bearer {{YOUR_API_KEY}}
Content-Type string
可选
示例: application/json
Body 参数 application/json
input object
可选
模型输入参数
prompt string
必需
您想要生成的内容的文本描述,或有关如何编辑给定图像的说明。
aspect_ratio string
可选
生成图像的长宽比。默认值:"1:1"。支持:1:1,9:16,16:9,3:4,4:3。
output_format string
可选
输出图像的格式。默认值:"jpg"。
safety_filter_level string
可选
安全过滤级别。block_low_and_above 是最严格的,block_medium_and_above 会阻止一些提示,block_only_high 是最宽松的,但一些提示仍然会被阻止。默认值:"block_only_high"。
示例
{
    "input": {
        "prompt": "The photo: Create a cinematic, photorealistic medium shot capturing the nostalgic warmth of a late 90s indie film. The focus is a young woman with brightly dyed pink-gold hair and freckled skin, looking directly and intently into the camera lens with a hopeful yet slightly uncertain smile, she is slightly off-center. She wears an oversized, vintage band t-shirt that says "Replicate" (slightly worn) over a long-sleeved striped top and simple silver stud earrings. The lighting is soft, golden hour sunlight streaming through a slightly dusty window, creating lens flare and illuminating dust motes in the air. The background shows a blurred, cluttered bedroom with posters on the wall and fairy lights, rendered with a shallow depth of field. Natural film grain, a warm, slightly muted color palette, and sharp focus on her expressive eyes enhance the intimate, authentic feel",
        "aspect_ratio": "16:9",
        "output_format": "jpg",
        "safety_filter_level": "block_medium_and_above"
    }
}

请求示例代码

curl --location --request POST 'https://api.quickrouter.ai/replicate/v1/models/google/imagen-4/predictions' --header 'Authorization: Bearer YOUR_API_KEY' --header 'Content-Type: application/json' --data-raw '{
    "input": {
        "prompt": "The photo: Create a cinematic, photorealistic medium shot capturing the nostalgic warmth of a late 90s indie film. The focus is a young woman with brightly dyed pink-gold hair and freckled skin, looking directly and intently into the camera lens with a hopeful yet slightly uncertain smile, she is slightly off-center. She wears an oversized, vintage band t-shirt that says "Replicate" (slightly worn) over a long-sleeved striped top and simple silver stud earrings. The lighting is soft, golden hour sunlight streaming through a slightly dusty window, creating lens flare and illuminating dust motes in the air. The background shows a blurred, cluttered bedroom with posters on the wall and fairy lights, rendered with a shallow depth of field. Natural film grain, a warm, slightly muted color palette, and sharp focus on her expressive eyes enhance the intimate, authentic feel",
        "aspect_ratio": "16:9",
        "output_format": "jpg",
        "safety_filter_level": "block_medium_and_above"
    }
}'
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer YOUR_API_KEY");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "input": {
    "prompt": "The photo: Create a cinematic, photorealistic medium shot capturing the nostalgic warmth of a late 90s indie film. The focus is a young woman with brightly dyed pink-gold hair and freckled skin, looking directly and intently into the camera lens with a hopeful yet slightly uncertain smile, she is slightly off-center. She wears an oversized, vintage band t-shirt that says "Replicate" (slightly worn) over a long-sleeved striped top and simple silver stud earrings. The lighting is soft, golden hour sunlight streaming through a slightly dusty window, creating lens flare and illuminating dust motes in the air. The background shows a blurred, cluttered bedroom with posters on the wall and fairy lights, rendered with a shallow depth of field. Natural film grain, a warm, slightly muted color palette, and sharp focus on her expressive eyes enhance the intimate, authentic feel",
    "aspect_ratio": "16:9",
    "output_format": "jpg",
    "safety_filter_level": "block_medium_and_above"
  }
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.quickrouter.ai/replicate/v1/models/google/imagen-4/predictions", 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({
  "input": {
    "prompt": "The photo: Create a cinematic, photorealistic medium shot capturing the nostalgic warmth of a late 90s indie film. The focus is a young woman with brightly dyed pink-gold hair and freckled skin, looking directly and intently into the camera lens with a hopeful yet slightly uncertain smile, she is slightly off-center. She wears an oversized, vintage band t-shirt that says "Replicate" (slightly worn) over a long-sleeved striped top and simple silver stud earrings. The lighting is soft, golden hour sunlight streaming through a slightly dusty window, creating lens flare and illuminating dust motes in the air. The background shows a blurred, cluttered bedroom with posters on the wall and fairy lights, rendered with a shallow depth of field. Natural film grain, a warm, slightly muted color palette, and sharp focus on her expressive eyes enhance the intimate, authentic feel",
    "aspect_ratio": "16:9",
    "output_format": "jpg",
    "safety_filter_level": "block_medium_and_above"
  }
})
headers = {
  'Authorization': 'Bearer YOUR_API_KEY',
  'Content-Type': 'application/json'
}
conn.request("POST", "/replicate/v1/models/google/imagen-4/predictions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

返回响应

响应参数 application/json
id string
可选
任务ID
status string
可选
任务状态
output string
可选
任务输出
示例
{
    "id": "26t3agjpx9rme0crb4es5cbxx4",
    "status": "starting"
}