360 Secure SkillHub
360 安全技能中心

NexPix — Cloudflare Image Generation

按质量、配额和失败情况在 Cloudflare Workers AI(FLUX 等模型,免费额度)与 EvoLink 付费接口之间自动路由生成图片,支持 CLI、Node 程序化调用及 Discord/Telegram 斜杠命令,图片保存到本地并记录用量与费用。

finndottllc-ui
finndottllc-ui
热度 43.84
最近更新 2026-05-11 17:34:51
分类:创作依赖:代码执行 / 读写文件 / 第三方 API应用场景:图像生成 / API 集成 / 自动化脚本 / 社交媒体

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add nexpix
Metadata
name
nexpix
description
AI image generation via Cloudflare Workers AI (free tier, FLUX models) with premium EvoLink fallback. Use when generating images from text prompts, creating visual assets, product mockups, or social media graphics. Triggers: 'generate image', 'create image', 'nexpix', '/canvas', image generation requests. Supports CLI, programmatic API, Discord slash commands, and Telegram bot integration. Zero cost on free tier (10K neurons/day).

NexPix — Cloudflare Image Generation

Two-tier image generation with intelligent routing. Free by default.

Quick Start

CLI

# Generate an image (free tier)
nexpix "a sunset over the ocean with sailboats"

# Specify size
nexpix "cyberpunk cityscape" --size 1024x768

# Premium quality (EvoLink fallback)
nexpix "product photo of a clay jar" --quality premium

# Force a specific route
nexpix "logo design" --route workers-ai
nexpix "4K wallpaper" --route evolink

# Check usage/quota
nexpix --status

Programmatic

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);  // local path to saved image
console.log(result.source);    // 'workers-ai' or 'evolink'
console.log(result.cost);      // 0 for free tier

Messaging Integration

Discord:  /canvas a mountain landscape at dawn
Telegram: /canvas a mountain landscape at dawn

See references/messaging-integration.md for slash command manifests.

Architecture

Routing Logic

  1. Standard quality → Cloudflare Workers AI (free, FLUX.1-schnell)
  2. Premium / 4K quality → EvoLink API (~$0.12-0.20/image)
  3. Image editing / img2img → EvoLink (Workers AI is text-only)
  4. Quota > 90% used → Auto-fallback to EvoLink
  5. Workers AI failure → Auto-fallback to EvoLink

Models (Workers AI — Free Tier)

Model Speed Quality Key
FLUX.1-schnell ~1-3s Good flux-schnell (default)
FLUX.2-dev ~5-10s Great flux-2-dev
Stable Diffusion XL ~3-5s Good sdxl
DreamShaper 8 LCM ~2-4s Good dreamshaper

Pricing Tiers

Tier Cost Limit Provider
Free $0/month 10K neurons/day (~50-100 images) Cloudflare Workers AI
Pro ~$0.12-0.20/image Unlimited EvoLink API
Enterprise Custom Custom Self-hosted Workers

Requirements

  • Cloudflare account with Workers AI enabled
  • API token stored at ACCESS/cloudflare-workers-ai.env
  • Node.js 18+
  • Optional: EVOLINK_API_KEY for premium fallback

File Layout

File Purpose
nexpix.js Core module (routing, generation, tracking)
bin/nexpix CLI entry point
scripts/deploy-worker.sh Deploy/update Cloudflare Worker
references/messaging-integration.md Discord + Telegram setup

Output

Images saved to ~/.openclaw/media/workers-ai/ (free) or ~/.openclaw/media/evolink/ (premium).

Print MEDIA:<absolute_path> for OpenClaw auto-attach.

Usage Tracking

All generations logged to notes/image-gen-tracking.json:

  • Daily neuron usage vs quota
  • Cost per image ($0 for free tier)
  • Cumulative savings vs paid alternatives
  • Generation history (last 500)

Check with nexpix --status or programmatically via nexpix.getStatus().

Installation

clawhub install nexpix