AIGen SDK (Node.js) Reference
This is the official reference for the AIGen Node.js SDK. Use it to generate AI images, personalize templates, and securely share results via signed URLs.
💡 Requires Node.js 16+ and a secret API key from aigen.run
Installation
npm install aigen-sdk
Or run instantly without installing:
npx aigen-sdk
Import & Initialize
import AigenSDK from 'aigen-sdk'
// OR
const AigenSDK = require('aigen-sdk')
const aigen = new AigenSDK('your-secret-key')
// Or use environment variable: AIGEN_SECRET
generateImage(prompt, options) → Promise
Generates an AI image based on a prompt and returns a secure URL.
Parameters:
| Name | Type | Description |
|---|---|---|
prompt | string | Description of what to generate |
options.width | number | Image width in pixels |
options.height | number | Image height in pixels |
options.model | string | (Optional) AI model to use |
options.original | string | (Optional) Image URL to modify |
options.profile | string | (Optional) Social profile to pull image/data from |
options.duration | number | (Optional) URL validity in hours (default: 24) |
Example:
const url = await aigen.generateImage('A space astronaut in a colorful nebula', {
width: 1024,
height: 768,
model: 'gpt-image-1@openai'
})
createImage(options) → Promise
Generates an image from a visual template and data.
Parameters:
| Name | Type | Description |
|---|---|---|
template | string | Template ID + version (e.g., abc123/1) |
data | object | Variables to inject into the template |
duration | number | (Optional) URL validity in hours (default: 24) |
Example:
const url = await aigen.createImage({
template: 'cert-001/2',
data: {
name: 'Jane Doe',
course: 'AI Fundamentals'
}
})
CLI Support
Every SDK function has a matching CLI command.
npx aigen-sdk generate 'prompt' [--options]npx aigen-sdk template 'templateId/version' --data.name="..."
Refer to the CLI guide for full details.
🔐 Security
- All URLs are signed with HMAC SHA-256
- Only valid within the defined
durationwindow - Can be safely embedded in emails, websites, or exported to external systems
📞 Support
❤️ Build with secure, scalable AI infrastructure — with aigen.run
Other pages
AI models & Pricing Guide
List of all AI models you can use
Advanced Image Editing
All the options you have to edit images with AI
Generate images
All the options you have to generate images with AI
Image templates
How you can use image templates to have more fine control of the AI generated images
AIGen SDK (Node.js) Reference
This is the official reference for the AIGen Node.js SDK. Use it to generate AI images, personalize templates, and securely share results via signed URLs.