imagen-generator-ai-flux
v1.0.0
Published
Interactive CLI to generate AI images using Replicate API and FLUX models
Maintainers
Readme
AI Image Generator (Replicate + FLUX)
Interactive terminal app to generate photorealistic images using the Replicate API and FLUX models.
Developed by Omar Fuentes — website: omarfuentes.com
Features
- Interactive CLI
- FLUX models
- Persistent session (keeps selected model, output folder and format during the session)
- Custom output folder
- PNG/JPG output
- Automatic filename normalization
Requirements
- Node.js 16+
- A Replicate account
- A Replicate API token
Installation
npm installInstall from npm
Global install:
npm install -g imagen-generator-ai-fluxRun:
ai-image-genConfiguration (Replicate token)
This project reads the token from REPLICATE_API_TOKEN.
Option A: Use a .env / .ENV file (recommended)
Create a file called .env (or .ENV) in the project root:
REPLICATE_API_TOKEN=r8_your_replicate_token_hereOption B: Set the environment variable
PowerShell (Windows):
$env:REPLICATE_API_TOKEN="r8_your_replicate_token_here"CMD (Windows):
set REPLICATE_API_TOKEN=r8_your_replicate_token_heremacOS / Linux (bash/zsh):
export REPLICATE_API_TOKEN="r8_your_replicate_token_here"Usage
Run the generator:
node image-generator.jsOr:
npm startWorkflow
- Choose a FLUX model.
- Enter a descriptive prompt.
- Choose an output folder (it will be created if it doesn’t exist).
- Choose the image format (PNG/JPG).
- Name your image (it will be normalized automatically).
Prompt tips
Good prompts are visual and specific. Examples:
"A sunset at the beach, orange and purple sky, waves breaking on the shore, professional photography, ultra-detailed"
"Portrait of a woman with long red hair and green eyes, natural lighting, shallow depth of field, cinematic look"
"Futuristic city street with tall buildings, blue and pink neon lights, wet ground reflecting the lights, cyberpunk style"Avoid vague prompts like:
"a plane"
"person"
"city"Project structure
.
├── image-generator.js
├── package.json
└── README.mdCustomization
Change available models
Edit FLUX_MODELS inside image-generator.js.
Adjust generation parameters
Edit the input object passed to replicate.run() inside generateImage().
Troubleshooting
REPLICATE_API_TOKEN is not configured
- Ensure
REPLICATE_API_TOKENis set in the same terminal where you run the script, or create a.env/.ENVfile. - Verify the token is correct and active in your Replicate account.
Download errors
- Check your internet connection.
- Ensure you have write permissions to the selected output folder.
Replicate API errors
- Confirm you have available credits / billing set up.
- Make sure the selected model exists and is available.
Security
Do not commit your token to GitHub.
License
MIT
