bfl-api by black-forest-labs/skills
npx skills add https://github.com/black-forest-labs/skills --skill bfl-api在应用程序中集成 BFL FLUX API 用于图像生成、编辑和处理时,请使用此技能。
在生成图像之前,请验证您的 API 密钥是否已设置:
echo $BFL_API_KEY
如果为空或看到“未认证”错误,请参阅下面的 API 密钥设置。
来自 API 的结果 URL 是临时的。生成完成后请立即下载图像 - 不要存储或缓存 URL 本身。
| 区域 | 端点 | 使用场景 |
|---|---|---|
| 全球 | https://api.bfl.ai | 默认,自动故障转移 |
| 欧盟 | https://api.eu.bfl.ai |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| GDPR 合规性 |
| 美国 | https://api.us.bfl.ai | 美国数据驻留 |
积分定价: 1 积分 = 0.01 美元。FLUX.2 使用基于百万像素的定价(成本随分辨率变化)。
| 模型 | 路径 | 首个 MP | 后续 MP | 1MP T2I | 1MP I2I | 最佳用途 |
|---|---|---|---|---|---|---|
| FLUX.2 [klein] 4B | /v1/flux-2-klein-4b | 1.4c | 0.1c | $0.014 | $0.015 | 实时,高吞吐量 |
| FLUX.2 [klein] 9B | /v1/flux-2-klein-9b | 1.5c | 0.2c | $0.015 | $0.017 | 质量/速度平衡 |
| FLUX.2 [pro] | /v1/flux-2-pro | 3c | 1.5c | $0.03 | $0.045 | 生产,快速周转 |
| FLUX.2 [max] | /v1/flux-2-max | 7c | 3c | $0.07 | $0.10 | 最高质量 |
| FLUX.2 [flex] | /v1/flux-2-flex | 5c | 5c | $0.05 | $0.10 | 排版,可调控制 |
| FLUX.2 [dev] | - | - | - | 免费 | 免费 | 本地开发(非商业用途) |
定价公式:
(首个MP + (输出MP-1) * mp价格) + (输入MP * mp价格)单位:美分
| 模型 | 路径 | 每张图片价格 | 最佳用途 |
|---|---|---|---|
| FLUX.1 Kontext [pro] | /v1/flux-kontext | $0.04 | 带上下文的图像编辑 |
| FLUX.1 Kontext [max] | /v1/flux-kontext-max | $0.08 | 最高质量编辑 |
| FLUX1.1 [pro] | /v1/flux-pro-1.1 | $0.04 | 标准 T2I,快速可靠 |
| FLUX1.1 [pro] Ultra | /v1/flux-pro-1.1-ultra | $0.06 | 超高分辨率 |
| FLUX1.1 [pro] Raw | /v1/flux-pro-1.1-raw | $0.06 | 写实摄影感 |
| FLUX.1 Fill [pro] | /v1/flux-pro-1.0-fill | $0.05 | 修复 |
提示: 所有 FLUX.2 模型都通过
input_image参数支持图像编辑 - 无需单独的编辑端点。使用 bfl.ai/pricing 计算器获取不同分辨率下的确切成本。
首选:直接使用 URL - 比 base64 更简单方便。
单图像编辑:
curl -X POST "https://api.bfl.ai/v1/flux-2-pro" \
-H "x-key: $BFL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Change the background to a sunset",
"input_image": "https://example.com/photo.jpg"
}'
多参考编辑:
curl -X POST "https://api.bfl.ai/v1/flux-2-pro" \
-H "x-key: $BFL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "The person from image 1 in the environment from image 2",
"input_image": "https://example.com/person.jpg",
"input_image_2": "https://example.com/background.jpg"
}'
API 会自动获取 URL。URL 和 base64 都有效,但建议在可用时使用 URL。
FLUX.2 模型支持多个输入图像,用于组合元素、风格迁移和角色一致性:
| 模型 | 最大参考数 |
|---|---|
| FLUX.2 [klein] | 4 张图像 |
| FLUX.2 [pro/max/flex] | 8 张图像 |
参数: input_image, input_image_2, input_image_3, ... input_image_8
提示模式: 在提示中按编号引用图像:
有关详细的多参考模式(角色一致性、风格迁移、姿势引导),请参阅
flux-best-practices/rules/multi-reference-editing.md
| 层级 | 并发请求数 |
|---|---|
| 标准(大多数端点) | 24 |
| 方法 | 使用时机 |
|---|---|
| 轮询 | 脚本、CLI 工具、本地开发、单个请求、简单集成 |
| Webhook | 生产应用、高吞吐量、服务器到服务器、需要即时通知时 |
从轮询开始 - 它更简单且随处可用。当需要扩展或想要事件驱动架构时,切换到 Webhook。
polling_urlwebhook_url必需 : 在使用 API 之前,必须设置 BFL_API_KEY 环境变量。
echo $BFL_API_KEY
获取密钥 : 访问 https://dashboard.bfl.ai/get-started → 点击 "创建密钥" → 选择组织
保存到.env(建议用于持久化):
echo 'BFL_API_KEY=bfl_your_key_here' >> .env
echo '.env' >> .gitignore # 不要提交密钥
有关详细设置说明,请参阅 references/api-key-setup.md。
x-key: YOUR_API_KEY
1. 向模型端点发送 POST 请求
└─> 响应:{ "polling_url": "..." }
2. GET 轮询 URL(重复直到完成)
└─> 响应:{ "status": "Pending" | "Ready" | "Error", ... }
3. 当状态为 Ready 时,下载结果 URL
└─> URL 在 10 分钟后过期 - 立即下载
flux-best-practices/rules/multi-reference-editing.md注意: 默认情况下首选 cURL 示例,因为它们无需 Python 或 Node.js 即可普遍使用。构建生产应用程序时,请使用特定语言的客户端。
curl -s -X POST "https://api.bfl.ai/v1/flux-2-pro" \
-H "x-key: $BFL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "A serene mountain landscape at sunset", "width": 1024, "height": 1024}'
响应:
{ "id": "abc123", "polling_url": "https://api.bfl.ai/v1/get_result?id=abc123" }
curl -s "POLLING_URL" -H "x-key: $BFL_API_KEY"
准备就绪时的响应:
{ "status": "Ready", "result": { "sample": "https://...", "seed": 1234 } }
curl -s -o output.png "IMAGE_URL"
提示: 结果 URL 在 10 分钟后过期。状态变为
Ready后请立即下载。
组合多个图像中的元素:
curl -s -X POST "https://api.bfl.ai/v1/flux-2-pro" \
-H "x-key: $BFL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "The cat from image 1 sitting in the cozy room from image 2",
"input_image": "https://example.com/cat.jpg",
"input_image_2": "https://example.com/room.jpg",
"width": 1024,
"height": 1024
}'
在提示中按编号引用图像。有关限制和模式,请参阅多参考 I2I。
每周安装量
174
仓库
GitHub 星标数
36
首次出现
2026年1月23日
安全审计
安装于
claude-code141
opencode139
gemini-cli127
cursor124
codex114
antigravity88
Use this skill when integrating BFL FLUX APIs into applications for image generation, editing, and processing.
Before generating images, verify your API key is set:
echo $BFL_API_KEY
If empty or you see "Not authenticated" errors, see API Key Setup below.
Result URLs from the API are temporary. Download images immediately after generation completes - do not store or cache the URLs themselves.
| Region | Endpoint | Use Case |
|---|---|---|
| Global | https://api.bfl.ai | Default, automatic failover |
| EU | https://api.eu.bfl.ai | GDPR compliance |
| US | https://api.us.bfl.ai | US data residency |
Credit pricing: 1 credit = $0.01 USD. FLUX.2 uses megapixel-based pricing (cost scales with resolution).
| Model | Path | 1st MP | +MP | 1MP T2I | 1MP I2I | Best For |
|---|---|---|---|---|---|---|
| FLUX.2 [klein] 4B | /v1/flux-2-klein-4b | 1.4c | 0.1c | $0.014 | $0.015 | Real-time, high volume |
| FLUX.2 [klein] 9B | /v1/flux-2-klein-9b | 1.5c | 0.2c | $0.015 | $0.017 | Balanced quality/speed |
| FLUX.2 [pro] | /v1/flux-2-pro |
Pricing formula:
(firstMP + (outputMP-1) * mpPrice) + (inputMP * mpPrice)in cents
| Model | Path | Price/Image | Best For |
|---|---|---|---|
| FLUX.1 Kontext [pro] | /v1/flux-kontext | $0.04 | Image editing with context |
| FLUX.1 Kontext [max] | /v1/flux-kontext-max | $0.08 | Max quality editing |
| FLUX1.1 [pro] | /v1/flux-pro-1.1 | $0.04 | Standard T2I, fast & reliable |
| FLUX1.1 [pro] Ultra | /v1/flux-pro-1.1-ultra | $0.06 | Ultra high-resolution |
Tip: All FLUX.2 models support image editing via the
input_imageparameter - no separate editing endpoint needed. Use bfl.ai/pricing calculator for exact costs at different resolutions.
Preferred: Use URLs directly - simpler and more convenient than base64.
Single image editing:
curl -X POST "https://api.bfl.ai/v1/flux-2-pro" \
-H "x-key: $BFL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Change the background to a sunset",
"input_image": "https://example.com/photo.jpg"
}'
Multi-reference editing:
curl -X POST "https://api.bfl.ai/v1/flux-2-pro" \
-H "x-key: $BFL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "The person from image 1 in the environment from image 2",
"input_image": "https://example.com/person.jpg",
"input_image_2": "https://example.com/background.jpg"
}'
The API fetches URLs automatically. Both URL and base64 work, but URLs are recommended when available.
FLUX.2 models support multiple input images for combining elements, style transfer, and character consistency:
| Model | Max References |
|---|---|
| FLUX.2 [klein] | 4 images |
| FLUX.2 [pro/max/flex] | 8 images |
Parameters: input_image, input_image_2, input_image_3, ... input_image_8
Prompt pattern: Reference images by number in your prompt:
For detailed multi-reference patterns (character consistency, style transfer, pose guidance), see
flux-best-practices/rules/multi-reference-editing.md
| Tier | Concurrent Requests |
|---|---|
| Standard (most endpoints) | 24 |
| Approach | Use When |
|---|---|
| Polling | Scripts, CLI tools, local development, single requests, simple integrations |
| Webhooks | Production apps, high volume, server-to-server, when you need immediate notification |
Start with polling - it's simpler and works everywhere. Switch to webhooks when you need to scale or want event-driven architecture.
polling_url for async resultswebhook_url for production workloadsRequired : The BFL_API_KEY environment variable must be set before using the API.
echo $BFL_API_KEY
Get a key : Go to https://dashboard.bfl.ai/get-started → Click "Create Key" → Select organization
Save to.env (recommended for persistence):
echo 'BFL_API_KEY=bfl_your_key_here' >> .env
echo '.env' >> .gitignore # Don't commit secrets
See references/api-key-setup.md for detailed setup instructions.
x-key: YOUR_API_KEY
1. POST request to model endpoint
└─> Response: { "polling_url": "..." }
2. GET polling_url (repeat until complete)
└─> Response: { "status": "Pending" | "Ready" | "Error", ... }
3. When Ready, download result URL
└─> URL expires in 10 minutes - download immediately
flux-best-practices/rules/multi-reference-editing.mdNote: cURL examples are preferred by default as they work universally without requiring Python or Node.js. Use language-specific clients when building production applications.
curl -s -X POST "https://api.bfl.ai/v1/flux-2-pro" \
-H "x-key: $BFL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "A serene mountain landscape at sunset", "width": 1024, "height": 1024}'
Response:
{ "id": "abc123", "polling_url": "https://api.bfl.ai/v1/get_result?id=abc123" }
curl -s "POLLING_URL" -H "x-key: $BFL_API_KEY"
Response when ready:
{ "status": "Ready", "result": { "sample": "https://...", "seed": 1234 } }
curl -s -o output.png "IMAGE_URL"
Tip: Result URLs expire in 10 minutes. Download immediately after status becomes
Ready.
Combine elements from multiple images:
curl -s -X POST "https://api.bfl.ai/v1/flux-2-pro" \
-H "x-key: $BFL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "The cat from image 1 sitting in the cozy room from image 2",
"input_image": "https://example.com/cat.jpg",
"input_image_2": "https://example.com/room.jpg",
"width": 1024,
"height": 1024
}'
Reference images by number in your prompt. See Multi-Reference I2I for limits and patterns.
Weekly Installs
174
Repository
GitHub Stars
36
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykWarn
Installed on
claude-code141
opencode139
gemini-cli127
cursor124
codex114
antigravity88
超能力技能使用指南:AI助手技能调用优先级与工作流程详解
49,600 周安装
SpecStory 历史文件整理工具 - 按时间戳自动归档会话文件,保持项目目录整洁
101 周安装
OMC Doctor:Claude代码助手安装诊断与修复工具 - 解决OMC插件问题
101 周安装
微信文章转Markdown工具 - 高效抓取公众号文章并转换为Markdown格式,支持存档与AI处理
101 周安装
Go语言技术文档编写指南 - 专业API设计与文档生成技能
101 周安装
Mermaid图表专家技能 - 专业流程图、序列图、甘特图代码生成与可视化指南
101 周安装
销售自动化工具 - 冷邮件序列、跟进计划、话术模板与A/B测试完整指南
101 周安装
| 3c |
| 1.5c |
| $0.03 |
| $0.045 |
| Production, fast turnaround |
| FLUX.2 [max] | /v1/flux-2-max | 7c | 3c | $0.07 | $0.10 | Maximum quality |
| FLUX.2 [flex] | /v1/flux-2-flex | 5c | 5c | $0.05 | $0.10 | Typography, adjustable controls |
| FLUX.2 [dev] | - | - | - | Free | Free | Local development (non-commercial) |
| FLUX1.1 [pro] Raw | /v1/flux-pro-1.1-raw | $0.06 | Candid photography feel |
| FLUX.1 Fill [pro] | /v1/flux-pro-1.0-fill | $0.05 | Inpainting |