See the API docs.

See sections below for tips on using the text and image endpoints.

Notes:

  • The links below will work fine in the browser as GET requests but these are intended to handled in a client e.g. using Python or React for building the URL and displaying the content for a user.
  • If you use Firefox rather than CHrome, the percent encoding is rendered as a space, so that’s easy to read. Or you can type an underscore for a space to keep it readable.

Text endpoint

e.g.

The text endpoint also includes a path for an API that follows the OpenAI specification, so it can be used easily with the openai Python/JavaScript packages or Python LangChain’s OpenAI connector as covered below.

  • https://text.pollinations.ai/openai

With the openai package:

from openai import OpenAI

client = OpenAI(base_url="https://text.pollinations.ai/openai", api_key="dummy")

With the langchain-openai package and ChatOpenAI class:

from langchain_openai import ChatOpenAI

client = ChatOpenAI(base_url="https://text.pollinations.ai/openai", openai_api_key="dummy")

Options

  • GET - prompt*, model, seed, json, system
  • POST - messages* (can include system prompt), model, seed, jsonMode

See explanations in the Text API docs.

See models here: text.pollinations.ai/models.

Image endpoint

Use the form on the Pollinations homepage. There is a feed of other users’ images and you can edit the prompt or make a new one.

A generated image can be viewed there and the link can be copied for ease, rather than building the URL by hand.

e.g. image.pollinations.ai/prompt/calm%20serene%20forest…&nologo=true&model=flux

Image

Options

See Image options in the API docs.

See models here: image.pollinations.ai/models.

Based on this page - pollinations-react/README.md