Skip to main content

pollinations.ai - Free AI Image, Text, and Audio Generation

License Python Versions

pollinations.ai: (https://pollinations.ai/)

Work with the best generative AI from Pollinations using this Python SDK. 🐝

Installing

pip install pollinations
pip install pollinations.ai

# Linux/macOS
python3 -m pip install pollinations
python3 -m pip install pollinations.ai

# Windows
py -3 -m pip install pollinations
py -3 -m pip install pollinations.ai

Usage

Image Generation

View Code Example
import pollinations

"""
(method) def __init__(
    self: Self@Image,
    model: ImageModel | None = "flux",
    width: Width | None = 1024,
    height: Height | None = 1024,
    seed: Seed | None = "random",
    nologo: NoLogo | None = False,
    private: Private | None = False,
    enhance: Enhance | None = False,
    safe: Safe | None = False,
    referrer: Referrer | None = "pollinations.py",
    *any_kwargs_will_be_passed_in_request: Args,
    **kwargs: Kwargs,
) -> None
"""

model = pollinations.Image()

"""
(method) def __call__(
    self: Self@Image,
    prompt: Prompt,
    negative: Negative | None = "",
    *args: Args,
    file: Filename | None = "pollinations-image.jpeg",
    save: Save = False,
    *kwargs: Kwargs
) -> PILImage
"""

image = model("A dog and cat.")
image.save("my_image.jpeg")
# Alternatively:
# image = model.Generate("A dog and cat.", file="my_image.jpeg", save=True)
(Async) View Code Example
import pollinations

"""
(method) def __init__(
    self: Self@Image,
    model: ImageModel | None = "flux",
    width: Width | None = 1024,
    height: Height | None = 1024,
    seed: Seed | None = "random",
    nologo: NoLogo | None = False,
    private: Private | None = False,
    enhance: Enhance | None = False,
    safe: Safe | None = False,
    referrer: Referrer | None = "pollinations.py",
    *any_kwargs_will_be_passed_in_request: Args,
    **kwargs: Kwargs,
) -> None
"""

model = pollinations.Image()

"""
(method) async def Async(
    self: Self@Image,
    prompt: Prompt,
    negative: Negative | None = "",
    *args: Args,
    file: Filename | None = "pollinations-image.jpeg",
    save: Save = False,
    *kwargs: Kwargs
) -> PILImage
"""

image = await model.Async("A dog and cat.")
image.save("my_image.jpeg")
# Alternatively:
# image = await model.Async("A dog and cat.", file="my_image.jpeg", save=True)

Text Generation

View Code Example
import pollinations

"""
(method) def __init__(
    self: Self@Text,
    model: Model | None = "openai",
    system: System | None = "You are a helpful AI assistant.",
    contextual: Contextual | None = False,
    messages: Messages | None = [],
    private: Private | None = False,
    seed: Seed | None = "random",
    reasoning_effort: ReasoningEffort | None = "medium",
    tools: Tools | None = [],
    tool_choices: ToolChoice | None = [],
    voice: Voice | None = None,
    json_mode: JsonMode | None = False,
    referrer: Referrer | None = "pollinations.py",
    openai_endpoint: UseOpenAIEndpoint | None = False,
    *any_kwargs_will_be_passed_in_request: Args,
    **kwargs: Kwargs,
) -> None
"""

model = pollinations.Text()

"""
(method) def __call__(
    self: Self@Text,
    prompt: Prompt | None = None,
    *any_kwargs_will_be_passed_in_request: Args,
    stream: Stream | None = False,
    **kwargs: Kwargs
) -> Output
"""

print(model("Hello, what is 1 + 1?"))
# Alternatively:
# print(model.Generate("Hello, what is 1 + 1?"))


# Streaming
for token in model("Hello, what is 1 + 1?", stream=True):
    print(token, end="", flush=True)
    
# Alternatively:
# for token in model.Generate("Hello, what is 1 + 1?", stream=True):
#     print(token, end="", flush=True)
(Async) View Code Example
import pollinations

"""
(method) def __init__(
    self: Self@Text,
    model: Model | None = "openai",
    system: System | None = "You are a helpful AI assistant.",
    contextual: Contextual | None = False,
    messages: Messages | None = [],
    private: Private | None = False,
    seed: Seed | None = "random",
    reasoning_effort: ReasoningEffort | None = "medium",
    tools: Tools | None = [],
    tool_choices: ToolChoice | None = [],
    voice: Voice | None = None,
    json_mode: JsonMode | None = False,
    referrer: Referrer | None = "pollinations.py",
    openai_endpoint: UseOpenAIEndpoint | None = False,
    *any_kwargs_will_be_passed_in_request: Args,
    **kwargs: Kwargs,
) -> None
"""

model = pollinations.Text()

"""
(method) async def Async(
    self: Self@Text,
    prompt: Prompt | None = None,
    *any_kwargs_will_be_passed_in_request: Args,
    stream: Stream | None = False,
    **kwargs: Kwargs
) -> Output
"""

print(await model.Async("Hello, what is 1 + 1?"))

# Streaming
async for token in await model.Async("Hello, what is 1 + 1?", stream=True):
    print(token, end="", flush=True)

Audio Transcription

View Code Examples
import pollinations

"""
(method) def __init__(
    self: Self@Text,
    model: Model | None = "openai",
    system: System | None = "You are a helpful AI assistant.",
    contextual: Contextual | None = False,
    messages: Messages | None = [],
    private: Private | None = False,
    seed: Seed | None = "random",
    reasoning_effort: ReasoningEffort | None = "medium",
    tools: Tools | None = [],
    tool_choices: ToolChoice | None = [],
    voice: Voice | None = None,
    json_mode: JsonMode | None = False,
    referrer: Referrer | None = "pollinations.py",
    openai_endpoint: UseOpenAIEndpoint | None = False,
    *any_kwargs_will_be_passed_in_request: Args,
    **kwargs: Kwargs,
) -> None
"""

model = pollinations.Text()

"""
(method) def Transcribe(
    self: Self@Text,
    file: Filename,
    *any_kwargs_will_be_passed_in_request: Args,
    **kwargs: Kwargs
) -> Output
"""

print(model.Transcribe("my_audio.mp3"))
(Async) View Code Examples
import pollinations

"""
(method) def __init__(
    self: Self@Text,
    model: Model | None = "openai",
    system: System | None = "You are a helpful AI assistant.",
    contextual: Contextual | None = False,
    messages: Messages | None = [],
    private: Private | None = False,
    seed: Seed | None = "random",
    reasoning_effort: ReasoningEffort | None = "medium",
    tools: Tools | None = [],
    tool_choices: ToolChoice | None = [],
    voice: Voice | None = None,
    json_mode: JsonMode | None = False,
    referrer: Referrer | None = "pollinations.py",
    openai_endpoint: UseOpenAIEndpoint | None = False,
    *any_kwargs_will_be_passed_in_request: Args,
    **kwargs: Kwargs,
) -> None
"""

model = pollinations.Text()

"""
(method) def Transcribe(
    self: Self@Text,
    file: Filename,
    *any_kwargs_will_be_passed_in_request: Args,
    **kwargs: Kwargs
) -> Output
"""

print(await model.TranscribeAsync("my_audio.mp3"))

Audio Generation

Coming soon

Feed Reading

View Code Example
import pollinations

"""
(method) def __init__(
    self: Self@Feed,
    type: FeedType = "image",
    max_data: MaxData | None = None,
    *args: Args, 
    **kwargs: Kwargs
) -> None
"""

feed = pollinations.Feed()
# feed = pollinations.Feed("text", 10)  # Optionally specify type and amount

"""
(method) def __call__(
    self: Self@Feed,
    *args: Args, 
    **kwargs: Kwargs
) -> Iterator[Data]
"""

for item in feed():
    print(len(feed.data), item.data)

# Alternatively:
# for item in feed.Get():
#     print(len(feed.data), item.data)
(Async) View Code Example
import pollinations

"""
(method) def __init__(
    self: Self@Feed,
    type: FeedType = "image",
    max_data: MaxData | None = None,
    *args: Args, 
    **kwargs: Kwargs
) -> None
"""

feed = pollinations.Feed()
# feed = pollinations.Feed("text", 10)  # Optionally specify type and amount

"""
(method) async def Async(
    self: Self@Feed,
    *args: Args, 
    **kwargs: Kwargs
) -> AsyncIterator[Data]
"""

async for item in feed.Async():
    print(len(feed.data), item.data)

Links

Metadata

Release files for pollinations.ai 4.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pollinations.ai 4.5.1
File Size Uploaded Provenance Actions
pollinations_ai-4.5.1.tar.gz 22.1 kB Without provenance Details for pollinations_ai-4.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pollinations.ai 4.5.1
File Interpreter ABI Platform Actions
pollinations_ai-4.5.1-py3-none-any.whl Python 3 none any Details for pollinations_ai-4.5.1-py3-none-any.whl

Total release size: 56.4 kB

Release files / pollinations_ai-4.5.1.tar.gz

Download URL pollinations_ai-4.5.1.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8941b11364a916a73a266b61f1f90db586e97d541e1a56dfc3d66985b3bbc981
BLAKE2b-256 checksum
How to use checksums
db6cc2424bf584b63bbaf8d04bf7d81d082584f5f35c27d99331828469812680
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / pollinations_ai-4.5.1-py3-none-any.whl

Download URL pollinations_ai-4.5.1-py3-none-any.whl
Size 34.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b14ef61fa16fbb359064bfd5fa28e417424522f9088908ff090c0c6c8003c3f9
BLAKE2b-256 checksum
How to use checksums
765c29aa33f15fbb7e9c10975a36cdd538c331c4e938cbee83d0acf743980d9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Security for pollinations.ai 4.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.5.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page