@ai-generator/cli
v0.1.2
Published
CLI for connecting AI Generator content creation to personal Agents
Maintainers
Readme
ai-generator
Node.js CLI for AI Generator image and video generation from a terminal, script, or personal Agent.
Requirements
- Node.js 18 or newer
- The production server URL:
https://aiaigenerator.ai(override withAI_GENERATOR_BASE_URLonly for development or self-hosted deployments) - A CLI access key created from the server's
/clipage
Install
npm install --global @ai-generator/cliFor local development from this repository:
node cli/bin/ai-generator.mjs --helpAuthentication
Prefer an environment variable for Agents, CI, and automation:
export AI_GENERATOR_API_KEY="ai_live_..."
export AI_GENERATOR_BASE_URL="https://aiaigenerator.ai"For local Agent setup, save the key on the device in a plain-text file first. Do not send the key in the Agent chat:
mkdir -p ~/.ai-generator
${EDITOR:-nano} ~/.ai-generator/cli-key.txtThen let the CLI read that local file and write its protected configuration at ~/.ai-generator/config.json:
ai-generator auth set --key-file ~/.ai-generator/cli-key.txt --base-url "https://aiaigenerator.ai"
ai-generator auth show --jsonOn Windows, use %USERPROFILE%\.ai-generator\cli-key.txt as the local file path. The --key-file option reads the key without putting it in command arguments or CLI output. Keep the file out of Git and shared folders; delete it after setup if the local config is sufficient.
For CI or other non-interactive automation, use AI_GENERATOR_API_KEY through the secret manager instead of a text file.
Commands
ai-generator generate-image --prompt "A product photo" --wait --json
ai-generator generate-image --prompt "Edit this image" --image ./reference.png --wait --json
ai-generator generate-image --prompt "A 4K product photo" --model google/nano-banana-pro --size 16:9 --resolution 4K --wait --json
ai-generator generate-video --prompt "A slow product reveal" --aspect-ratio landscape --frames 10 --wait --json
ai-generator task-status --task-id <id> --type video --json
ai-generator task-download --task-id <id> --type video --output-dir ./outputs --json
ai-generator credits --jsongenerate-image and generate-video call the image and video generation APIs directly. The CLI does not use the website's internal Agent drawing workflow. Image requests support --model, --size, --resolution, and --number-of-images; the server calculates the final credit cost from the selected model and parameters instead of trusting a client-supplied cost. Video supports text-to-video or image-to-video based on whether --image is provided.
Use --model to select a configured image or video model. The supported model and parameter combinations are validated by the CLI and server. Use --help and --version to inspect the local command surface.
JSON output
Use --json when another Agent or script consumes the result. Creation returns a task ID. With --wait, the response also includes the normalized terminal task status. Result files can be downloaded after a successful task.
Development
pnpm cli:test
npm pack --dry-run