在 OpenClaw 中使用 Nano Banana。
Nano Banana 是 Google 基于 Gemini 的图像生成模型,在生成图像的文本渲染方面处于行业领先。Pro 输出最高 4K 分辨率,Nano Banana 2 针对速度优化并支持更多宽高比,Edit 则用于修改现有图像。OpenClaw agent 通过一个 RunAPI 密钥和端点调用全部三个版本。
使用 RunAPI 通过 Google Nano Banana Pro 生成图像。
要求:
- 从 RUNAPI_API_KEY 读取 API 密钥。不要硬编码密钥。
- 向 https://runapi.ai/api/v1/nano_banana/text_to_image 发送 POST 请求。
- 将 model 设为 "nano-banana-pro"。
- 编写描述性的提示词。Nano Banana 擅长在图像中渲染文本,因此请将任何文字叠加内容写入提示词。
- 可选:将 output_resolution 设为 "4k" 以获得最高质量。
- 响应返回一个 task_id。轮询任务状态端点直到任务完成。
- 任务完成后,从响应中获取图像 URL。
curl -X POST https://runapi.ai/api/v1/nano_banana/text_to_image \
-H "Authorization: Bearer $RUNAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-pro",
"prompt": "A minimalist product card for a coffee brand, the text DARK ROAST in bold sans-serif across the top, a steaming cup below, warm studio lighting",
"aspect_ratio": "4:3",
"output_resolution": "4k",
"output_format": "png"
}'
{
"task_id": "tsk_abc123",
"status": "pending",
"model": "nano-banana-pro"
}
三步在 OpenClaw 中使用 Nano Banana
Configure RunAPI
Set the RUNAPI_API_KEY environment variable. If you already configured RunAPI as an OpenClaw provider for chat, the same key works for Nano Banana image generation.
export RUNAPI_API_KEY=runapi_xxx
Call Nano Banana
Send a POST to the text_to_image endpoint with model set to nano-banana-pro for highest quality, nano-banana-2 for speed, or nano-banana for the base variant. Set output_resolution to 4k on Pro or 2 for maximum detail. For editing, POST to edit_image with nano-banana-edit and include an image_url.
POST /api/v1/nano_banana/text_to_image
Get the result
The response includes a task_id. Poll the task status endpoint until status changes to completed. The finished response contains the generated image URL. RunAPI SDKs and the CLI handle polling automatically.
task_id: tsk_abc123
Nano Banana API 参数
| 参数 | 类型 | 说明 |
|---|---|---|
model |
string |
Required. nano-banana-pro (highest quality, 4K), nano-banana-2 (fast, extended ratios), nano-banana (base), or nano-banana-edit (editing). |
prompt |
string |
Text description of the desired image. Include any text you want rendered in the image — Nano Banana handles typography natively. |
image_url |
string |
Source image URL. Required for nano-banana-edit, ignored for text_to_image variants. |
aspect_ratio |
string |
Optional. Output aspect ratio. Pro accepts: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, auto. Nano Banana 2 adds 1:4, 1:8, 4:1, 8:1. |
output_resolution |
string |
Optional. Pro and 2 only. Accepted values: 1k, 2k, 4k. Defaults to 1k. |
output_format |
string |
Optional. Output file format. Accepted values: png, jpeg, jpg. |
callback_url |
string |
Optional. Webhook URL that receives a POST when the task completes. |
OpenClaw 上的 Nano Banana 是什么?
Nano Banana 是 Google 的图像生成模型,用户称其为 2026 年图像生成的默认之选。Pro 变体打破了 LM Arena 排行榜,产出缩小与手工设计工具差距的效果。OpenClaw agent 通过一个 RunAPI key 和端点调用全部三个变体。
Nano Banana 使用场景
品牌物料与营销视觉
生成海报、广告和社交媒体视觉内容,Nano Banana 对品牌准则的理解能产出符合特定颜色方案、风格要求和设计规范的图像。
真实世界背景下的产品可视化
将产品置于真实环境中——餐厅、户外场景、家居室内——Nano Banana 的世界知识确保背景在视觉上合理一致。
多风格概念探索
跨三个变体(Flash、Standard、Pro)探索同一概念的多种视觉风格,以 Flash 快速迭代,以 Pro 完成最终精选。
Nano Banana + OpenClaw 常见问题
Nano Banana Pro delivers the highest image quality with up to 4K output resolution. Nano Banana 2 is optimized for speed and supports extra aspect ratios like 1:4 and 8:1 for banner and tall formats. The base nano-banana variant is the most affordable option at standard resolution. All three share the same text_to_image endpoint.
Yes. Nano Banana is specifically designed for accurate text rendering in images. Include the exact words you want in the prompt — the model handles font placement and legibility natively, unlike most diffusion models that distort letterforms.
Nano Banana Pro pricing varies by output_resolution: 1k and 2k are the same rate, while 4k costs more per image. Nano Banana 2 follows a similar tier structure. Check the RunAPI pricing page for exact per-image rates. There is no monthly minimum.
Yes. Use the nano-banana-edit model with the edit_image endpoint. Pass the source image via image_url and describe the desired changes in the prompt. The edit variant supports text-aware modifications, so you can add or change text overlays on existing images.
Async. The create endpoint returns a task_id immediately. Poll the task status endpoint or provide a callback_url to receive a webhook when the image is ready. RunAPI SDKs and the CLI handle polling automatically.