
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
pollinations
Advanced tools
A Node.js package that allows you to easily access all Pollinations features, including image generation and LLM capabilities, using their free API.
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.
To install the pollinations
package, use npm:
npm install pollinations
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));
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);
});
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);
});
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 ). |
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 ). |
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.
This project is licensed under the Creative Commons Zero (CC0) License. You can modify, distribute, and use it freely, with no attribution required.
FAQs
A Node.js package that allows you to easily access all Pollinations features, including image generation and LLM capabilities, using their free API.
We found that pollinations demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.