Skip to main content

Unofficial Black Forest Labs API client

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

black_forest_labs-1.0.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

black_forest_labs-1.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file black_forest_labs-1.0.0.tar.gz.

File metadata

  • Download URL: black_forest_labs-1.0.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.18

File hashes

Hashes for black_forest_labs-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0f38b3fe0e726577120a63221bebfab1bd9eabe065ccfffc530c2f4136e835e1
MD5 81fd4040e8c34970bc2fc4b7b9fcb811
BLAKE2b-256 b1e81c6502a49ec127083cf95a250888d451cc24d7b62dac51838d8a25030ff9

See more details on using hashes here.

File details

Details for the file black_forest_labs-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for black_forest_labs-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15a3380918565a7324b0e0ffb26586e66bb60adeb27ee096c93a4bb2eeaa4222
MD5 ccf7cc148a68c6d226b6e93c363160cd
BLAKE2b-256 26e1a4412ff38526c96e137dc36e20a0fc022546f66188a95133632d3b283bb5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page