npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pollinations

v2.0.1

Published

A Node.js package that allows you to easily access all Pollinations features, including image generation and LLM capabilities, using their free API.

Downloads

76

Readme

Pollinations Node.js Package

A simple and powerful Node.js package that allows you to easily access all Pollinations features, including image generation and LLM capabilities, using their free API.

Table of Contents

  1. Installation
  2. Usage 3. Image Generation 4. Text Generation
  3. API Methods
  4. Examples
  5. Debugging
  6. License

Installation

To install the pollinations package, use npm:

  npm install pollinations

Usage

const Pollinations = require("pollinations");
const pollinations = new Pollinations();

// Generate an image
pollinations.images
  .generateImage({
    prompt: "A futuristic city at sunset",
    model: "flux-anime",
    width: 1024,
    height: 768
  })
  .then(image => {
    // Save the generated image
    require("fs").writeFileSync("generated-image.png", image);
  })
  .catch(error => console.error(error));

Image Generation

To generate images, you can use the images namespace.

pollinations.images
  .generateImage({
    prompt: "A futuristic city skyline",
    model: "flux",
    width: 800,
    height: 600
  })
  .then(imageBuffer => {
    // Handle the generated image buffer here
  })
  .catch(error => {
    console.error(error);
  });

Text Generation

To generate text using LLM models, use the llm namespace.

pollinations.llm
  .generateTextGet({
    prompt: "Tell me a joke.",
    model: "openai"
  })
  .then(text => {
    console.log(text);
  })
  .catch(error => {
    console.error(error);
  });

API Methods

Image Methods

getModels() Fetches a list of available image generation models.

pollinations.images
  .getModels()
  .then(models => {
    console.log(models);
  })
  .catch(error => {
    console.error(error);
  });

generateImage(options) This method generates an image based on the provided options.

| Parameter | Type | Description | | ----------------- | --------- | ------------------------------------------------------------------ | | options | Object | The options for image generation. | | options.prompt | string | The text prompt for image generation. | | options.model | string | The model to use for image generation (default is "flux"). | | options.seed | number | The seed for random generation (optional, default is null). | | options.width | number | The width of the generated image in pixels (default is 512). | | options.height | number | The height of the generated image in pixels (default is 512). | | options.nologo | boolean | Whether to remove the logo from the image (default is false). | | options.private | boolean | Whether the image is private (default is false). | | options.enhance | boolean | Whether to apply enhancement to the image (default is false). | | options.safe | boolean | Whether to apply safety filters to the image (default is false). |

LLM Methods

getModels() Fetches a list of available text generation models.

pollinations.llm
  .getModels()
  .then(models => {
    console.log(models);
  })
  .catch(error => {
    console.error(error);
  });

generateTextGet(options) Generates text based on the given prompt and options.

| Parameter | Type | Description | | ---------------- | --------- | ----------------------------------------------------------------------- | | options.prompt | string | The text prompt used for generating the content. | | options.model | string | Optional. The model to use for text generation (default is "openai"). | | options.seed | number | Optional. The seed for random generation (default is null). | | options.json | boolean | Optional. Whether to return the response as JSON (default is false). | | options.system | string | Optional. The system message (default is an empty string). |

generateTextPost(options) Generates text based on the given messages and options.

| Parameter | Type | Description | | ------------------ | --------- | ----------------------------------------------------------------------- | | options.messages | Array | The array of messages to send as the conversation history. | | options.model | string | Optional. The model to use for text generation (default is "openai"). | | options.seed | number | Optional. The seed for random generation (default is null). | | options.jsonMode | boolean | Optional. Whether to return the response as JSON (default is false). |

Debugging

To enable debugging, pass the debug option when creating a Pollinations instance:

const pollinations = new Pollinations({ debug: true });

When debugging is enabled, the package will log detailed information about API requests, responses, and warnings to the console.

License

This project is licensed under the Creative Commons Zero (CC0) License. You can modify, distribute, and use it freely, with no attribution required.