npm package: @rodriguetg/n8n-pollinations
Description: n8n community node for Pollinations.ai - Generate images, text, and audio using AI
Author: Rodrigue Gbadou
Latest version: 1.0.0

# n8n-nodes-pollinations

[![npm version](https://badge.fury.io/js/n8n-nodes-pollinations.svg)](https://badge.fury.io/js/n8n-nodes-pollinations)
[![NPM Downloads](https://img.shields.io/npm/dm/n8n-nodes-pollinations.svg)](https://www.npmjs.com/package/n8n-nodes-pollinations)

This is an n8n community node that integrates [Pollinations.ai](https://pollinations.ai) - a free, open-source generative AI platform.

[n8n](https://n8n.io/) is a fair-code licensed workflow automation platform.

## Features

This node provides access to Pollinations.ai's powerful AI generation capabilities:

### 🖼️ Image Generation
- **Multiple Models**: Flux, Flux-Realism, Flux-Anime, Flux-3D, Turbo, and more
- **Simple & Advanced Modes**: Quick generation or full control over parameters
- **Customization**: Control dimensions, seed, watermark, enhancement, and privacy
- **Output Options**: Binary data or URL

### 💬 Text Generation  
- **Multiple LLMs**: GPT-4, Claude, Gemini, DeepSeek, Mistral, and more
- **Chat Completion**: Full conversation history support
- **Advanced Options**: System messages, temperature, max tokens, JSON mode
- **Simple Mode**: Quick text generation from prompts

### 🎙️ Audio Generation
- **Text-to-Speech**: Convert text to natural-sounding audio
- **Multiple Voices**: Alloy, Echo, Fable, Onyx, Nova, Shimmer
- **Binary Output**: Direct audio file download

## Installation

### Community Nodes (Recommended)

1. Go to **Settings** > **Community Nodes** in your n8n instance
2. Click **Install** 
3. Enter `n8n-nodes-pollinations`
4. Click **Install**

### Manual Installation

Navigate to your n8n installation directory and run:

```bash
npm install n8n-nodes-pollinations
```

For Docker-based installations:

```bash
docker exec -it n8n npm install n8n-nodes-pollinations
```

Then restart your n8n instance.

## Configuration

### API Key (Optional)

While Pollinations.ai works without authentication, you can obtain a free API key for higher rate limits:

1. Visit [enter.pollinations.ai](https://enter.pollinations.ai)
2. Sign in with GitHub
3. Create an API key
4. Add it to your n8n credentials:
   - Go to **Credentials** > **Add Credential**
   - Select **Pollinations API**
   - Enter your API key

**Note**: Without an API key, you're limited to one request every 15 seconds. With an API key, you get much higher limits.

## Usage Examples

### Image Generation (Simple)

```json
{
  "resource": "image",
  "operation": "generate",
  "imageMode": "simple",
  "prompt": "A futuristic city at sunset with flying cars",
  "imageModel": "flux",
  "outputFormat": "binary"
}
```

### Image Generation (Advanced)

```json
{
  "resource": "image",
  "operation": "generate",
  "imageMode": "advanced",
  "prompt": "A serene Japanese garden in spring",
  "imageModel": "flux-realism",
  "width": 1280,
  "height": 720,
  "seed": 42,
  "nologo": true,
  "enhance": true,
  "private": false,
  "outputFormat": "binary"
}
```

### Text Generation (Simple)

```json
{
  "resource": "text",
  "operation": "generate",
  "textMode": "simple",
  "textPrompt": "Explain quantum computing in simple terms",
  "textModel": "openai"
}
```

### Text Generation (Advanced)

```json
{
  "resource": "text",
  "operation": "generate",
  "textMode": "advanced",
  "textPrompt": "Create a JSON object describing a fictional character",
  "textModel": "claude",
  "systemMessage": "You are a creative writer specializing in character development",
  "temperature": 0.9,
  "maxTokens": 2000,
  "jsonMode": true
}
```

### Chat Completion

```json
{
  "resource": "text",
  "operation": "chat",
  "textModel": "gemini",
  "messages": {
    "messageValues": [
      {
        "role": "system",
        "content": "You are a helpful assistant"
      },
      {
        "role": "user",
        "content": "What's the weather like?"
      },
      {
        "role": "assistant",
        "content": "I don't have access to real-time weather data."
      },
      {
        "role": "user",
        "content": "Can you tell me a joke instead?"
      }
    ]
  }
}
```

### Audio Generation

```json
{
  "resource": "audio",
  "operation": "generate",
  "audioText": "Welcome to n8n automation with Pollinations AI. This is a test of the text to speech feature.",
  "voice": "nova"
}
```

## Workflow Ideas

1. **Social Media Automation**
   - Generate images for posts
   - Create captions with AI
   - Schedule posts automatically

2. **Content Creation Pipeline**
   - Generate blog post ideas (text)
   - Create featured images (image)
   - Generate podcast intros (audio)

3. **E-commerce Product Images**
   - Generate product variations
   - Create lifestyle images
   - Batch process product descriptions

4. **Customer Support**
   - Auto-generate responses with chat completion
   - Create help documentation with AI
   - Generate visual guides

5. **Data Enrichment**
   - Analyze text sentiment
   - Generate summaries
   - Extract structured data with JSON mode

## Available Models

### Image Models
- `flux` - High-quality balanced generation (default)
- `flux-realism` - Photorealistic images
- `flux-cablyai` - Artistic style
- `flux-anime` - Anime-style images
- `flux-3d` - 3D-style renders
- `turbo` - Fast generation

### Text Models
- `openai` / `openai-large` / `openai-fast` - GPT-4 variants
- `claude` / `claude-large` / `claude-fast` - Anthropic Claude
- `gemini` / `gemini-large` / `gemini-search` - Google Gemini
- `deepseek` - DeepSeek V3.2
- `qwen-coder` - Qwen3-Coder
- `mistral` - Mistral AI

### Audio Voices
- `alloy`, `echo`, `fable`, `onyx`, `nova`, `shimmer`

## Rate Limits

- **Anonymous**: 1 request per 15 seconds
- **With API Key**: Much higher limits (check [enter.pollinations.ai](https://enter.pollinations.ai))

## Troubleshooting

### "Authentication failed"
- Verify your API key is correct
- Check if the key is still valid at enter.pollinations.ai

### "Rate limit exceeded"
- Add an API key for higher limits
- Implement wait/retry logic in your workflow

### "Image generation failed"
- Check if your prompt contains inappropriate content
- Try a different model
- Verify image dimensions are within limits (256-2048px)

## Resources

- [Pollinations.ai Website](https://pollinations.ai)
- [API Documentation](https://github.com/pollinations/pollinations/blob/main/APIDOCS.md)
- [n8n Community Forum](https://community.n8n.io)
- [GitHub Issues](https://github.com/yourusername/n8n-nodes-pollinations/issues)

## Development

```bash
# Install dependencies
npm install

# Build the node
npm run build

# Watch mode for development
npm run dev

# Lint
npm run lint

# Format code
npm run format
```

## License

[MIT](LICENSE.md)

## Author

Created by Rodrigue - [GitHub](https://github.com/yourusername)

## Support

If you find this node helpful, please:
- ⭐ Star the [GitHub repository](https://github.com/yourusername/n8n-nodes-pollinations)
- 🐛 Report bugs via [GitHub Issues](https://github.com/yourusername/n8n-nodes-pollinations/issues)
- 💡 Suggest features or improvements
- 🌸 Support Pollinations.ai at [pollinations.ai](https://pollinations.ai)

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request