Skip to content

Installation

Terminal window
npm install @teamflojo/floimg

Or with your preferred package manager:

Terminal window
pnpm add @teamflojo/floimg
yarn add @teamflojo/floimg

floimg uses a plugin architecture. Install only the generators you need:

Terminal window
# AI image generation (choose one or more)
npm install @teamflojo/floimg-openai # DALL-E 3
npm install @teamflojo/floimg-stability # Stable Diffusion (SDXL, SD3)
npm install @teamflojo/floimg-google # Google Imagen
npm install @teamflojo/floimg-replicate # 1000+ AI models
npm install @teamflojo/floimg-ollama # Local models (no API key)
npm install @teamflojo/floimg-xai # Grok
# Charts and data visualization
npm install @teamflojo/floimg-quickchart
npm install @teamflojo/floimg-d3
# Diagrams
npm install @teamflojo/floimg-mermaid
# Utilities
npm install @teamflojo/floimg-qr
npm install @teamflojo/floimg-screenshot

Create a simple test file:

test.ts
import createClient from '@teamflojo/floimg';
import openai from '@teamflojo/floimg-openai';
const floimg = createClient();
floimg.registerGenerator(openai({ apiKey: process.env.OPENAI_API_KEY }));
const image = await floimg.generate({
generator: 'openai',
params: { prompt: 'A serene mountain landscape at sunset' }
});
await floimg.save(image, './test-image.png');
console.log('Image saved to test-image.png');

Run it:

Terminal window
OPENAI_API_KEY=sk-... npx tsx test.ts