💰 Bảng Giá Tạo Ảnh AI
| Chất lượng | Giá / ảnh |
| Ảnh 1K | 100₫ |
| Ảnh 2K — 4K (upscale) | 150₫ |
📦 Gói 1 — Nạp theo SL
100₫/ảnh
- Nạp tối thiểu 500 ảnh
- 3 luồng mặc định
- Dùng đến khi hết
- Không giới hạn ngày
⭐ Gói 2 — Tháng 5M
5M₫/tháng
- 3 luồng mặc định
- Max 3.000 ảnh/ngày
- Reset mỗi ngày
- Hoàn tiền 70% còn lại
🚀 Gói 3 — Không giới hạn/ngày
5M₫/gói
- 3 luồng mặc định
- Tạo đến khi hết 5M
- Không giới hạn SL/ngày
- Phù hợp chạy bulk
⚡ Gói 4 — Turbo 6 luồng
200₫/ảnh
- 6 luồng — nhanh gấp đôi
- Min nạp 5M
- Tùy chọn SL theo 3 gói trên
- Ưu tiên xử lý
🎬 Video AI: Liên hệ trực tiếp để báo giá theo nhu cầu.
📞 Liên hệ: Zalo Đường Thọ — 0934415387
🚀 Bắt đầu nhanh
🔑 Xác thực: Mọi request cần header X-API-Key: YOUR_KEY. Base URL: /public/api/v1/
Bước 1: Tạo ảnh
curl -X POST /public/api/v1/text-to-image \
-H "Content-Type: application/json" \
-H "X-API-Key: " \
-d '{"prompts": ["A cute cat sleeping"}'
# → {"job_id": "gw-abc123", "status": "queued"}
Bước 2: Kiểm tra trạng thái (polling mỗi 3-5s)
curl -H "X-API-Key: " \
/public/api/v1/jobs/{job_id}
# → {"status": "completed", "progress": 100}
Bước 3: Download kết quả
# Download ảnh
curl -H "X-API-Key: " -o output.png \
/public/api/v1/jobs/{job_id}/image
# Download video
curl -H "X-API-Key: " -o output.mp4 \
/public/api/v1/jobs/{job_id}/video
Bước 4: Xem thư viện
curl -H "X-API-Key: " /public/api/v1/my-library
curl -H "X-API-Key: " /public/api/v1/my-jobs
curl -H "X-API-Key: " /public/api/v1/usage
📡 Tất cả Endpoints
📤 Upload ảnh
POST
/public/api/v1/upload-image
MULTIPART
Upload ảnh jpg/png/webp (max 20MB). Trả về path dùng cho R2I, I2V, R2V.
🎨 Text → Image (T2I)
POST
/public/api/v1/text-to-image
| Param | Type | Default | Mô tả |
prompts | string[] | required | Mảng prompt, mỗi item = 1 ảnh |
aspect_ratio | string | "1:1" | 1:1 / 16:9 / 9:16 / 4:3 / 3:4 |
num_images | int | 1 | 1-4 ảnh mỗi prompt |
🖼️ Reference → Image (R2I)
POST
/public/api/v1/reference-to-image
| Param | Type | Mô tả |
prompts | string[] | Mô tả ảnh muốn tạo |
reference_images | string[] | Đường dẫn ảnh tham chiếu (từ upload) |
aspect_ratio | string | 1:1 / 16:9 / 9:16 |
🎬 Text → Video (T2V)
POST
/public/api/v1/text-to-video
| Param | Type | Default | Mô tả |
prompts | string[] | required | Mô tả video |
aspect_ratio | string | "16:9" | 16:9 / 9:16 / 1:1 |
video_length_seconds | int | 8 | 6 / 8 / 10 giây |
🎬 Model: Video sử dụng Veo 3.1 — không cần chọn model.
📸 Image → Video (I2V)
POST
/public/api/v1/image-to-video
| Param | Type | Mô tả |
items | object[] | [{image_path, prompt}] |
aspect_ratio | string | 16:9 / 9:16 / 1:1 |
🎭 Multi-Reference → Video (R2V)
POST
/public/api/v1/multi-ref-video
| Param | Type | Mô tả |
items | object[] | [{image_paths: [...], prompt}] |
voice | string | Giọng: achernar, charon, algieba, alnilam... |
🔄 Polling & Download
GET/public/api/v1/jobs/{job_id}
GET/public/api/v1/jobs/{job_id}/image?index=0
GET/public/api/v1/jobs/{job_id}/video?index=0
📚 Thư viện & Usage
GET/public/api/v1/my-library
GET/public/api/v1/my-jobs
GET/public/api/v1/usage
📐 Chọn Aspect Ratio
| Ratio | Phù hợp |
1:1 | Instagram, avatar, thumbnail |
16:9 | YouTube, banner, website |
9:16 | TikTok, Reels, Shorts |
4:3 | Slide, blog |
3:4 | Pinterest, portrait |
🎬 Video
| Thông số | Giá trị |
| Model | Veo 3.1 (mặc định, không cần chọn) |
| Thời lượng | 6 / 8 / 10 giây |
| Thời gian xử lý | ~60-120 giây |
🖥️ Hiển thị Ảnh/Video trên Website
⚠️ Lưu ý: URL download cần header X-API-Key, không dùng trực tiếp trong <img src>. Dùng 1 trong 3 cách dưới đây.
Cách 1: Tải về server rồi serve (Khuyên dùng ✅)
// Node.js — download & lưu file
const resp = await axios.get(
`${API}/public/api/v1/jobs/${jobId}/image`,
{ headers: {'X-API-Key': KEY}, responseType: 'arraybuffer' }
);
fs.writeFileSync(`./public/media/${jobId}.png`, resp.data);
// Frontend: <img src="/media/gw-abc123.png">
Cách 2: Proxy real-time qua Express
app.get('/media/:type/:jobId', async (req, res) => {
const {type, jobId} = req.params;
const ep = type === 'video' ? 'video' : 'image';
const r = await axios.get(
`${API}/public/api/v1/jobs/${jobId}/${ep}`,
{headers: {'X-API-Key': KEY}, responseType: 'stream'}
);
res.set('Content-Type', type==='video'?'video/mp4':'image/png');
r.data.pipe(res);
});
// Frontend: <img src="/media/image/gw-abc123">
Cách 3: Blob URL (Client-side, không cần backend)
async function showMedia(jobId, el, type='image') {
const r = await fetch(
`${API}/public/api/v1/jobs/${jobId}/${type}`,
{headers: {'X-API-Key': KEY}}
);
el.src = URL.createObjectURL(await r.blob());
}
// <img id="img1"> → showMedia("gw-abc123", img1)
// <video id="vid1" controls> → showMedia("gw-abc123", vid1, "video")
💡 Gợi ý:
• E-commerce: T2I 1:1 + 4K upscale
• Social: T2V 9:16 (Reels/Shorts)
• Website: T2I 16:9 (banner) + T2V 16:9 (hero)
• Quảng cáo: R2I → I2V (ảnh sản phẩm → video)
💡 Code mẫu hoàn chỉnh
JavaScript
const API = "";
const KEY = "";
const H = {"Content-Type":"application/json","X-API-Key":KEY};
async function waitJob(id) {
while(true) {
const j = await(await fetch(`${API}/public/api/v1/jobs/${id}`,
{headers:{"X-API-Key":KEY}})).json();
if(j.status==="completed") return j;
if(j.status==="failed") throw new Error(j.error);
await new Promise(r=>setTimeout(r,3000));
}
}
// Tạo ảnh 4K
async function createImage(prompt) {
const r = await fetch(`${API}/public/api/v1/text-to-image`,
{method:"POST", headers:H,
body:JSON.stringify({prompts:[prompt]})});
const {job_id} = await r.json();
await waitJob(job_id);
return `${API}/public/api/v1/jobs/${job_id}/image`;
}
// Ảnh → Video
async function imgToVideo(file, prompt) {
const fd = new FormData(); fd.append("file", file);
const up = await(await fetch(`${API}/public/api/v1/upload-image`,
{method:"POST",body:fd,headers:{"X-API-Key":KEY}})).json();
const r = await fetch(`${API}/public/api/v1/image-to-video`,
{method:"POST", headers:H,
body:JSON.stringify({items:[{image_path:up.path,prompt}]})});
const {job_id} = await r.json();
await waitJob(job_id);
return `${API}/public/api/v1/jobs/${job_id}/video`;
}
Python
import requests, time
API = ""
KEY = ""
H = {"X-API-Key": KEY}
def wait_job(job_id, timeout=600):
t = time.time()
while time.time()-t < timeout:
j = requests.get(f"{API}/public/api/v1/jobs/{job_id}", headers=H).json()
print(f" {j['status']} — {j.get('progress',0)}%")
if j["status"]=="completed": return j
if j["status"]=="failed": raise Exception(j.get("error"))
time.sleep(5)
def create_image(prompt):
j = requests.post(f"{API}/public/api/v1/text-to-image",
json={"prompts":[prompt]},
headers={**H,"Content-Type":"application/json"}).json()
wait_job(j["job_id"])
img = requests.get(f"{API}/public/api/v1/jobs/{j['job_id']}/image", headers=H)
open(f"img_{j['job_id'][:8]}.png","wb").write(img.content)
create_image("Một chú mèo cam ngồi bệ cửa sổ")
⚠️ Xử lý lỗi
| HTTP | Nguyên nhân | Xử lý |
403 | API key sai/bị tắt | Kiểm tra key, liên hệ admin |
402 | Hết credits | /usage kiểm tra, nạp thêm |
429 | Vượt giới hạn/ngày | Chờ ngày mai hoặc nâng gói |
404 | Job chưa xong | Đợi polling completed rồi download |
⏱️ Thời gian xử lý: Ảnh ~30s · Ảnh 4K ~60s · Video ~60-120s. Polling mỗi 3-5 giây.
┌─────────────────────────────────────────────────┐
│ 1. POST /text-to-image → job_id │
│ 2. GET /jobs/{id} (poll mỗi 3s) │
│ 3. GET /jobs/{id}/image → binary PNG │
│ 4. Serve file hoặc Blob URL → <img> │
│ 5. GET /my-library → xem lại tất cả │
└─────────────────────────────────────────────────┘
Flow AI API · Powered by Google Veo & Imagen
Liên hệ: Zalo Đường Thọ — 0934415387