官方文档:https://replicate.com/google/imagen-4
POST
/replicate/v1/models/google/imagen-4/predictions创建任务 google/imagen-4
API Key application/json
请求示例
curl -X POST https://top.qingyuntop.ai/replicate/v1/models/google/imagen-4/predictions \
-H "Authorization: Bearer ${QINGYUN_TOP_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"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"
}
}'请求参数
| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
Authorization | Header | string | 否 | - | Bearer {{YOUR_API_KEY}} |
input | JSON body | object | 否 | - | - |
input.prompt | JSON body | string | 是 | 图像生成的文字提示。 | - |
input.aspect_ratio | JSON body | string | 否 | 生成图像的长宽比。默认值:“1:1”。支持:1:1,9:16,16:9,3:4,4:3 | - |
input.output_format | JSON body | string | 否 | 输出图像的格式。默认值:“jpg”。 | - |
input.safety_filter_level | JSON body | string | 否 | block_low_and_above 是最严格的,block_medium_and_above 会阻止一些提示,block_only_high 是最宽松的,但一些提示仍然会被阻止。默认值:“block_only_high” | - |
返回响应 (200)
| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
id | 响应 JSON | string | 是 | - | - |
model | 响应 JSON | string | 是 | - | - |
version | 响应 JSON | string | 是 | - | - |
input | 响应 JSON | object | 是 | - | - |
input.aspect_ratio | 响应 JSON | string | 是 | - | - |
input.output_format | 响应 JSON | string | 是 | - | - |
input.prompt | 响应 JSON | string | 是 | - | - |
input.safety_filter_level | 响应 JSON | string | 是 | - | - |
logs | 响应 JSON | string | 是 | - | - |
output | 响应 JSON | null | 是 | - | - |
data_removed | 响应 JSON | boolean | 是 | - | - |
error | 响应 JSON | null | 是 | - | - |
status | 响应 JSON | string | 是 | - | - |
created_at | 响应 JSON | string | 是 | - | - |
urls | 响应 JSON | object | 是 | - | - |
urls.cancel | 响应 JSON | string | 是 | - | - |
urls.get | 响应 JSON | string | 是 | - | - |
urls.stream | 响应 JSON | string | 是 | - | - |
urls.web | 响应 JSON | string | 是 | - | - |
响应示例
{
"id": "yj1hjjc3c5rme0crb5jtqtxxmw",
"model": "google/imagen-4",
"version": "hidden",
"input": {
"aspect_ratio": "16:9",
"output_format": "jpg",
"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",
"safety_filter_level": "block_medium_and_above"
},
"logs": "",
"output": null,
"data_removed": false,
"error": null,
"status": "starting",
"created_at": "2025-07-30T03:34:41.761Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/yj1hjjc3c5rme0crb5jtqtxxmw/cancel",
"get": "https://api.replicate.com/v1/predictions/yj1hjjc3c5rme0crb5jtqtxxmw",
"stream": "https://stream.replicate.com/v1/files/bcwr-wzn4sniemyumrzyhr364uivh625z7wk5w2qlbvbzqci3lgvzhwrq",
"web": "https://replicate.com/p/yj1hjjc3c5rme0crb5jtqtxxmw"
}
}来源原始接口定义(用于追溯)
以下内容来自 Apifox 快照,可能包含兼容层字段或旧示例;公开调用请以本页的协议说明和当前模型列表为准。
{
"id": 495899861,
"name": "创建任务 google/imagen-4",
"type": "http",
"serverId": "",
"preProcessors": [],
"postProcessors": [
{
"type": "customScript",
"data": "// 将接口返回数据,封装成自己需要的结构\r\nvar resp = {\r\n response: pm.response.json().data[0].url\r\n}\r\n\r\n// html 模板字符\r\nvar template = `<html><img src=\"{{response}}\" /></html>`;\r\n\r\n// 设置 visualizer 数据。传模板、解析对象。\r\npm.visualizer.set(template, resp);",
"defaultEnable": true,
"enable": true,
"id": "fbHUwO9bov2rFlZc4OM7PGVIuhdeJCb6"
}
],
"inheritPreProcessors": {},
"inheritPostProcessors": {},
"description": "官方文档:https://replicate.com/google/imagen-4",
"operationId": "",
"sourceUrl": "",
"method": "post",
"path": "/replicate/v1/models/google/imagen-4/predictions",
"tags": [],
"status": 1,
"requestBody": {
"type": "application/json",
"parameters": [],
"jsonSchema": {
"type": "object",
"properties": {
"input": {
"type": "object",
"properties": {
"prompt": {
"type": "string",
"description": "图像生成的文字提示。"
},
"aspect_ratio": {
"type": "string",
"description": "生成图像的长宽比。默认值:“1:1”。支持:1:1,9:16,16:9,3:4,4:3"
},
"output_format": {
"type": "string",
"description": "输出图像的格式。默认值:“jpg”。"
},
"safety_filter_level": {
"type": "string",
"description": "block_low_and_above 是最严格的,block_medium_and_above 会阻止一些提示,block_only_high 是最宽松的,但一些提示仍然会被阻止。默认值:“block_only_high”"
}
},
"required": [
"prompt"
],
"x-apifox-orders": [
"prompt",
"aspect_ratio",
"output_format",
"safety_filter_level"
]
}
},
"x-apifox-orders": [
"input"
]
},
"examples": [
{
"value": "{\n \"input\": {\n \"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\",\n \"aspect_ratio\": \"16:9\",\n \"output_format\": \"jpg\",\n \"safety_filter_level\": \"block_medium_and_above\"\n }\n }",
"mediaType": "application/json",
"description": ""
}
],
"mediaType": "",
"oasExtensions": "",
"required": false,
"additionalContentTypes": []
},
"parameters": {
"path": [],
"query": [],
"cookie": [],
"header": [
{
"id": "GTujCrB2It",
"name": "Authorization",
"required": false,
"enable": true,
"description": "",
"type": "string",
"sampleValue": "Bearer {{YOUR_API_KEY}}"
}
]
},
"commonParameters": {
"query": [],
"body": [],
"cookie": [],
"header": []
},
"auth": {},
"responses": [
{
"id": 170900577,
"name": "成功",
"code": 200,
"contentType": "json",
"jsonSchema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"model": {
"type": "string"
},
"version": {
"type": "string"
},
"input": {
"type": "object",
"properties": {
"aspect_ratio": {
"type": "string"
},
"output_format": {
"type": "string"
},
"prompt": {
"type": "string"
},
"safety_filter_level": {
"type": "string"
}
},
"required": [
"aspect_ratio",
"output_format",
"prompt",
"safety_filter_level"
],
"x-apifox-orders": [
"aspect_ratio",
"output_format",
"prompt",
"safety_filter_level"
]
},
"logs": {
"type": "string"
},
"output": {
"type": "null"
},
"data_removed": {
"type": "boolean"
},
"error": {
"type": "null"
},
"status": {
"type": "string"
},
"created_at": {
"type": "string"
},
"urls": {
"type": "object",
"properties": {
"cancel": {
"type": "string"
},
"get": {
"type": "string"
},
"stream": {
"type": "string"
},
"web": {
"type": "string"
}
},
"required": [
"cancel",
"get",
"stream",
"web"
],
"x-apifox-orders": [
"cancel",
"get",
"stream",
"web"
]
}
},
"required": [
"id",
"model",
"version",
"input",
"logs",
"output",
"data_removed",
"error",
"status",
"created_at",
"urls"
],
"x-apifox-orders": [
"id",
"model",
"version",
"input",
"logs",
"output",
"data_removed",
"error",
"status",
"created_at",
"urls"
]
},
"itemSchema": {},
"description": "",
"mediaType": "",
"headers": [],
"oasExtensions": ""
}
],
"responseExamples": [
{
"name": "成功示例",
"responseId": 170900577,
"data": "{\n \"id\": \"yj1hjjc3c5rme0crb5jtqtxxmw\",\n \"model\": \"google/imagen-4\",\n \"version\": \"hidden\",\n \"input\": {\n \"aspect_ratio\": \"16:9\",\n \"output_format\": \"jpg\",\n \"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\",\n \"safety_filter_level\": \"block_medium_and_above\"\n },\n \"logs\": \"\",\n \"output\": null,\n \"data_removed\": false,\n \"error\": null,\n \"status\": \"starting\",\n \"created_at\": \"2025-07-30T03:34:41.761Z\",\n \"urls\": {\n \"cancel\": \"https://api.replicate.com/v1/predictions/yj1hjjc3c5rme0crb5jtqtxxmw/cancel\",\n \"get\": \"https://api.replicate.com/v1/predictions/yj1hjjc3c5rme0crb5jtqtxxmw\",\n \"stream\": \"https://stream.replicate.com/v1/files/bcwr-wzn4sniemyumrzyhr364uivh625z7wk5w2qlbvbzqci3lgvzhwrq\",\n \"web\": \"https://replicate.com/p/yj1hjjc3c5rme0crb5jtqtxxmw\"\n }\n}",
"description": "",
"oasKey": "",
"oasExtensions": "",
"id": "019fc09b-0b2e-723f-adf0-d457ea9cb1ec"
}
],
"codeSamples": [],
"projectId": 8662722,
"moduleId": 8310462,
"folderId": 92436086,
"ordering": 174,
"responsibleId": 0,
"commonResponseStatus": {},
"advancedSettings": {
"disabledSystemHeaders": {},
"isDefaultUrlEncoding": 1
},
"customApiFields": {},
"oasExtensions": "",
"mockScript": {},
"createdAt": "2026-08-02T03:53:34.000Z",
"updatedAt": "2026-08-06T12:15:55.000Z",
"creatorId": 2863449,
"editorId": 2863449,
"creatorUserId": 2863449,
"editorUserId": 2863449,
"responseChildren": [
"BLANK.170900577"
],
"visibility": "INHERITED",
"securityScheme": {},
"callbacks": ""
}