BFL FLUX API integration guide covering endpoints, async polling patterns, rate limiting, error handling, webhooks, and regional endpoints with Python and TypeScript code examples.

MITAuto-check: notesBackend & APIs

Install Bfl API

skills CLI
$ npx skills add black-forest-labs/skills --skill bfl-api -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install black-forest-labs/skills bfl-api --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/black-forest-labs/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/bfl-api .claude/skills/bfl-api && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
bfl-api
GitHub stars
125
Used in
1 other repo
Token cost
~2.5k tokens
SKILL.md length
694 words
Files
11 (incl. references)
Skills in repo
10
Repo updated
First seen
Licence
MIT

At a glance

BFL FLUX API integration guide covering endpoints, async polling patterns, rate limiting, error handling, webhooks, and regional endpoints with Python and TypeScript code examples.

  • Works in 4 steps: Submit Generation Request → Poll for Result → Download Image → …
  • Tasks that involve Third-party API integration
  • SKILL.md covers First: Check API Key, Important: Image URLs Expire…, When to Use and Quick Reference, plus 6 more sections
  • Runs Shell, Python and TypeScript scripts from its folder; calls curl; reaches api.bfl.ai and api.eu.bfl.ai; needs BFL_API_KEY

What it does

Bfl API is an agent skill from black-forest-labs/skills. BFL FLUX API integration guide covering endpoints, async polling patterns, rate limiting, error handling, webhooks, and regional endpoints with Python and TypeScript code examples.

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 12 other files, including reference files (for example `metadata.json`, `references/api-key-setup.md` and `references/code-examples/curl-examples.sh`).

It sits in Backend & APIs, covering Third-party API integration, Webhooks and Rate limiting. It works with Python and TypeScript. The repository describes itself as: Official agent skills from Black Forest Labs for FLUX image and video generation — prompting guides and API integration patterns for Claude Code, Codex, and any… The licence is MIT.

When your agent uses it

  • Tasks that involve Third-party API integration
  • Tasks that involve Webhooks
  • Tasks that involve Rate limiting

Example prompts

  • “/bfl-api”

Requirements

  • Python 3
  • Node.js
  • A Bash shell
  • A credential in BFL_API_KEY
  • A credential in YOUR_API_KEY

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Submit Generation Request
  2. Poll for Result
  3. Download Image
  4. Multi-Reference Example

What it can do on your machine

Read from SKILL.md and the folder at commit 8907d51. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Shell, Python and TypeScript), which the agent can run.

    Shell commands in SKILL.md call:

    • curl

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • api.bfl.ai
    • api.eu.bfl.ai
    • api.us.bfl.ai

    Also links to:

    • bfl.ai
    • dashboard.bfl.ai

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • BFL_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Bfl API loads about 2.5k tokens when it runs, and up to ~20k if it reads all its reference files. Until then it costs about 47 tokens; SKILL.md has 694 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~47
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~20k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:161
    2. **Save to `.env`** (recommended for persistence):
  • NoteMentions a .env fileSKILL.md:163
    echo 'BFL_API_KEY=bfl_your_key_here' >> .env
  • NoteMentions a .env fileSKILL.md:164
    echo '.env' >> .gitignore  # Don't commit secrets

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from black-forest-labs/skills at commit 8907d51, republished under its MIT licence (© black-forest-labs). 694 words, ~2,492 tokens.

Download SKILL.mdSave it as .claude/skills/bfl-api/SKILL.md (or your agent's skills folder). This skill also uses 10 other files; get the full folder from GitHub.
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.
metadata.author
Black Forest Labs
metadata.version
1.0.0
metadata.tags
flux, bfl, api, integration, webhooks, rate-limiting

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 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
RegionEndpointUse Case
Globalhttps://api.bfl.aiDefault, automatic failover
EUhttps://api.eu.bfl.aiGDPR compliance
UShttps://api.us.bfl.aiUS 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
ModelPath1st MP+MP1MP T2I1MP I2IBest For
FLUX.2 [klein] 4B/v1/flux-2-klein-4b1.4c0.1c$0.014$0.015Real-time, high volume
FLUX.2 [klein] 9B/v1/flux-2-klein-9b1.5c0.2c$0.015$0.017Balanced quality/speed
FLUX.2 [pro]/v1/flux-2-pro3c1.5c$0.03$0.045Production, fast turnaround
FLUX.2 [max]/v1/flux-2-max7c3c$0.07$0.10Maximum quality
FLUX.2 [flex]/v1/flux-2-flex5c5c$0.05$0.10Typography, adjustable controls
FLUX.2 [dev]---FreeFreeLocal development (non-commercial)

Pricing formula: (firstMP + (outputMP-1) * mpPrice) + (inputMP * mpPrice) in cents

FLUX.1 Models
ModelPathPrice/ImageBest For
FLUX.1 Kontext [pro]/v1/flux-kontext$0.04Image editing with context
FLUX.1 Kontext [max]/v1/flux-kontext-max$0.08Max quality editing
FLUX1.1 [pro]/v1/flux-pro-1.1$0.04Standard T2I, fast & reliable
FLUX1.1 [pro] Ultra/v1/flux-pro-1.1-ultra$0.06Ultra high-resolution
FLUX1.1 [pro] Raw/v1/flux-pro-1.1-raw$0.06Candid photography feel
FLUX.1 Fill [pro]/v1/flux-pro-1.0-fill$0.05Inpainting

Tip: All FLUX.2 models support image editing via the input_image parameter - no separate editing endpoint needed. Use 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:

ModelMax 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

Show full SKILL.md (279 more words)Show less
Rate Limits
TierConcurrent Requests
Standard (most endpoints)24
Polling vs Webhooks
ApproachUse When
PollingScripts, CLI tools, local development, single requests, simple integrations
WebhooksProduction 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.

Key Behaviors
  • Polling: Response includes polling_url for async results
  • URL Expiration: Result URLs expire after 10 minutes
  • Webhook Support: Configure webhook_url for production workloads

API Key Setup

Required: The BFL_API_KEY environment variable must be set before using the API.

Quick Check
bash
echo $BFL_API_KEY
If Not Set
  1. Get a key: Go to https://dashboard.bfl.ai/get-started → Click "Create Key" → Select organization
  2. Save to .env (recommended for persistence):
    bash
    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.

Authentication

bash
x-key: YOUR_API_KEY

Basic Request Flow

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
  • Prompting best practices (T2I, I2I, typography, colors): see the flux-image-best-practices skill
  • Multi-reference patterns (character consistency, style transfer, pose guidance): see flux-image-best-practices/rules/multi-reference-editing.md

References

Code Examples

Note: cURL examples are preferred by default as they work universally without requiring Python or Node.js. Use language-specific clients when building production applications.

Quick Start Example

1. Submit Generation Request
bash
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:

json
{ "id": "abc123", "polling_url": "https://api.bfl.ai/v1/get_result?id=abc123" }
2. Poll for Result
bash
curl -s "POLLING_URL" -H "x-key: $BFL_API_KEY"

Response when ready:

json
{ "status": "Ready", "result": { "sample": "https://...", "seed": 1234 } }
3. Download Image
bash
curl -s -o output.png "IMAGE_URL"

Tip: Result URLs expire in 10 minutes. Download immediately after status becomes Ready.

4. Multi-Reference Example

Combine elements from multiple images:

bash
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.

© black-forest-labs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 10 other files (references) in skills/bfl-api of black-forest-labs/skills.

  • SKILL.md
  • metadata.json
  • references/api-key-setup.md
  • references/code-examples/curl-examples.sh
  • references/code-examples/python-client.py
  • references/code-examples/typescript-client.ts
  • references/endpoints.md
  • references/error-handling.md
  • references/polling-patterns.md
  • references/rate-limiting.md
  • references/webhook-integration.md

Open the folder on GitHubat commit 8907d51

Used in 1 other repository

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in black-forest-labs/skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Bfl API next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Bfl API compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Bfl API this skillblack-forest-labs/skills1251 repos~2.5kAutomated safety check: NotesMIT
E2a Integratetokencanopy/e2a192—~840Automated safety check: PassApache-2.0
Frappe Core APIImpertio-Studio/Frappe_Claude_Skill_Package1871 repos~3.2kAutomated safety check: PassMIT
SEO APIseranking/seo-skills160—~4.1kAutomated safety check: PassMIT
Telegram Development Guide2025Emma/vibe-coding-cn23k1 repos~3.7kAutomated safety check: PassMIT
Fishjam Python Server SDKsoftware-mansion-labs/skills291—~1.3kAutomated safety check: PassApache-2.0

Similar skills

  • E2a Integrate

    tokencanopy/e2a

    A skill your agent uses when adding e2a email capabilities to an application or codebase: outbound sending, inbound signed webhooks, REST polling, or SDK integration.

    192 GitHub stars~840 tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Frappe Core API

    Impertio-Studio/Frappe_Claude_Skill_Package

    A skill your agent uses when building ERPNext/Frappe API integrations (v14/v15/v16) including REST API, RPC API, authentication, webhooks, and rate limiting.

    187 GitHub starsUsed in 1 repo~3.2k tokens
    Backend & APIsAuto-check passed
  • SEO API

    seranking/seo-skills

    SE Ranking API integration architect. An agent skill from seranking/seo-skills.

    160 GitHub stars~4.1k tokensUpdated 3 mo ago
    Marketing & SEOAuto-check passed
  • Telegram Development Guide

    2025Emma/vibe-coding-cn

    Chinese-language guide to building on Telegram: bots through the Bot API, Mini Apps in JavaScript and custom clients through TDLib, with Python examples.

    23k GitHub starsUsed in 1 repo~3.7k tokens
    Backend & APIsAuto-check passed
  • Fishjam Python Server SDK

    software-mansion-labs/skills

    Python server SDK for Fishjam — backends that create rooms, mint peer tokens, receive server notifications, and run voice agents.

    291 GitHub stars~1.3k tokensUpdated 9 days ago
    Backend & APIsAuto-check passed
  • Implementing API Patterns

    ancoleman/ai-design-components

    API design and implementation across REST, GraphQL, gRPC, and tRPC patterns.

    526 GitHub starsUsed in 1 repo~3k tokens
    Backend & APIsAuto-check passed

More from black-forest-labs/skills

All 10 skills in this repo
  • Flux 3 Keyframes Continuation

    black-forest-labs/skills

    A skill your agent uses when a FLUX 3 video must be built from supplied images or video.

    125 GitHub starsUsed in 1 repo~827 tokens
    Auto-check passed
  • Flux 3 Archival Formats

    black-forest-labs/skills

    A skill your agent uses when a FLUX 3 video needs a period or archival look.

    125 GitHub stars~1.4k tokensUpdated 27 days ago
    Auto-check passed
  • Flux 3 Product Ads

    black-forest-labs/skills

    A skill your agent uses when building a finished product ad from FLUX 3 - shot design, voiceover, action-to-word sync, evidence-gated copy, deterministic assembly, and QC gates that catch clipped…

    125 GitHub stars~9.8k tokensUpdated 27 days ago
    Auto-check passed
  • Flux 3 Prompt Doctor

    black-forest-labs/skills

    A skill your agent uses when diagnosing a FLUX 3 brief before generation.

    125 GitHub stars~904 tokensUpdated 27 days ago
    Auto-check passed
  • Flux 3 Generate

    black-forest-labs/skills

    A skill your agent uses when submitting or polling a FLUX 3 video API job.

    125 GitHub stars~1.1k tokensUpdated 27 days ago
    Auto-check passed
  • Flux 3 Audio Dialogue

    black-forest-labs/skills

    A skill your agent uses when directing FLUX 3 audio, dialogue, or voiceover.

    125 GitHub stars~584 tokensUpdated 27 days ago
    Auto-check passed

Categories

Questions about Bfl API

What does Bfl API do?

BFL FLUX API integration guide covering endpoints, async polling patterns, rate limiting, error handling, webhooks, and regional endpoints with Python and TypeScript code examples. Bfl API is an agent skill from black-forest-labs/skills. BFL FLUX API integration guide covering endpoints, async polling patterns, rate limiting, error handling, webhooks, and regional endpoints with Python and TypeScript code examples.

When should I use Bfl API?

Bfl API fits situations like: tasks that involve Third-party API integration; tasks that involve Webhooks; tasks that involve Rate limiting.

How do I install Bfl API in Claude Code?

Run `npx skills add black-forest-labs/skills --skill bfl-api -a claude-code`. Or copy the skill folder (skills/bfl-api in black-forest-labs/skills) into .claude/skills/bfl-api in your project. Claude Code loads it when a task matches its description.

How do I install Bfl API in Codex?

Run `npx skills add black-forest-labs/skills --skill bfl-api -a codex`. Or copy the skill folder (skills/bfl-api in black-forest-labs/skills) into .agents/skills/bfl-api in your project. Codex loads it when a task matches its description.

Can I use Bfl API in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add black-forest-labs/skills --skill bfl-api -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bfl-api, .gemini/skills/bfl-api, .github/skills/bfl-api and .opencode/skills/bfl-api in your project.

What does Bfl API need to run?

Going by SKILL.md and its folder, Bfl API needs a shell, Python and TypeScript for the scripts in its folder, the command-line tools its instructions call (curl) and credentials named BFL_API_KEY. Our summary lists: Python 3; Node.js; A Bash shell; A credential in BFL_API_KEY; A credential in YOUR_API_KEY.

Does Bfl API access the network?

SKILL.md names 5 domains. In commands or code: api.bfl.ai, api.eu.bfl.ai and api.us.bfl.ai; the agent is likely to contact these when it follows the instructions. As links in the text: bfl.ai and dashboard.bfl.ai. This is read from the text; nothing was executed.

Is Bfl API safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Bfl API use?

Bfl API is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Bfl API use?

About 2.5k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 18k tokens, read only when the agent opens those files.

What are the alternatives to Bfl API?

Skills that share tags, products or a category with Bfl API: E2a Integrate (tokencanopy/e2a, 192 stars), Frappe Core API (Impertio-Studio/Frappe_Claude_Skill_Package, 187 stars), SEO API (seranking/seo-skills, 160 stars) and Telegram Development Guide (2025Emma/vibe-coding-cn, 23k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Bfl API?

black-forest-labs (a GitHub organization) maintains it in black-forest-labs/skills, which has 125 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on September 9, 2026.

Source: black-forest-labs/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.