Skip to main content

Black Forest Labs API Client

This is an unofficial Python client for interacting with the Black Forest Labs API.

$ export BFL_API_KEY="..."
import black_forest_labs
import time

task = black_forest_labs.generate(
    "flux-pro",
    prompt="ein fantastisches bild",
)

print(f"Task created with id `{task.id}`")

print("Polling for results...", end="", flush=True)
while not task.is_done:
    print(".", end="", flush=True)
    task = black_forest_labs.get_result(task.id)
    time.sleep(1)

print(f"\nTask finished with status `{task.status}`")
if task.result:
    print(f"Prompt: {task.result.prompt}")
    print(f"Image URL: {task.result.sample}")
Task created with id `ce9e065d-dc90-4633-9c1e-44ea839ed569`
Polling for results............
Task finished with status `Ready`
Prompt: ein fantastisches bild
Image URL: https://bflapistorage.blob.core.windows.net/public/db43e36806f74c1a9c6972127c9d71ea/sample.jpg

Metadata

Release files for black-forest-labs 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for black-forest-labs 1.0.0
File Size Uploaded
black_forest_labs-1.0.0.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for black-forest-labs 1.0.0
File Interpreter ABI Platform
black_forest_labs-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.6 kB

Release files / black_forest_labs-1.0.0.tar.gz

Download URL black_forest_labs-1.0.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0f38b3fe0e726577120a63221bebfab1bd9eabe065ccfffc530c2f4136e835e1
BLAKE2b-256 checksum
How to use checksums
b1e81c6502a49ec127083cf95a250888d451cc24d7b62dac51838d8a25030ff9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.4.18

Release files / black_forest_labs-1.0.0-py3-none-any.whl

Download URL black_forest_labs-1.0.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15a3380918565a7324b0e0ffb26586e66bb60adeb27ee096c93a4bb2eeaa4222
BLAKE2b-256 checksum
How to use checksums
26e1a4412ff38526c96e137dc36e20a0fc022546f66188a95133632d3b283bb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.4.18

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page