bfl-api
BFL FLUX API integration guide covering endpoints, async polling patterns, rate limiting, error handling, webhooks, and regional endpoints with Python and…
Skill by Black Forest Labs
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/black-forest-labs-bfl-api
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/bfl-api
What's inside
- Skill name
bfl-api- Description
- BFL FLUX API integration guide covering endpoints, async polling patterns, rate limiting, error handling, webhooks, and regional endpoints with Python and TypeScript code examples.
- License
- MIT
- Metadata
- tags: flux, bfl, api, integration, webhooks, rate-limiting · author: Black Forest Labs · version: 1.0.0
- Instructions
- 257 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
- Instructions call the network
Files (11)
- SKILL.md
- metadata.json
- api-key-setup.md · references/
- curl-examples.sh · references/code-examples/
- python-client.py · references/code-examples/
- typescript-client.ts · references/code-examples/
- endpoints.md · references/
- error-handling.md · references/
- polling-patterns.md · references/
- rate-limiting.md · references/
- webhook-integration.md · references/
SKILL.md (first lines)
# BFL API Integration Guide
Use this skill when integrating BFL FLUX APIs into applications for image generation, editing, and processing.
## First: Check API Key
**Before generating images, verify your API key is set:**
```bash
echo $BFL_API_KEY
```
If empty or you see "Not authenticated" errors, see [API Key Setup](#api-key-setup) below.
## Important: Image URLs Expire in 10 Minutes
Result URLs from the API are temporary. Download images immediately after generation completes - do not store or cache the URLs themselves.
## When to Use
- Setting up BFL API client
- Implementing async polling patterns
- Handling rate limits and errors
- Configuring webhooks for production
- Selecting regional endpoints
- Building production-ready integrations
## Quick Reference
### Base Endpoints
| 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 |
### Model Endpoints & Pricing
> **Credit pricing:** 1 credit = $0.01 USD. FLUX.2 uses megapixel-based pricing (cost scales with resolution).
#### FLUX.2 Models
| 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` | 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) |
> **Pricing formula:** `(firstMP + (outputMP-1) * mpPrice) + (inputMP * mpPrice)` in cents
#### FLUX.1 Models
| 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 |
| 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 |
> **Tip:** All FLUX.2 models support image editing via the `input_image` parameter - no separate editing endpoint needed. Use [bfl.ai/pricing](https://bfl.ai/pricing) calculator for exact costs at different resolutions.
### Image Input for Editing
**Preferred: Use URLs directly** - simpler and more convenient than base64.
**Single image editing:**
```bash
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:**
```bash
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.
### Multi-Reference I2I
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:
- "The subject from image 1 in the environment from image 2"
- "Apply the style of image 2 to the scene in image 1"
- "The person from image 1 wearing the outfit from image 2, in the pose from image 3"
> For detailed multi-reference patterns (character consistency, style transfer, pose guidance), see `flux-image-best-practices/rules/multi-reference-editing.md`
### Rate LimitsFrom black-forest-labs/skills, MIT.
More from black-forest-labs/skills
- 0.742score
flux-3-cinematic-inserts
Black Forest Labs
Use when writing a FLUX 3 text-to-video prompt for a standalone shot.
SkillBFreshness: B★ 136Claude Code +9 - 0.740score
flux-3-generate
Black Forest Labs
Use when submitting or polling a FLUX 3 video API job.
SkillBFreshness: B★ 136Claude Code +9 - 0.736score
flux-3-archival-formats
Black Forest Labs
Use when a FLUX 3 video needs a period or archival look.
SkillBFreshness: B★ 136Claude Code +9 - 0.736score
flux-3-video
Black Forest Labs
Use when routing a general FLUX 3 video request.
SkillBFreshness: B★ 136Claude Code +9 - 0.735score
flux-3-prompt-doctor
Black Forest Labs
Use when diagnosing a FLUX 3 brief before generation.
SkillBFreshness: B★ 136Claude Code +9 - 0.735score
flux-3-audio-dialogue
Black Forest Labs
Use when directing FLUX 3 audio, dialogue, or voiceover.
SkillBFreshness: B★ 136Claude Code +9 - 0.735score
flux-3-keyframes-continuation
Black Forest Labs
Use when a FLUX 3 video must be built from supplied images or video.
SkillBFreshness: B★ 136Claude Code +9 - 0.732score
flux-image-best-practices
Black Forest Labs
Comprehensive guide for BFL FLUX image generation models.
SkillBFreshness: B★ 136Claude Code +9 - 0.731score
flux-3-product-ads
Black Forest Labs
Use when building a finished product ad from FLUX 3 - shot design, voiceover, action-to-word sync, evidence-gated copy, deterministic assembly, and QC gates…
SkillBFreshness: B★ 136Claude Code +9
Signals
- Stars
- 136
- Forks
- 11
- Open issues
- 2
- Last commit (this folder)
- Aug 10, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.0.0
- License
- MIT
- Repository
- github.com/black-forest-labs/skills
- Website
- docs.bfl.ai
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Black Forest Labs
- 0.742score
flux-3-cinematic-inserts
Black Forest Labs
Use when writing a FLUX 3 text-to-video prompt for a standalone shot.
SkillBFreshness: B★ 136Claude Code +9 - 0.740score
flux-3-generate
Black Forest Labs
Use when submitting or polling a FLUX 3 video API job.
SkillBFreshness: B★ 136Claude Code +9 - 0.736score
flux-3-archival-formats
Black Forest Labs
Use when a FLUX 3 video needs a period or archival look.
SkillBFreshness: B★ 136Claude Code +9 - 0.736score
flux-3-video
Black Forest Labs
Use when routing a general FLUX 3 video request.
SkillBFreshness: B★ 136Claude Code +9 - 0.735score
flux-3-prompt-doctor
Black Forest Labs
Use when diagnosing a FLUX 3 brief before generation.
SkillBFreshness: B★ 136Claude Code +9 - 0.735score
flux-3-audio-dialogue
Black Forest Labs
Use when directing FLUX 3 audio, dialogue, or voiceover.
SkillBFreshness: B★ 136Claude Code +9
Cite this page
bfl-api skill. Agent Mart. https://agentmart.dev/skills/black-forest-labs-bfl-api (last updated 2026-10-24)