Lấy API key
Vào Settings → API trong dashboard, click Generate New Key. Copy ngay vì key chỉ hiển thị 1 lần.
# .env
NEXA_API_KEY=nx_live_xxxxxHướng dẫn viết prompt hiệu quả, API reference, quickstart và best practices từ team Nexa AI.
Quickstart
Chỉ cần 5 bước để generate website đầu tiên qua API.
Vào Settings → API trong dashboard, click Generate New Key. Copy ngay vì key chỉ hiển thị 1 lần.
# .env
NEXA_API_KEY=nx_live_xxxxxCài package chính thức bằng npm hoặc pnpm.
npm install @nexa-ai/sdkKhởi tạo client với API key và locale mặc định.
import { Nexa } from '@nexa-ai/sdk';
const nexa = new Nexa({
apiKey: process.env.NEXA_API_KEY,
locale: 'vi',
});Gọi method generate với prompt mô tả website bạn cần.
const result = await nexa.generate({
prompt: 'Landing page cho startup SaaS B2B chuyên về logistics',
template: 'saas-modern',
});Lấy preview URL từ result hoặc trigger deploy lên Vercel.
console.log(result.preview_url);
await result.deploy({ provider: 'vercel' });Sections
Tài liệu được tổ chức theo nhóm nhiệm vụ — chọn section phù hợp với việc bạn đang làm.
Code
Đoạn code đầy đủ để bạn copy-paste và chạy ngay — gồm initialization, generation, error handling và deploy.
import { Nexa } from '@nexa-ai/sdk';
const nexa = new Nexa({ apiKey: process.env.NEXA_API_KEY });
async function buildLanding() {
try {
const result = await nexa.generate({
prompt: 'Landing page cho dịch vụ tư vấn tài chính cá nhân',
template: 'consulting-clean',
locale: 'vi',
});
console.log('Preview:', result.preview_url);
await result.deploy({ provider: 'vercel', projectName: 'finconsult' });
} catch (err) {
console.error('Generation failed:', err.message);
}
}
buildLanding();Hỗ trợ developer
Discord cộng đồng có 5.000+ developer đang dùng Nexa AI. Team Nexa thường xuyên active và phản hồi trong vòng vài giờ.