NexPix — Cloudflare Image Generation — NexPix — Cloudflare 图像生成
v1.0.0通过 Cloudflare Workers AI(免费层,FLUX 模型)进行 AI 图像生成,支持高级 EvoLink 备用方案。适用于文本提示生成图像、创建视觉资产、产品模型或社交媒体图形。触发词:'generate image'、'create image'、'nexpix'、'/canvas'、图像生成请求。支持 CLI、程序化 API、Discord 斜杠命令和 Telegram 机器人集成。免费层零成本(每天 10K 神经元)。
详细分析 ▾
运行时依赖
版本
初始版本:免费层图像生成(FLUX)+ 高级备用方案(EvoLink)。CLI、API、Discord/Telegram 集成。
安装命令 点击复制
技能文档
具有智能路由的两层图像生成。默认免费。
快速开始
CLI
# 生成图像(免费层)
nexpix "a sunset over the ocean with sailboats"# 指定尺寸
nexpix "cyberpunk cityscape" --size 1024x768
# 高级质量(EvoLink 备用)
expix "product photo of a clay jar" --quality premium
# 强制特定路由
nexpix "logo design" --route workers-ai
nexpix "4K wallpaper" --route evolink
# 检查使用量/配额
nexpix --status
程序化
const nexpix = require('./nexpix');const result = await nexpix.generate({
prompt: "a futuristic city at night",
quality: "standard", // standard | premium
width: 1024,
height: 1024,
});
console.log(result.filepath); // 保存图像的本地路径
console.log(result.source); // 'workers-ai' 或 'evolink'
console.log(result.cost); // 免费层为 0
消息集成
Discord: /canvas a mountain landscape at dawn
Telegram: /canvas a mountain landscape at dawn
请参阅 references/messaging-integration.md 了解斜杠命令清单。
架构
路由逻辑
- 标准质量 → Cloudflare Workers AI(免费,FLUX.1-schnell)
- 高级 / 4K 质量 → EvoLink API(每张图约 $0.12-0.20)
- 图像编辑 / img2img → EvoLink(Workers AI 仅支持文本)
- 配额使用 > 90% → 自动回退到 EvoLink
- Workers AI 失败 → 自动回退到 EvoLink
模型(Workers AI — 免费层)
| 模型 | 速度 | 质量 | 密钥 |
|---|---|---|---|
| FLUX.1-schnell | ~1-3秒 | 良好 | flux-schnell(默认) |
| FLUX.2-dev | ~5-10秒 | 优秀 | flux-2-dev |
| Stable Diffusion XL | ~3-5秒 | 良好 | sdxl |
| DreamShaper 8 LCM | ~2-4秒 | 良好 | dreamshaper |
定价层
| 层 | 成本 | 限制 | 提供商 |
|---|---|---|---|
| 免费 | $0/月 | 每天 10K 神经元(约 50-100 张图像) | Cloudflare Workers AI |
| 专业 | 每张图约 $0.12-0.20 | 无限 | EvoLink API |
| 企业 | 自定义 | 自定义 | 自托管 Workers |
要求
- 启用 Workers AI 的 Cloudflare 账户
- 存储在
ACCESS/cloudflare-workers-ai.env的 API 令牌 - Node.js 18+
- 可选: 用于高级回退的
EVOLINK_API_KEY
文件布局
| 文件 | 用途 |
|---|---|
nexpix.js | 核心模块(路由、生成、跟踪) |
bin/nexpix | CLI 入口点 |
scripts/deploy-worker.sh | 部署/更新 Cloudflare Worker |
references/messaging-integration.md | Discord + Telegram 设置 |
输出
图像保存到 ~/.openclaw/media/workers-ai/(免费)或 ~/.openclaw/media/evolink/(高级)。打印 MEDIA: 以触发 OpenClaw 自动附加。
使用跟踪
所有生成记录到 notes/image-gen-tracking.json:
- 每日神经元使用量 vs 配额
- 每张图像成本(免费层为 $0)
- 与付费替代方案的累计节省
- 生成历史(最近 500 条)
使用 nexpix --status 或通过 nexpix.getStatus() 程序化检查。
安装
clawhub install nexpix
免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制