การเชื่อมต่อ API ของ Nano Banana Pro
ใช้ Nano Banana Pro ผ่าน Rivya Public API v1 ด้วย model id nano-banana-pro, input ที่รองรับ, พารามิเตอร์, กฎ Files API, เครดิต และตัวอย่าง response
nano-banana-pro
text, file
จำเป็นสำหรับโหมด reference
8
รูปภาพ
FIXED
10000 อักขระ
contract ของ request
ส่ง model id ที่ระดับบนสุด control เฉพาะโมเดลอยู่ใน params
| Key | Type | จำเป็น | ค่าเริ่มต้น | คำอธิบาย |
|---|---|---|---|---|
| model | string | ใช่ | nano-banana-pro | ใช้ API model id nano-banana-pro |
| prompt | string | ใช่ | - | สูงสุด 10000 อักขระสำหรับโมเดลนี้ |
| params | object | ไม่ใช่ | - | object พารามิเตอร์เฉพาะโมเดล ใช้แถวด้านล่างสำหรับ key ที่อนุญาต |
| client_request_id | string | ไม่ใช่ | - | client-side id แบบเลือกได้สำหรับ trace คำขอในระบบของคุณ |
พารามิเตอร์โมเดล
| Key | Type | จำเป็น | ค่าเริ่มต้น | ช่วง | ตัวเลือก | คำอธิบาย |
|---|---|---|---|---|---|---|
| aspect_ratio | select | ไม่ใช่ | 1:1 | - | 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, auto | อัตราส่วนภาพ |
| resolution | select | ไม่ใช่ | 1K | - | 1K, 2K, 4K | ความละเอียด |
| output_format | select | ไม่ใช่ | png | - | png, jpg | รูปแบบเอาต์พุต |
policy การอัปโหลด
อัปโหลดไฟล์ reference ก่อน จากนั้นใส่ URL และ duration token ที่ได้กลับมาไว้ใน params.referenceMediaItems
ภาพอ้างอิง: อัปโหลดไฟล์รูปภาพได้สูงสุด 8 ไฟล์สำหรับโปรเจกต์รูปภาพ
8
image
reference วิดีโอและเสียงควรมี durationToken จาก /api/v1/files เมื่อจำเป็นต้องตรวจ duration
| kind | ขนาดสูงสุด | MIME type |
|---|---|---|
| image | 30 MB | image/jpeg, image/png, image/webp |
request ขั้นต่ำ
{
"model": "nano-banana-pro",
"prompt": "A clean editorial product image on a soft studio background",
"params": {
"aspect_ratio": "1:1",
"resolution": "1K",
"output_format": "png"
}
}request แบบไฟล์ reference
{
"model": "nano-banana-pro",
"prompt": "A clean editorial product image on a soft studio background",
"params": {
"aspect_ratio": "1:1",
"resolution": "1K",
"output_format": "png",
"referenceMediaItems": [
{
"url": "https://cdn.example.com/reference-image.png",
"kind": "image",
"name": "reference-image.png",
"mimeType": "image/png"
}
]
}
}response จากการสร้าง
endpoint create ส่ง public task id กลับมา poll endpoint สถานะจนกว่างานจะสำเร็จหรือล้มเหลว
{
"id": "task_nano_banana_pro_example",
"status": "queued",
"model": "nano-banana-pro",
"reserved_credits": 8,
"final_credits": 0,
"created_at": "2026-05-11T00:00:00.000Z",
"updated_at": "2026-05-11T00:00:00.000Z",
"result": null,
"error": null
}error ทั่วไป
validation_failed, insufficient_credits, idempotency_conflict, rate_limited, not_found
บางโหมดต้องใช้การอัปโหลด reference ผ่าน Files API