API Documentation

Pollinations AI API Documentation

Complete guide to using the unified API endpoint at gen.pollinations.ai. Generate images, text, audio, and video with Flux, GPT Image, Claude, Gemini, and more.

Unified API Endpoint

Access all AI generation capabilities through a single endpoint

Base URL

https://gen.pollinations.ai

What is gen.pollinations.ai?

The unified API endpoint provides access to all Pollinations AI models in one place. Whether you need image generation with Flux, text processing with Claude, or video creation with Seedance, everything is accessible through this single endpoint.

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

Get your API keys and start using Pollinations AI

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

Quick start examples for common use cases

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 System

Simple pay-as-you-go pricing for advanced features

How Pollen Credits Work

Pollinations AI uses a simple credit system called "Pollen" for advanced features and higher usage limits.

  • $1 ≈ 1 Pollen - Simple conversion rate
  • Earn Daily Credits - Contribute to earn Pollen credits
  • No Credit Card Required - Basic usage is free forever
  • Pay-As-You-Go - Only pay for what you use

Model Restrictions & Scoping

Control which models your API key can access

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)

Ready to Start Using the API?

Get your API key and start building with Pollinations AI today