- Third-party
- Zero data retention
Google 的快速图像生成模型,可根据文本提示词生成高质量图像。
| 模型信息 | |
|---|---|
| 条款和许可证 | 链接 ↗ |
| 更多信息 | 链接 ↗ |
| 零数据保留 | 是 |
| 定价 | 在 Cloudflare 仪表板中查看定价 ↗ |
用法
const response = await env.AI.run(
'google/nano-banana',
{
prompt:
'A cozy coffee shop interior with warm lighting, plants hanging from the ceiling, and a cat sleeping on a velvet armchair by the window',
aspect_ratio: '16:9',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "google/nano-banana",
"input": {
"prompt": "A cozy coffee shop interior with warm lighting, plants hanging from the ceiling, and a cat sleeping on a velvet armchair by the window",
"aspect_ratio": "16:9"
}
}'
{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/google__nano-banana/cozy-coffee-shop.png"
},
"state": "Completed"
}示例
复古东京海报 — 复古旅行海报风格插画
const response = await env.AI.run(
'google/nano-banana',
{
prompt:
'A vintage travel poster for Tokyo, Japan in the style of 1960s airline advertisements, with Mount Fuji in the background and cherry blossoms framing the scene',
aspect_ratio: '9:16',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "google/nano-banana",
"input": {
"prompt": "A vintage travel poster for Tokyo, Japan in the style of 1960s airline advertisements, with Mount Fuji in the background and cherry blossoms framing the scene",
"aspect_ratio": "9:16"
}
}'
{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/google__nano-banana/vintage-tokyo-poster.png"
},
"state": "Completed"
}露珠微距 — 照片级真实感微距摄影
const response = await env.AI.run(
'google/nano-banana',
{
prompt:
'A photorealistic macro shot of dewdrops on a spider web at sunrise, with rainbow light refracting through each droplet',
aspect_ratio: '1:1',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "google/nano-banana",
"input": {
"prompt": "A photorealistic macro shot of dewdrops on a spider web at sunrise, with rainbow light refracting through each droplet",
"aspect_ratio": "1:1"
}
}'
{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/google__nano-banana/dewdrops-macro.png"
},
"state": "Completed"
}像素艺术集市 — 等距视角像素艺术场景
const response = await env.AI.run(
'google/nano-banana',
{
prompt:
'An isometric pixel art scene of a bustling medieval marketplace with merchants, knights, and a dragon perched on the town hall roof',
aspect_ratio: '1:1',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "google/nano-banana",
"input": {
"prompt": "An isometric pixel art scene of a bustling medieval marketplace with merchants, knights, and a dragon perched on the town hall roof",
"aspect_ratio": "1:1"
}
}'{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/google__nano-banana/pixel-art-marketplace.png"
},
"state": "Completed"
}高分辨率风景 — 生成高分辨率 4K 风景图像
const response = await env.AI.run(
'google/nano-banana',
{
prompt:
'A dramatic mountain landscape at golden hour with snow-capped peaks and a crystal clear alpine lake',
aspect_ratio: '16:9',
image_size: '4K',
output_format: 'png',
},
)
console.log(response)curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "google/nano-banana",
"input": {
"prompt": "A dramatic mountain landscape at golden hour with snow-capped peaks and a crystal clear alpine lake",
"aspect_ratio": "16:9",
"image_size": "4K",
"output_format": "png"
}
}'
{
"gatewayMetadata": {
"keySource": "Unified"
},
"result": {
"image": "https://pub-04a6d208d361438ea01b797e6973bd19.r2.dev/catalog/google__nano-banana/high-resolution-landscape.png"
},
"state": "Completed"
}参数
prompt
stringrequired▶image_input[]
arraymaxItems: 3aspect_ratio
stringenum: 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9output_format
stringenum: jpg, png, webpimage_size
stringenum: 1K, 2K, 4Kimage
stringformat: uri