API Documentation

Pollinations AI API documentation

This page collects what we reach for most often: the base URL, how keys behave, copy-paste examples, and where things get throttled. Guides: Python · MCP · DALL-E alternative · vs Bing.

Unified API endpoint

One hostname to learn; the path and parameters pick image vs text vs other jobs

Base URL

https://gen.pollinations.ai

What is gen.pollinations.ai?

It is the front door Pollinations exposes for generation: same host for multiple modalities instead of a separate micro-site per model. Your integration still has to pass the right model name and parameters — the URL alone does not read your mind.

Supported Generation Types

Image Generation

Flux, GPT Image Large, Seedream, Kontext

Text Generation

GPT-5, Claude, Gemini, DeepSeek V3.2, Qwen3-Coder

Video Generation

Seedance, Veo (alpha)

Audio Generation

Text-to-speech, speech-to-text

API keys & authentication

Publishable keys for browsers and demos; secret keys for servers — treat them like passwords

Getting API Keys

Visit enter.pollinations.ai to get your API keys. Pollinations AI offers two types of keys:

Publishable Keys (pk_)

Use Case: Client-side, demos, prototypes

Rate Limits: 1 pollen/hour per IP+key

Status: Beta - Turnstile protection coming soon

Secret Keys (sk_)

Use Case: Server-side only

Rate Limits: No rate limits

Status: Stable - Never expose in client-side code

⚠️ Important: Never expose secret keys (sk_) in client-side code, git repositories, or public URLs. Always use environment variables for secret keys.

API examples

If these run, your wiring is basically right — then refine parameters

Image Generation Example

curl 'https://gen.pollinations.ai/image/a%20beautiful%20sunset' -o image.jpg

# With API key
curl 'https://gen.pollinations.ai/image/a%20cat?key=YOUR_KEY'

Text Generation Example

curl 'https://gen.pollinations.ai/text/Hello%20world'

# With specific model
curl 'https://gen.pollinations.ai/text/Explain%20AI?model=claude&key=YOUR_KEY'

JavaScript Example

// Image generation
const prompt = 'a beautiful sunset';
const imageUrl = `https://gen.pollinations.ai/image/${encodeURIComponent(prompt)}`;

// Fetch image
fetch(imageUrl)
  .then(response => response.blob())
  .then(blob => {
    const imageUrl = URL.createObjectURL(blob);
    // Use imageUrl in your app
  });

Python Example

import requests

def generate_image(prompt, api_key=None):
    url = f"https://gen.pollinations.ai/image/{prompt}"
    params = {'key': api_key} if api_key else {}
    response = requests.get(url, params=params)
    return response.content

# Usage
image_data = generate_image('a cat playing piano')
with open('image.jpg', 'wb') as f:
    f.write(image_data)

Pollen credits

When “free tier” ends, Pollen is usually how heavier usage gets metered

How Pollen credits work

Think of Pollen as the platform’s usage credits for heavier or sustained work — exact rules live on the official Pollinations billing docs; numbers here are the mental model, not a contract.

  • $1 ≈ 1 Pollen - Simple conversion rate
  • Earn Daily Credits - Contribute to earn Pollen credits
  • Try before you buy - Light use often costs nothing
  • Pay-As-You-Go - Only pay for what you use

Model restrictions & scoping

Limit a key to Flux-only (for example) so a leak is less painful

Scoping API Keys

When creating an API key at enter.pollinations.ai, you can scope it to specific models:

Allow All Models

Key works with any available model (Flux, GPT Image, Claude, Gemini, etc.)

Restrict to Specific Models

Select exactly which models the key can access (e.g., only Flux and GPT Image, or just Claude)

Keys in hand?

Grab a key at enter.pollinations.ai, then prove it works with curl before you wire it into an app