← 返回文章列表 / Back to list
overview

Pollinations AI 免费 API 实测:图像真免 Key,文本必须匿名才免费(带 Key 反而 402)

Pollinations AI Free API Verified: Image Truly Keyless, Text Free Only When Anonymous (Dummy Key Triggers 402)

Pollinations AI 免费 API 实测重写:图像真免 Key,文本必须匿名才免费

实测时间 2026-08-31 00:35 CST(UTC+8)· 3 条 curl 可复现 · 已修正“任意字符串即可”错误

Pollinations AI 提供图像与文本生成,但**“免 Key”的规则两个接口完全不一样**。本文所有结论均来自真实请求,不再口头承诺。

一句话实测结论(先看这个)

接口 是否真的免 Key 正确姿势 错误姿势 实测结果
图像 GET https://image.pollinations.ai/prompt/{prompt} ✅ 真免 Key 不带任何 Authorization 头直接 GET 200 31KB JPEG 512x512
文本 POST https://text.pollinations.ai/openai ⚠️ 仅匿名免 Key 不带 Authorization 头匿名 POST Authorization: Bearer not-needed / 任意字符串 匿名 200 gpt-oss-20b;带 Key 402 PAYMENT_REQUIRED

关键坑: 文本接口带任意 Authorization 会立刻 402 API key budget too low ... costs ~0.0001 pollen, but this key has 0.0000,官方明确提示 legacy text API is being deprecated for authenticated users. Anonymous requests are NOT affected. Please migrate to https://enter.pollinations.ai想免费用文本,就不要发 Authorization 头。

实测复现(3 条 curl,原样可跑)

实测 1:图像 — 真无需认证

curl -o image.jpg "https://image.pollinations.ai/prompt/A%20beautiful%20sunset%20over%20mountains?width=512&height=512&model=flux&seed=42&enhance=true" -i
# => HTTP/1.1 200 OK
# => Content-Type: image/jpeg
# => Content-Length: ~31KB
# 保存后为 512x512 JPEG,可直接在浏览器打开
import requests
url = "https://image.pollinations.ai/prompt/A%20cute%20cat%20wearing%20spacesuit"
params = {"width": 1024, "height": 1024, "model": "flux", "seed": 42}
r = requests.get(url, params=params, timeout=30)
open("cat.jpg","wb").write(r.content)  # 不需要 headers
print(r.status_code, len(r.content), r.headers.get("Content-Type"))
# 200 31xxx image/jpeg

实测 2:文本 — 匿名 POST 才 200

curl -X POST https://text.pollinations.ai/openai \
  -H "Content-Type: application/json" \
  -d '{"model":"openai","messages":[{"role":"user","content":"Hello!"}],"stream":false}' -i
# => HTTP/1.1 200 OK
# => {"id":"...","model":"gpt-oss-20b","choices":[{"message":{"role":"assistant","content":"Hello!"}}]}
import requests
resp = requests.post("https://text.pollinations.ai/openai", json={
    "model": "openai",
    "messages": [{"role": "user", "content": "用一句话解释量子计算"}],
    "stream": False
}, timeout=30)
print(resp.status_code)  # 200
print(resp.json()["choices"][0]["message"]["content"])
# 注意:全程不要加 headers={"Authorization": ...}

实测 3:文本 — 带 dummy Key 必 402(错误示范)

curl -X POST https://text.pollinations.ai/openai \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer not-needed" \
  -d '{"model":"openai","messages":[{"role":"user","content":"Hello!"}],"stream":false}' -i
# => HTTP/1.1 402 Payment Required
# => {"code":"PAYMENT_REQUIRED","message":"API key budget too low. This request costs ~0.0001 pollen, but this key has 0.0000 pollen. Please go to https://enter.pollinations.ai to purchase pollen. Note: legacy text API is being deprecated for authenticated users. Anonymous requests are NOT affected. Please migrate to https://enter.pollinations.ai"}

结论: 我之前写的 api_key="not-needed" + OpenAI(base_url="https://text.pollinations.ai/openai")错的,已删除。SDK 方式仅适用于 https://enter.pollinations.ai/api/v1 + 真实 pk_... pollen key。

正确 vs 错误代码对比

✅ 正确(匿名,免费):

import requests
resp = requests.post("https://text.pollinations.ai/openai", json={
    "model": "openai",
    "messages": [{"role": "user", "content": "写一首关于春天的短诗"}]
})

❌ 错误(会 402):

import openai
client = openai.OpenAI(
    base_url="https://text.pollinations.ai/openai",
    api_key="not-needed"  # 任意字符串都会 402
)
# 不要这样写

如需用 SDK,请走新域并充值:

import openai
client = openai.OpenAI(
    base_url="https://enter.pollinations.ai/api/v1",
    api_key="pk_xxx"  # 在 https://enter.pollinations.ai 获取,需 pollen 余额
)
// Node.js 正确(匿名)
fetch("https://text.pollinations.ai/openai", {
  method: "POST",
  headers: { "Content-Type": "application/json" }, // 不要加 Authorization
  body: JSON.stringify({ model: "mistral", messages: [{ role: "user", content: "Hello!" }] })
}).then(r => r.json()).then(console.log);

免费额度与模型(以实测为准)

资源 免费额度 说明
图像生成 无限* 公平使用,无硬配额,实测连续请求均 200
文本生成(匿名) 无限* 实测匿名 200,带 Key 402
速率 宽松 建议客户端 1-2 req/s,图像可前端直连
有效期 永久 无需注册,图像永久免 Key

*官方公平使用策略,适合个人/中小流量;生产高并发请自建或走付费。

图像模型: flux(高质量)、turbo(极速)、sdxl 等,通过 ?model=flux 指定。

文本模型: openai(实测返回 gpt-oss-20b)、mistral(32K)、llama 等,通过 {"model":"openai"} 指定。text.pollinations.ai 为兼容 OpenAI Chat Completions 格式。

平台对比(修正后)

平台 图像免费 文本免费 是否需 Key OpenAI 兼容 实测备注
Pollinations 图像 无限* GET 直连 200
Pollinations 文本匿名 无限* 否(必须匿名) POST 匿名 200
Pollinations 文本带 Key 需 pollen 旧域 402,需迁至 enter.pollinations.ai
Hugging Face 限流 限流 需 token
Together AI $5 试用 $5 试用 需信用卡

适用场景与限制

适合: 个人项目/原型验证、教学演示、Discord/Telegram Bot、前后端直连图像(无需后端代理)。

不适合: 核心生产 SLA、高并发(无保障)、敏感内容(有审核)。

建议:

  1. 文本接口永远不要发送 Authorization 头,想计费/稳定再去 enter.pollinations.ai 买 pollen。
  2. 图像相同 prompt 建议本地缓存,减少重复生成。
  3. 生产环境请封装重试 + Apishare 多源备份。

总结

Pollinations AI 的“免 Key”是真的,但有前提:图像无条件免 Key;文本仅匿名免 Key,带 Key 反而触发 402。按本文 3 条 curl 的正确姿势调用即可零成本跑通;需要 SDK/稳定计费请迁移至 enter.pollinations.ai。已实测,照抄可用。

相关文章 / Related

Meta GPT-OSS 120B 入驻 Groq:120B MoE 免费可用,MMLU 90% + Groq LPU 低延迟实测Cerebras Inference 免费 API 完全指南:2000 tokens/s 极速推理,Llama 3.3 70B 零成本接入GLM-4.7 Flash免费API:128K上下文极速推理永久$0Cloudflare Workers AI 免费层完全指南:在边缘运行 Llama 3、Mistral 等开源模型inclusionAI Ling 3.0 Flash Fin 免费 API:262K 上下文金融推理,零成本上线