Skip to content

MVP of Pollinations.AI - AI-powered Image Generation API. A simplified version focusing on core image generation functionality with FLUX models.

License

Notifications You must be signed in to change notification settings

gitmvp-com/pollinations-mvp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌸 Pollinations MVP - Image Generation API

A simplified MVP version of Pollinations.AI focusing on core image generation functionality.

License: MIT

πŸš€ Features

  • ✨ Simple Image Generation - Generate images from text prompts via URL
  • 🎨 FLUX Model Support - Uses advanced AI models for high-quality images
  • πŸ”§ Customizable Parameters - Control width, height, seed, and more
  • ⚑ Fast & Lightweight - Minimal dependencies, easy to deploy
  • πŸ†“ Free to Use - No API keys required for basic usage

πŸ“¦ Installation

# Clone the repository
git clone https://github.com/gitmvp-com/pollinations-mvp.git
cd pollinations-mvp

# Install dependencies
npm install

# Copy environment configuration
cp .env.example .env

# Start the server
npm start

🎯 Quick Start

Start the Server

npm start

The server will start on http://localhost:16384

Generate Your First Image

Open your browser or use curl:

# Simple generation
curl -o image.jpg "http://localhost:16384/prompt/a%20beautiful%20sunset%20over%20mountains"

# With custom parameters
curl -o image.jpg "http://localhost:16384/prompt/cyberpunk%20city?width=1920&height=1080&seed=42"

πŸ”§ API Usage

Generate Image

Endpoint: GET /prompt/{prompt}

Parameters:

Parameter Type Default Description
width integer 1024 Image width in pixels
height integer 1024 Image height in pixels
seed integer random Seed for reproducible results
model string flux Model to use (flux, turbo)
enhance boolean false Auto-enhance prompt

Example:

# Generate a landscape image
curl "http://localhost:16384/prompt/mountain%20landscape?width=1920&height=1080&seed=123" > landscape.jpg

# Generate with enhanced prompt
curl "http://localhost:16384/prompt/cute%20cat?enhance=true" > cat.jpg

List Available Models

Endpoint: GET /models

curl http://localhost:16384/models

Response:

["flux", "turbo"]

🌐 Integration Examples

Python

import requests
from urllib.parse import quote

prompt = "A serene mountain landscape at sunrise"
url = f"http://localhost:16384/prompt/{quote(prompt)}"
params = {"width": 1280, "height": 720, "seed": 42}

response = requests.get(url, params=params)
with open("image.jpg", "wb") as f:
    f.write(response.content)

print("Image generated successfully!")

JavaScript (Node.js)

import fetch from 'node-fetch';
import fs from 'fs';

const prompt = "A futuristic city with flying cars";
const url = `http://localhost:16384/prompt/${encodeURIComponent(prompt)}?width=1280&height=720`;

const response = await fetch(url);
const buffer = await response.buffer();
fs.writeFileSync('city.jpg', buffer);

console.log('Image generated successfully!');

HTML (Direct Image)

<img src="http://localhost:16384/prompt/beautiful%20sunset?width=800&height=600" 
     alt="AI Generated Sunset" />

πŸ—οΈ Architecture

This MVP is intentionally simple:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Client Request β”‚
β”‚  /prompt/...    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   HTTP Server   β”‚
β”‚  (Node.js)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Rate Limiter   β”‚
β”‚  (IP-based)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Image Generator β”‚
β”‚ (FLUX API)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚
         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Return Image   β”‚
β”‚   (JPEG/PNG)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

pollinations-mvp/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.js          # Main server
β”‚   β”œβ”€β”€ generator.js      # Image generation logic
β”‚   β”œβ”€β”€ rateLimiter.js    # Simple rate limiting
β”‚   └── utils.js          # Helper functions
β”œβ”€β”€ .env.example          # Environment template
β”œβ”€β”€ package.json          # Dependencies
└── README.md            # Documentation

πŸ” Configuration

Edit .env to customize:

# Server port
PORT=16384

# Image generation API (default: Pollinations public API)
IMAGE_API_URL=https://image.pollinations.ai/prompt

# Rate limiting (milliseconds between requests)
RATE_LIMIT_INTERVAL=30000

πŸš€ Deployment

Docker

# Build
docker build -t pollinations-mvp .

# Run
docker run -p 16384:16384 pollinations-mvp

Node.js

# Production mode
NODE_ENV=production npm start

🀝 Differences from Full Pollinations.AI

This MVP focuses on simplicity and includes only:

βœ… Included:

  • Basic image generation
  • Simple rate limiting
  • Model selection (flux, turbo)
  • Parameter customization

❌ Not Included (in full version):

  • Advanced authentication system
  • Multiple backend services
  • Real-time feeds
  • Audio generation
  • Text generation
  • Vision/multimodal features
  • React hooks library
  • Advanced caching strategies
  • Content safety filters
  • Analytics & telemetry

πŸ“š Learn More

πŸ“„ License

MIT License - see LICENSE file for details.

πŸ™ Credits

This MVP is inspired by the amazing work of the Pollinations.AI team. This is a simplified educational version focusing on core image generation features.


Made with ❀️ for learning and experimentation

About

MVP of Pollinations.AI - AI-powered Image Generation API. A simplified version focusing on core image generation functionality with FLUX models.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published