
google/ nano-banana-2-lite/ image-to-image
图生图272 / 50,000
更多设置(5 项)
0 / 50,000
生成结果演示示例登录后试用
按实际用量结算 · 每次冻结 $0.042367

价格
按实际用量结算;尚未公布已核实的单位售价。
历史试跑费用参考:$0.042367,按当前销售规则折算。记录采用默认生成参数 (1 张);完整输入及输出计量未公开。这不是单位售价,也不是新请求的预计费用。
每次请求会先临时冻结 $0.042367,按实际用量扣费,通常在一分钟内完成:多余部分退回,超出部分从余额扣除,余额可能因此变为负数;余额为负时新请求暂停,充值后先抵扣欠款。
生成失败不收费。
API 接入
用这个模型 ID 提交生成请求。
POST
/v1/model-tasksgoogle/nano-banana-2-lite/image-to-image请求体
{
"model": "google/nano-banana-2-lite/image-to-image",
"input": {
"prompt": "Change the rainy night outside the window into a bright, sunny spring morning with a blossoming pink cherry tree and blue sky. Keep everything else in the room exactly the same, including the sleeping cat, the armchair, the lamp, the books and the flat illustration style.",
"aspect_ratio": "auto",
"num_images": 1,
"output_format": "png",
"system_prompt": "",
"image_urls": [
"https://pub-a7287c8d5de944d984e22a5bd3ab9bbe.r2.dev/uploads/capability-demo-10cce3df8d83f45dc4d93ee51fc27425.png"
]
}
}输入 Schema
| 参数 | 类型 | 是否必填 | 默认值 |
|---|---|---|---|
| prompt | string | 必填 | — |
| aspect_ratio | string | 可选 | auto |
| image_urls | array | 可选 | — |
| num_images | integer | 可选 | 1 |
| output_format | string | 可选 | png |
| seed | integer | 可选 | — |
| system_prompt | string | 可选 | |
| thinking_level | string | 可选 | — |
返回结果
接口会返回生成结果,或返回可轮询的异步任务;具体响应方式与结果字段见下方示例和 Schema。
异步任务
调用示例
异步任务提交后返回任务 ID,轮询至 status 为 completed 后,按返回结果获取生成内容。API Key 在控制台获取。
# Use a new directory for each new generation. Rerunning here continues this task.
set -eu
test -s model-task-id.txt || python3 -c "import uuid; print(uuid.uuid4())" > model-task-id.txt
REQUEST_ID=$(cat model-task-id.txt)
# Idempotent: resending the same bytes with the same ID never charges twice.
curl --fail-with-body --retry 3 --retry-connrefused --request POST 'https://api.musespan.com/v1/model-tasks' \
--header "Authorization: Bearer $MUSESPAN_API_KEY" \
--header "X-Request-Id: $REQUEST_ID" \
--header "Content-Type: application/json" \
--data '{"model":"google/nano-banana-2-lite/image-to-image","input":{"prompt":"Change the rainy night outside the window into a bright, sunny spring morning with a blossoming pink cherry tree and blue sky. Keep everything else in the room exactly the same, including the sleeping cat, the armchair, the lamp, the books and the flat illustration style.","aspect_ratio":"auto","num_images":1,"output_format":"png","system_prompt":"","image_urls":["https://pub-a7287c8d5de944d984e22a5bd3ab9bbe.r2.dev/uploads/capability-demo-10cce3df8d83f45dc4d93ee51fc27425.png"]}}'
# Poll every 5 seconds for up to 25 minutes until status is completed or failed.
# Still queued (with queue_position) 5 minutes after submission: failed with queue_timeout, not charged.
# No result 15 minutes after acceptance (or no confirmation 15 minutes after submission): failed with generation_timeout, not charged.
# Any failure is final: generate again in a new directory (a new X-Request-Id).
# A 404 means the POST did not arrive: rerun this script to resend it with the same ID.
curl --fail-with-body 'https://api.musespan.com/v1/model-tasks/'"$REQUEST_ID"'' --header "Authorization: Bearer $MUSESPAN_API_KEY"