Tóm tắt — Đăng ký, chép key test, gửi một request kèm
Idempotency-Keyvàend_user_id. Pollstatus_urlđến khi run kết thúc.
Chạy style đầu tiên trong ba bước. Lệnh gọi đi từ máy chủ của bạn tới https://api.wandura.ai kèm API key.
1. Đăng ký
Đăng ký bằng email. Bạn có tài khoản cá nhân, một product Test với key test, và một product My app để chạy thật.
2. Lấy key
Key test (wdr_test_…) hiện một lần khi đăng ký. Key test trả kết quả mẫu với giá $0, nên bạn dựng xong cả tích hợp trước khi nạp tiền. Key live (wdr_live_…) chạy thật và trừ ví của product. Giữ key trên máy chủ:
export WANDURA_API_KEY=wdr_test_...3. Gửi request đầu tiên
Mỗi lần gửi cần header Idempotency-Key và end_user_id (người dùng trong app của bạn) trong body.
curl -X POST https://api.wandura.ai/v2/styles/sty_ghibli_portrait \
-H "Authorization: Bearer $WANDURA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"lane": "priority", "end_user_id": "user_123", "inputs": {"subject": "a girl smiling at the camera"}}'Với SDK:
import { Wandura } from '@wandura/sdk';
const wandura = new Wandura(); // reads WANDURA_API_KEY
const run = await wandura.runs.createAndWait('sty_ghibli_portrait', {
lane: 'priority',
end_user_id: 'user_123',
inputs: { subject: 'a girl smiling at the camera' },
});
console.log(run.status, run.output?.[0]?.url);from wandura import Wandura
wandura = Wandura() # reads WANDURA_API_KEY
run = wandura.runs.create_and_wait("sty_ghibli_portrait", {
"lane": "priority",
"end_user_id": "user_123",
"inputs": {"subject": "a girl smiling at the camera"},
})
print(run["status"], run.get("output"))Phản hồi là một run có request_id, status_url và cancel_url. Poll status_url hoặc nhận webhook có ký khi xong.
Hỏi kết quả
curl https://api.wandura.ai/v2/runs/run_Qk2m9XaB7Lc4 -H "Authorization: Bearer $WANDURA_API_KEY"Priority: bắt đầu ở 2 s, nhân 1.5 mỗi lần, tối đa 10 s, cộng thêm 0–0.5 s ngẫu nhiên. Relax: 10 s đến 60 s. Trạng thái cuối: completed, failed, nsfw, canceled.
Tiếp theo
- Khái niệm: run, lane, run miễn phí, webhook, giới hạn, idempotency, end-user ID.
- Danh sách style: mọi style kèm đầu vào và giá.
- SDK: client JavaScript và Python chính thức làm sẵn mọi việc trên.
- Dựng bằng AI agent? Đưa cho nó
https://api.wandura.ai/v2/openapi.json.
Cập nhật 14/10/2026 · Lịch sử thay đổi (1)