doxie.com.vn
Tài liệu API

nano-banana-pro

Nano Banana Pro — Tạo và chỉnh sửa ảnh AI tốc độ cao bằng Nano Banana Pro — hiểu sâu mô tả tiếng Việt, giữ nét mặt & chi tiết chủ thể tự nhiên, hỗ trợ tới 3 ảnh tham chiếu giữ đồng nhất nhân vật/bối cảnh, đa tỉ lệ khung hình (16:9, 9:16, 1:1), không giới hạn ký tự mô tả.

SV22 (sv22) · healthymodel: nano-banana-proroute_id: nano-banana-pro-3type: imageoutput: image68đ
Các Server (SV) hiện có của model nano-banana-proGET /api/v1/models/nano-banana-pro/servers

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).

68đ
1 ảnh:68đ / ảnh

{{50}}đ / ảnh · mỗi ảnh gửi kèm +{{60}}đ

Input — tham số đầu vào

POST/v1/generations

Gửi JSON theo cấu trúc chuẩn "model": "nano-banana-pro", "server": "sv22" 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-prohoặc nano-banana-pro-3Mã model chuẩn (kết hợp cùng tham số server bên dưới) hoặc mã route trực tiếp
serverstringsv22autoChốt máy chủ chạy đơn (vd sv22) hoặc auto để tự chọn SV healthy giá tốt nhất. Kiểm tra SV sống qua GET /v1/models/nano-banana-pro/servers.
promptrequiredstring
Mô tả (prompt)
image_urlsstring[] (URL image)

Tối đa 3 file

Ảnh đầu vào / tham chiếu (tuỳ chọn, tối đa 3) — Để trống = tạo ảnh mới từ mô tả. Gọi ảnh trong mô tả là <IMAGE_0>, <IMAGE_1>… (hoặc Ảnh 1, Ảnh 2…).
aspect_ratiorequiredenum
16:99:161:1

Mặc định: 16:9

Tỉ lệ khung hình
  • 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 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://doxie.com.vn/api/v1/generations \
  -H "X-API-Key: $API_KEY" -H "Content-Type: application/json" \
  -d '{
  "model": "nano-banana-pro",
  "server": "sv22",
  "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": "16:9"
}'

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://doxie.com.vn/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-pro",
    "server": "sv22",
    "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": "16:9"
}
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://doxie.com.vn/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-pro",
  "server": "sv22",
  "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": "16:9"
},
    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-pro-3",
  "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://doxie.com.vn/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-pro-3", "cost": 2400, "currency": "VND" }
Lấy API key
nano-banana-pro-3 · Tài liệu API | doxie.com.vn