Nano Banana Pro
概览
模型标识符: nano-banana-pro · 输出: image · 模式: Text to Image, Image to Image
认证与接口
所有请求发送到 https://genjutsu.top。请将 Genjutsu API 密钥作为 bearer 令牌发送。 POST https://genjutsu.top/v1/media/generate · Authorization: Bearer $GENJUTSU_API_KEY · 所需权限范围: generate, read, assets
模式与参数
Text to Image t2i
| 参数 | 类型 | 是否必填 | 默认值 | 详情 |
|---|---|---|---|---|
prompt | string | 必填 | - | |
count | integer | 可选 | 1 | |
aspect_ratio | 可选值之一 | 可选 | "16:9" |
|
image_resolution | 可选值之一 | 可选 | "none" |
|
最小请求
curl -X POST "https://genjutsu.top/v1/media/generate" \
-H "Authorization: Bearer $GENJUTSU_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "nano-banana-pro",
"mode": "t2i",
"params": {
"prompt": "A lighthouse on a rocky cliff at golden hour, soft clouds, cinematic light"
}
}'包含可选参数的请求
curl -X POST "https://genjutsu.top/v1/media/generate" \
-H "Authorization: Bearer $GENJUTSU_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "nano-banana-pro",
"mode": "t2i",
"params": {
"count": 1,
"prompt": "A lighthouse on a rocky cliff at golden hour, soft clouds, cinematic light",
"aspect_ratio": "16:9",
"image_resolution": "none"
}
}'Image to Image i2i
| 参数 | 类型 | 是否必填 | 默认值 | 详情 |
|---|---|---|---|---|
prompt | string | 必填 | - | |
images_list | image 资源 ID 列表 | 必填 | - | Add 1 to 10 PNG, JPEG or WebP reference images. Each image can be up to 20 MiB. |
count | integer | 可选 | 1 | |
aspect_ratio | 可选值之一 | 可选 | "16:9" |
|
任务生命周期
将请求提交到 POST /v1/media/generate,返回 202 和 task_id。每 5 秒轮询一次 GET /v1/media/tasks/{task_id},直到 is_final 为 true:此时状态为 succeeded、failed 或 cancelled,同一个任务中包含结果(outputs)或错误(error_code 和 error_message)。使用相同的 Idempotency-Key 重复提交会返回原任务。响应中的 ID 和 URL 仅为示例。
# Needs curl and jq.
# 1. Submit. The response is 202 with task_id, state and credits_held.
ID=$(curl -s -X POST "https://genjutsu.top/v1/media/generate" \
-H "Authorization: Bearer $GENJUTSU_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "nano-banana-pro",
"mode": "t2i",
"params": {
"prompt": "A lighthouse on a rocky cliff at golden hour, soft clouds, cinematic light"
}
}' | jq -r .task_id)
echo "task: $ID"
# 2. Poll every 5 seconds until is_final is true (state is then succeeded, failed or cancelled).
while true; do
TASK=$(curl -s "https://genjutsu.top/v1/media/tasks/$ID" -H "Authorization: Bearer $GENJUTSU_API_KEY")
echo "state: $(echo "$TASK" | jq -r .state)"
[ "$(echo "$TASK" | jq -r .is_final)" = "true" ] && break
sleep 5
done
# 3. The final task carries the result: outputs[].url when succeeded, error_code and error_message when failed.
echo "$TASK" | jq '{state, outputs, error_code, error_message, credits}'价格
Text to Image
| 选项 | 总价 |
|---|---|
Resolution: 1K | 每次请求 0.200000 点数 |
Resolution: 2K | 每次请求 0.400000 点数 |
Resolution: 4K | 每次请求 0.600000 点数 |
Image to Image
| 选项 | 总价 |
|---|---|
Resolution: 1K | 每次请求 0.200000 点数 |
Resolution: 2K | 每次请求 0.400000 点数 |
Resolution: 4K | 每次请求 0.600000 点数 |
请在 Studio 或通过 POST /v1/quotes 获取准确总价。
版本与说明
文档版本 4,发布于 2026-11-27。