Nano Banana 2 API: AI Image Generation

Generate images with Nano Banana 2 via the Muapi REST API. Pay per generation — no subscription needed.

การควบคุมโมเดลแบบโต้ตอบ

โมเดล nano-banana-2 มีให้บริการบน MuAPI พร้อมการเรียกเก็บเงินตามการใช้งานที่ยืดหยุ่นและรองรับการทำงานพร้อมกันสูง

Nano Banana 2 ข้อมูลอ้างอิง API

จุดสิ้นสุด

POST https://api.muapi.ai/api/v1/nano-banana-2

ส่งงานด้วยคีย์ Muapi API ของคุณในส่วนหัว x-api-key จากนั้นสำรวจความคิดเห็น https://api.muapi.ai/api/v1/predictions/{request_id}/result จนกว่าสถานะจะเสร็จสมบูรณ์

พารามิเตอร์

ชื่อประเภทจำเป็นคำอธิบาย
promptstringใช่ภาพพร้อมท์
aspect_ratiostringไม่The aspect ratio of the generated image.ตัวเลือก: 1:1, 1:4, 1:8, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16, 16:9, 21:9, Autoค่าเริ่มต้น: "1:1"
google_searchbooleanไม่พรอมต์การค้นหาของ Googleค่าเริ่มต้น: false
resolutionstringไม่The resolution of the generated image.ตัวเลือก: 1k, 2k, 4kค่าเริ่มต้น: "1k"
output_formatstringไม่The format of the output image.ตัวเลือก: jpg, pngค่าเริ่มต้น: "jpg"

ตัวอย่าง CURL

REQUEST_ID=$(curl -s -X POST https://api.muapi.ai/api/v1/nano-banana-2 \
  -H "x-api-key: $MUAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"<prompt>"}' | jq -r .request_id)

curl -s https://api.muapi.ai/api/v1/predictions/$REQUEST_ID/result -H "x-api-key: $MUAPI_API_KEY"

ตัวอย่างหลาม

import os, time, requests

API = "https://api.muapi.ai/api/v1"
headers = {"x-api-key": os.environ["MUAPI_API_KEY"]}

r = requests.post(f"{API}/nano-banana-2", headers=headers, json={"prompt":"<prompt>"})
request_id = r.json()["request_id"]

while True:
    res = requests.get(f"{API}/predictions/{request_id}/result", headers=headers).json()
    if res["status"] == "completed":
        print(res["outputs"]); break
    if res["status"] == "failed":
        raise RuntimeError(res.get("error"))
    time.sleep(3)

เอกสารฉบับเต็มและการรวมตัวแทน/MCP: llms.txt. รับคีย์ API ได้ที่ muapi.ai/access-keys.