Generate images using the Pollinations.ai API. Supports models such as flux, zimage, imagen-4, klein, klein-large, gptimage (free), and seedream, kontext, nanobanana, gptimage-large (paid). Use when the user asks to generate, create, or draw images from text prompts.
Generate images from text descriptions using the Pollinations.ai API.
Run the generation script at {baseDir}/scripts/generate.mjs with node. Pass all parameters as --key value CLI flags.
| Parameter | Description |
|---|---|
--prompt | Text description of the image to generate. You should craft a detailed, high-quality prompt based on the user's request. |
--model | AI model to use (see model list below) |
| Parameter | Description | Default |
|---|---|---|
--output | Output file path. Parent directories will be created automatically. If omitted, saves to current directory with a timestamped filename | auto |
--width | Image width in pixels | 1024 |
--height | Image height in pixels | 1024 |
--seed | Random seed for reproducible results. Use -1 for random | 0 |
--enhance | Set to true to let AI improve the prompt for better results | false |
--negative_prompt | Things to avoid in the image | "worst quality, blurry" |
--safe | Set to true to enable safety content filters | false |
--quality | Image quality: low, medium, high, hd (gptimage only) | medium |
--image | Reference image URL(s), comma/pipe separated for multiple | - |
--transparent | Set to true for transparent background (gptimage only) | false |
Free models (always available):
flux — Fast, high-quality image generation (default)zimage — High-quality image generationimagen-4 — Google Imagen 4klein — Klein image generationklein-large — Klein large image generationgptimage — GPT Image (supports quality and transparent options)Paid models (requires POLLINATIONS_PAID=true):
seedream / seedream-pro — Seedream image generationkontext — Kontext modelnanobanana / nanobanana-pro — NanoBanana image generationgptimage-large — GPT Image large variantnode {baseDir}/scripts/generate.mjs --prompt "a beautiful sunset over mountains" --model flux
node {baseDir}/scripts/generate.mjs --prompt "a panoramic futuristic cityscape at night" --model imagen-4 --width 1536 --height 768
node {baseDir}/scripts/generate.mjs --prompt "a red panda sitting on a branch" --model klein --seed 42
node {baseDir}/scripts/generate.mjs --prompt "cat" --model zimage --enhance true
node {baseDir}/scripts/generate.mjs --prompt "a professional product photo of sneakers" --model flux --negative_prompt "blurry, low quality, watermark, text"
node {baseDir}/scripts/generate.mjs --prompt "a fantasy battle scene" --model klein-large --safe true
node {baseDir}/scripts/generate.mjs --prompt "an oil painting of a library interior" --model gptimage --quality hd
node {baseDir}/scripts/generate.mjs --prompt "a cartoon robot mascot" --model gptimage --transparent true
node {baseDir}/scripts/generate.mjs --prompt "make it look like a watercolor painting" --model kontext --image "https://example.com/photo.jpg"
node {baseDir}/scripts/generate.mjs --prompt "a watercolor landscape" --model flux --output /tmp/landscape.jpg
node {baseDir}/scripts/generate.mjs --prompt "a detailed fantasy map" --model gptimage --width 2048 --height 2048 --quality hd --seed 123 --negative_prompt "blurry, text" --safe true --output ./map.png
--output is specified, the file is saved to that path; otherwise a timestamped filename is used in the current directory.POLLINATIONS_PAID env var. If POLLINATIONS_PAID is not true, only free models can be used.flux for images if no preference.