AgentSkillsCN

image-gen

通过 Pollinations.ai 进行 AI 图像生成(免费,无需 API 密钥)。当用户提出“生成、绘制或创作一张图片/照片/插画”时使用。

SKILL.md
--- frontmatter
name: image-gen
description: AI image generation via Pollinations.ai (free, no API key). Use when the user asks to generate, draw, or create an image/picture/illustration.

AI Image Generation (多后端自动切换)

Generate images from text prompts — completely free, no API key, no registration.

支持多后端自动降级:Pollinations → AI Horde → Craiyon → Together.ai

Quick Start

bash
./scripts/generate_image.sh "a sunset over mountains" /tmp/sunset.jpg

Usage

bash
./scripts/generate_image.sh "prompt" [output_path] [width] [height] [model]
ParameterDefaultDescription
prompt(required)Text description of the image
output_path/tmp/ai_image_<timestamp>.pngWhere to save
width1024Image width in pixels
height1024Image height in pixels
modelfluxGeneration model (Pollinations only)

后端优先级

后端免费速度质量需API Key
Pollinations✅ 完全免费⚡ 快⭐⭐⭐⭐
AI Horde✅ 完全免费🐌 慢(排队)⭐⭐⭐❌ (匿名可用)
Craiyon✅ 完全免费🕐 中等⭐⭐
Together.ai✅ 有免费额度⚡ 快⭐⭐⭐⭐✅ TOGETHER_API_KEY

脚本自动按优先级尝试,一个失败就试下一个。

Available Models (Pollinations)

ModelStyleBest For
fluxGeneral purposeDefault, good all-around
flux-realismPhotorealisticPortraits, landscapes, product shots
flux-animeAnime/mangaAnime characters, illustrations
flux-3d3D rendered3D objects, scenes
turboFast generationQuick drafts, iteration
dall-e-3DALL-E styleCreative, artistic

Integration with Messaging

After generating, send the image to the user via their messaging channel:

code
# Feishu
message send → channel=feishu, filePath=/tmp/image.png, message="description"

# Other channels
message send → channel=telegram/discord/etc, filePath=/tmp/image.png

Prompt Tips

  • Supports both Chinese and English prompts
  • Be specific: "a golden retriever puppy playing in autumn leaves, warm sunlight" > "a dog"
  • Mention style: "watercolor painting of...", "photorealistic...", "anime style..."
  • Mention lighting: "soft warm lighting", "dramatic shadows", "golden hour"
  • Mention composition: "close-up", "wide angle", "bird's eye view"

Limitations

  • No image editing (inpainting, outpainting) — generation only
  • No consistent characters across images
  • Rate limited per-backend (Pollinations generous but may temp-ban IPs; AI Horde uses kudos queue)
  • curl needs -k flag (skip SSL verify) in some environments

Troubleshooting

ProblemSolution
SSL error-k flag; or try next backend
Pollinations temp-banned等15-30分钟自动恢复; 脚本会自动尝试备选
AI Horde 排队太久匿名用户优先级低, 高峰可能等3-5分钟
All backends fail手动访问 pollinations.ai / craiyon.com
Chinese prompt garbledScript handles URL encoding via Python