Nodes/ComfyUI-FLUX-BFL-API/Flux Credits (BFL)
ComfyUI Node

Flux Credits (BFL)

The 'how much did that render cost' node

By gelasdev·Created 2 years ago·Updated 25 days ago· 49
Flux Credits (BFL)
  • config
  • STRING

Flux Credits (BFL) is the least glamorous node in the ComfyUI-FLUX-BFL-API pack and, the moment you're generating on a paid API, one of the most useful. It just asks BFL how many credits you have left and prints the answer. No image in, no image out - but when every generation in the pack is burning real money, knowing where your balance sits before you queue a batch is the difference between a productive evening and a 402 error mid-render.

Black Forest Labs runs the Flux Pro line (and the newer Flux 2 tiers) as a metered API - that's the whole reason this pack exists. You pay per generation, and this node is your wallet check.

How it works

It's a single GET /credits request with your x-key header. The node returns the raw JSON as a STRING, formatted with indentation so you can actually read it. There are no required inputs at all - you just drop it on the canvas, hit queue, and read the widget output.

It's marked as an output node (is_output_node: true), which means ComfyUI treats it as a terminal: it renders on its own and doesn't need to be wired into anything else. It does support an optional config input if you want to point it at a different key or base URL via a Flux Config (BFL) node, but for most people the default config.ini key is exactly what you want to check.

The response isn't just a number - it's the full credits payload as JSON, so you'll see things like the raw credit balance and any usage details BFL returns. Want it prettier than raw JSON? It feeds straight into a Show Text node, or you can just read it from the widget.

Installing it

It's the same install as every node in this pack - one repo, one key:

cd ComfyUI/custom_nodes
git clone https://github.com/gelasdev/ComfyUI-FLUX-BFL-API.git

Restart, and put your key in config.ini (or use a Flux Config (BFL) node). The pack's only real dependency is torch, already bundled with ComfyUI, so there's nothing else to fetch and no models to download.

Where people get burned

  • It shows an error JSON, not a number. If you get a 401 or similar back, that's your key being wrong or unset - this node is the fastest way to debug that exact problem before you chase your tail on a generation node.
  • It's a snapshot, not a subscription meter. BFL's credit model means the balance is whatever the API says at that moment; if a bunch of jobs are still polling in the background, the balance can move between checking and the next generation.
  • People expect a number out. It's a STRING, not an INT - fine for display, not for arithmetic downstream. If you want to do something with the value programmatically, you'd need to parse it yourself.

For the "run 20 variants, panic about cost later" crowd, put one of these in your workflow next to a Flux Credits display and check it before big queues. It's thirty seconds of setup that saves you from a very un-fun API error mid-batch.

CategoryBFL/Utility

Inputs (1)

NameTypeDefaultDescription
configoptBFL_CONFIG

Outputs (1)

NameTypeDescription
STRINGSTRING