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:

NameTypeDescription
promptstringDescription of what to generate
options.widthnumberImage width in pixels
options.heightnumberImage height in pixels
options.modelstring(Optional) AI model to use
options.originalstring(Optional) Image URL to modify
options.profilestring(Optional) Social profile to pull image/data from
options.durationnumber(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:

NameTypeDescription
templatestringTemplate ID + version (e.g., abc123/1)
dataobjectVariables to inject into the template
durationnumber(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 duration window
  • Can be safely embedded in emails, websites, or exported to external systems

📞 Support


❤️ Build with secure, scalable AI infrastructure — with aigen.run