/install azure-flux-image-gen
FLUX.2-pro Image Generation
Generate high-quality images from text prompts using FLUX.2-pro on Azure AI Foundry.
Setup
Set environment variables (typically in OpenClaw config or shell profile):
export FLUX_ENDPOINT="https://\x3Cresource>.services.ai.azure.com/providers/blackforestlabs/v1/flux-2-pro?api-version=preview"
export FLUX_API_KEY="YOUR_KEY_HERE"
Quick Generation
Use the bundled script:
node scripts/generate.mjs --prompt "a red fox in autumn forest" --output fox.png
node scripts/generate.mjs --prompt "cute robot" --width 1440 --height 816 --output robot.png
Direct API Call
When the script isn't suitable, call the API directly:
curl -s -X POST "$FLUX_ENDPOINT" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $FLUX_API_KEY" \
-d '{"prompt":"a cat","width":1024,"height":1024,"n":1,"model":"FLUX.2-pro"}' \
| node -e "process.stdin.on('data',d=>{const j=JSON.parse(d);require('fs').writeFileSync('out.png',Buffer.from(j.data[0].b64_json,'base64'))})"
Critical parameters: "n": 1 and "model": "FLUX.2-pro" are mandatory. Omitting them causes HTTP 500.
Chinese Text Overlay
FLUX cannot render CJK characters. Overlay text with Node.js Canvas:
import { createCanvas, loadImage, registerFont } from "canvas";
registerFont("NotoSansCJK-Bold.otf", { family: "NotoSansCJK" });
const img = await loadImage("base.png");
const canvas = createCanvas(img.width, img.height);
const ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
ctx.font = 'bold 48px "NotoSansCJK"';
ctx.fillStyle = "#ffffff";
ctx.fillText("你好世界", 100, 100);
Requires: npm install canvas + a CJK font file (e.g., NotoSansCJK-Bold.otf).
Best Practices
- Serialize requests — avoid parallel API calls; use sequential generation
- Set 180s timeout — generation can take 30–120 seconds
- Prompt in English — FLUX works best with English prompts
- Content filter — avoid violent, sexual, or otherwise filtered content in prompts
- Print quality — use 1240×1754 for A3, scale up as needed
API Reference
See references/api.md for full request/response schema and size options.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install azure-flux-image-gen - 安装完成后,直接呼叫该 Skill 的名称或使用
/azure-flux-image-gen触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
FLUX.2-pro Image Generation 是什么?
Generate images using Black Forest Labs FLUX.2-pro via Azure AI Foundry. Use when asked to create, generate, or produce images, illustrations, photos, artwor... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 415 次。
如何安装 FLUX.2-pro Image Generation?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install azure-flux-image-gen」即可一键安装,无需额外配置。
FLUX.2-pro Image Generation 是免费的吗?
是的,FLUX.2-pro Image Generation 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
FLUX.2-pro Image Generation 支持哪些平台?
FLUX.2-pro Image Generation 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 FLUX.2-pro Image Generation?
由 zwcih(@zwcih)开发并维护,当前版本 v1.1.0。