On this page
article
Google Imagen
1.概述
google推出的文生图模型。
模型列表:
imagegeneration@002
imagegeneration@005
imagegeneration@006
imagen-3.0-generate-001
imagen-3.0-generate-002
imagen-3.0-fast-generate-001
说明:
1.该系列模型对中文支持不太友好,使用自然语言描述时尽量使用英文
2.请求说明
- 请求方法:
POST
- 请求地址
https://gateway.theturbo.ai/v1/images/generations
3.请求参数
3.1 Head参数
参数名称 | 类型 | 必填 | 说明 | 示例值 |
---|---|---|---|---|
Content-Type |
string | 是 | 设置请求头类型,必须为application/json |
application/json |
Accept |
string | 是 | 设置响应类型,建议统一为application/json |
application/json |
Authorization |
string | 是 | 身份验证所需的 API_KEY,格式Bearer $YOUR_API_KEY |
Bearer $YOUR_API_KEY |
3.2 Body 参数 (application/json)
参数名称 | 类型 | 必填 | 说明 | 示例(默认值) |
---|---|---|---|---|
model | string | 是 | 要使用的模型 ID。详见概述列出的可用版本,如 imagen-3.0-generate-001 。 |
imagen-3.0-generate-001 |
prompt | string | 是 | 一段描述所需图像的文字。imagen-3.0 描述最大长度为 480 词元。 imagegeneration@005 imagegeneration@006 描述最大长度为 128 词元。 imagegeneration@002 描述最大长度为 128 词元。 |
A cute baby sea otter |
n | number | 否 | 生成图像的数量,必须在 1 到 4 之间 | 1 |
aspect_ratio | string | 否 | 图片的宽高比。支持1:1 9:16 16:9 3:4 4:3 。不同模型支持的略有差异。 |
1:1 |
output_format | string | 否 | 生成图像的格式。支持png jpeg 。 |
png |
style | string | 否 | 生成图像的风格。支持photograph digital_art landscape sketch watercolor cyberpunk pop_art 。此参数仅适用于imagegeneration@002 。 |
photograph |
response_format | string | 否 | 生成的图像返回的格式。只支持b64_json 。 |
b64_json |
4.请求示例
5.响应示例
{
"created": 1589478378,
"data": [
{
"b64_json": "..."
},
{
"b64_json": "..."
}
]
}