NOV AI
Tài liệu API

nano-banana-2-lite

Nano Banana 2 Lite · Chuẩn 4K tiết kiệm — Nano Banana, GPT Image, Seedream, Flux, Midjourney trong một công cụ.

type: imageoutput: image214đ – 285đ

Bảng giá API chi tiết theo từng cấu hình tham số

Đơn giá thực tế (VNĐ) trừ vào ví khi gọi POST /v1/generations (hoặc kiểm tra trước qua POST /v1/generations/estimate).

214đ – 285đ
1K:214đ / ảnh2K:232đ / ảnh4K:285đ / ảnh

Input — tham số đầu vào

POST/v1/generations

Gửi JSON gồm "model": "nano-banana-2-lite" và các tham số dưới đây ở cùng cấp. Tham số không có trong bảng sẽ bị từ chối (400).

Tham sốKiểuGiá trị hỗ trợMô tả
modelrequiredstringnano-banana-2-liteMã model
promptrequiredstring

Tối đa 20.000 ký tự

Mô tả (prompt)
reference_image_urlsstring[] (URL image)

Tối đa 16 file

Ảnh tham chiếu (tuỳ chọn) — Số ảnh tối đa tuỳ model: Nano Banana 2.1 tới 12 ảnh, GPT Image 2.6 tới 16 ảnh, GPT Image 2 tới 8 ảnh
aspect_ratiorequiredenum
9:163:41:14:316:9
Tỉ lệ khung hình
resolutionenum
1k2k4k
Độ phân giải
nenum
1234

Mặc định: 1

Số lượng ảnh — Tạo 1–4 ảnh cùng lúc, giá nhân theo số ảnh
remove_logoboolean

true, false

Mặc định: false

Xoá logo — Tự xoá logo / watermark trên ảnh kết quả (không tính thêm)
  • Tham số file (string URL) nhận link công khai http(s) — máy chủ tự tải về — hoặc URL trả về từ API tải file POST /account/ai/uploads.
  • Thứ tự phần tử trong mảng reference_image_urls ([url_1, url_2, url_3]) được hệ thống khoá cố định 1–1 theo đúng thứ tự: Ảnh 1 / Image 1 / FIRST image, Ảnh 2 / Image 2 / SECOND image, Ảnh 3 / Image 3 / THIRD image. Khi tải file từ máy qua POST /account/ai/uploads, hãy upload tuần tự theo đúng thứ tự [1, 2, 3] để mảng URL không bị đảo.
  • Bỏ trống tham số không bắt buộc thì dùng giá trị mặc định.

Ví dụ request (cURL)

curl -X POST https://mtkvideo.com/api/v1/generations \
  -H "X-API-Key: $API_KEY" -H "Content-Type: application/json" \
  -d '{
  "model": "nano-banana-2-lite",
  "prompt": "Giữ nguyên tư thế và bố cục của Ảnh 1, thay sang bộ trang phục ở Ảnh 2 và lấy khuôn mặt từ Ảnh 3.",
  "aspect_ratio": "9:16",
  "resolution": "1k",
  "n": "1",
  "remove_logo": false
}'

Code mẫu tích hợp đầy đủ (Upload file → Tạo tác vụ → Nhận kết quả)

Python 3

import os, time, requests

BASE = "https://mtkvideo.com/api"
API_KEY = os.environ["API_KEY"]  # lấy tại trang /api-keys
HEADERS = {"X-API-Key": API_KEY}

def upload_file(local_path: str) -> str:
    """Tải 1 file từ máy lên server và trả về URL đầu vào"""
    with open(local_path, "rb") as f:
        r = requests.post(f"{BASE}/account/ai/uploads", headers=HEADERS, files={"file": f}, timeout=120)
    data = r.json()
    if not r.ok:
        raise RuntimeError(data.get("message") or r.text)
    return data["url"]

# Bước 1: Upload tuần tự đúng thứ tự Ảnh 1 -> Ảnh 2 -> Ảnh 3 (hoặc dùng thẳng link https công khai)
image_urls = [
    upload_file("./1.jpg"),  # Ảnh 1 (Image 1 / FIRST image)
    upload_file("./2.jpg"),  # Ảnh 2 (Image 2 / SECOND image)
    upload_file("./3.jpg"),  # Ảnh 3 (Image 3 / THIRD image)
]

# Bước 2: Gửi yêu cầu tạo ảnh với đúng thứ tự mảng image_urls [1, 2, 3]
payload = {
    "model": "nano-banana-2-lite",
    "prompt": "Giữ nguyên tư thế và bố cục của Ảnh 1, thay sang bộ trang phục ở Ảnh 2 và lấy khuôn mặt từ Ảnh 3.",
    "aspect_ratio": "9:16",
    "resolution": "1k",
    "n": "1",
    "remove_logo": False
}
r = requests.post(f"{BASE}/v1/generations", headers=HEADERS, json=payload, timeout=60)
gen = r.json()
if not r.ok:
    raise RuntimeError(gen.get("message") or r.text)

# Bước 3: Hỏi trạng thái mỗi 5 giây tới khi hoàn tất
while gen["status"] in ("queued", "processing"):
    time.sleep(5)
    poll = requests.get(f"{BASE}/v1/generations/{gen['id']}", headers=HEADERS, timeout=60)
    gen = poll.json()

if gen["status"] != "succeeded":
    raise RuntimeError(gen.get("error") or gen["status"])

print("Kết quả:", [f["url"] for f in gen["output"]["files"]])

Node.js (18+)

import fs from "node:fs";
import path from "node:path";

const BASE = "https://mtkvideo.com/api";
const API_KEY = process.env.API_KEY; // lấy tại trang /api-keys

async function uploadFile(filePath) {
  const form = new FormData();
  const buf = fs.readFileSync(filePath);
  form.append("file", new Blob([buf]), path.basename(filePath));
  const res = await fetch(`${BASE}/account/ai/uploads`, {
    method: "POST",
    headers: { "X-API-Key": API_KEY },
    body: form,
  });
  const data = await res.json();
  if (!res.ok) throw new Error(data.message || res.statusText);
  return data.url;
}

// Bước 1: Upload tuần tự từng ảnh 1 -> 2 -> 3 để giữ đúng thứ tự mảng
const imageUrls = [];
for (const file of ["./1.jpg", "./2.jpg", "./3.jpg"]) {
  imageUrls.push(await uploadFile(file));
}

// Bước 2: Gửi tạo tác vụ
const createRes = await fetch(`${BASE}/v1/generations`, {
  method: "POST",
  headers: { "X-API-Key": API_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({
    ...{
  "model": "nano-banana-2-lite",
  "prompt": "Giữ nguyên tư thế và bố cục của Ảnh 1, thay sang bộ trang phục ở Ảnh 2 và lấy khuôn mặt từ Ảnh 3.",
  "aspect_ratio": "9:16",
  "resolution": "1k",
  "n": "1",
  "remove_logo": false
},
    reference_image_urls: imageUrls,
  }),
});
let gen = await createRes.json();
if (!createRes.ok) throw new Error(gen.message || createRes.statusText);

// Bước 3: Chờ kết quả
while (["queued", "processing"].includes(gen.status)) {
  await new Promise((r) => setTimeout(r, 5000));
  const pollRes = await fetch(`${BASE}/v1/generations/${gen.id}`, {
    headers: { "X-API-Key": API_KEY },
  });
  gen = await pollRes.json();
}
if (gen.status !== "succeeded") throw new Error(gen.error ?? gen.status);
console.log("Kết quả:", gen.output.files.map((f) => f.url));

Output — kết quả trả về

Tác vụ chạy bất đồng bộ. POST /v1/generations trả ngay đối tượng generation với status queued hoặc processing; hỏi lại GET /v1/generations/{id} mỗi 5–10 giây tới khi status là succeeded, failed hoặc cancelled.

GET/v1/generations/{id}
{
  "id": "3f1c...-uuid",
  "object": "generation",
  "code": "T8KQ2M4X",
  "model": "nano-banana-2-lite",
  "status": "succeeded",       // queued | processing | succeeded | failed | cancelled
  "progress": 100,
  "cost": 2400,                // số tiền đã trừ
  "currency": "VND",
  "refunded": false,
  "output": {
    "type": "image",
    "files": [{ "url": "https://mtkvideo.com/uploads/ai/outputs/....png", "type": "image", "name": "image.png" }],
    "text": null
  },
  "error": null,
  "created_at": "2026-10-30T08:00:00.000Z",
  "completed_at": "2026-10-30T08:01:12.000Z"
}
TrườngÝ nghĩa
output.files[].urlLink file kết quả — nên tải về hệ thống của bạn, file trên máy chủ có thể được dọn sau một thời gian.
output.textNội dung văn bản (chỉ có với model trả văn bản).
costSố tiền VND đã trừ vào số dư; lỗi hoặc huỷ thì tự hoàn lại (refunded = true).
errorLý do lỗi khi status = failed.

Báo giá trước khi chạy

POST/v1/generations/estimate

Cùng body với POST /v1/generations, không chạy và không trừ tiền.

# => { "object": "estimate", "model": "nano-banana-2-lite", "cost": 2400, "currency": "VND" }
Lấy API key
nano-banana-2-lite · Tài liệu API | mtkvideo.com