Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Black Forest Labs

Scalekit connector
Open markdown

The Black Forest Labs connector lets your AI agent act in each user's Black Forest Labs account. Each user connects their own Black Forest Labs API key once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 23 tools.

Tools
23
What they doRead · write · destructive
4 · 19 · 04 read19 write0 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Black Forest Labs connection

    In AgentKit > Connections, create a Black Forest Labs connection. The name you give it is the connection_name your code passes. See Configure connections.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'blackforestlabs'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Black Forest Labs:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'blackforestlabs_get_credits',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their Black Forest Labs credentials there. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • blackforestlabs_get_creditsGet the credit balance available to your Black Forest Labs API key.Read-only

    Get Credits

    Get the credit balance available to your Black Forest Labs API key. Returns credits as a number (1 credit = $0.01 USD). Use this before large or video jobs to check the balance; a generation request with too few credits fails with HTTP 402.

    Inputs

    This tool takes no inputs.

  • blackforestlabs_get_finetune_detailsGet the training parameters and metadata of one of your finetunes.Read-only

    Get Finetune Details

    Get the training parameters and metadata of one of your finetunes. Returns a finetune_details object with the settings used to train it. Use this to inspect a single finetune. Use blackforestlabs_list_finetunes to see all of them.

    Inputs

    finetune_idstringrequired
    Finetune id from blackforestlabs_list_finetunes. Example: my-finetune
  • blackforestlabs_get_resultGet the status and output of a Black Forest Labs generation task by its id.Read-only

    Get Result

    Get the status and output of a Black Forest Labs generation task by its id. Returns id, status (Pending, Reasoning, Generating, Ready, Request Moderated, Content Moderated, Error or Task not found), progress, details, cost, and when Ready a result object whose sample (or samples, for video) is a signed download URL that expires within minutes. Use this to poll every image, video and tool task submitted with the other blackforestlabs tools; call it again while status is Pending, Reasoning or Generating. Requires the id returned by a blackforestlabs generation or editing tool.

    Inputs

    idstringrequired
    Task id returned by a blackforestlabs generation, editing or video tool (the id field of its response; also the id query parameter of polling_url). Example: 9f1c2d3e-4b5a-6789-abcd-ef0123456789
  • blackforestlabs_list_finetunesList the finetunes (LoRAs) created by your Black Forest Labs account.Read-only

    List Finetunes

    List the finetunes (LoRAs) created by your Black Forest Labs account. Returns a finetunes array of finetune ids. Use this to find a finetune_id for blackforestlabs_generate_image_finetuned. Use blackforestlabs_get_finetune_details for one finetune's training settings.

    Inputs

    This tool takes no inputs.

  • blackforestlabs_deblur_imageSharpen a blurry image with FLUX Deblur while keeping the scene, identity, colors and composition.Write

    Deblur Image

    Sharpen a blurry image with FLUX Deblur while keeping the scene, identity, colors and composition. Returns the task id and polling_url (plus cost in credits when reported); the image is not in this response. Use this to fix blur without a prompt. Use blackforestlabs_generate_image for other instruction-based edits. Then call blackforestlabs_get_result with the returned id until status is Ready.

    Inputs

    imagestringrequired
    Blurry image to sharpen, as a public http(s) URL or a base64-encoded image.
    output_formatstring
    File format of the generated image: jpeg, png, webp. Omit to use the endpoint default (png).one of jpegpngwebp
    safety_toleranceinteger
    Moderation tolerance for inputs and outputs, where 0 is the strictest. BFL documents 0-5 for this endpoint and defaults to 2; a value above the endpoint's maximum returns a 422 error. Example: 2
    seedinteger
    Optional seed for reproducible results. The same seed, prompt and settings give a similar image; omit for a random seed. Example: 42
  • blackforestlabs_edit_image_kontextEdit an image from a text instruction, or create one from text, with FLUX.1 Kontext [pro] or [max].Write

    Edit Image (FLUX.1 Kontext)

    Edit an image from a text instruction, or create one from text, with FLUX.1 Kontext [pro] or [max]. Returns the task id and polling_url (plus cost in credits when reported); the image is not in this response. Use this when you specifically want Kontext, for example to keep an existing Kontext workflow. BFL recommends blackforestlabs_generate_image (FLUX.2) for new editing work. Use blackforestlabs_fill_image to repaint only a masked area. Then call blackforestlabs_get_result with the returned id until status is Ready.

    Inputs

    promptstringrequired
    Edit instruction for the input image, or a description of a new image when no input image is given. Example: Change the car color to matte black and keep everything else the same.
    additional_imagesarray
    Up to 3 extra reference images (URLs or base64) sent as input_image_2 to input_image_4. BFL marks multi-reference Kontext as experimental.
    aspect_ratiostring
    Output aspect ratio between 21:9 and 9:21, as width:height. Omit to keep the input image's ratio (or the model default for text-to-image). Example: 16:9
    input_imagestring
    Image to edit, as a public http(s) URL or a base64-encoded image. Omit to create an image from the prompt alone.
    modelstring
    Kontext model: flux-kontext-pro (default) or flux-kontext-max (higher quality; BFL allows at most 6 concurrent max requests).one of flux-kontext-proflux-kontext-maxdefault flux-kontext-pro
    output_formatstring
    File format of the generated image: jpeg, png, webp. Omit to use the endpoint default (png).one of jpegpngwebp
    prompt_upsamplingboolean
    Set to true to let BFL rewrite the prompt for more creative results. Off by default.
    safety_toleranceinteger
    Moderation tolerance for inputs and outputs, where 0 is the strictest. BFL documents 0-6 for this endpoint and defaults to 2; a value above the endpoint's maximum returns a 422 error. Example: 2
    seedinteger
    Optional seed for reproducible results. The same seed, prompt and settings give a similar image; omit for a random seed. Example: 42
  • blackforestlabs_edit_videoEdit an existing video clip from a text instruction with FLUX Video Edit [fast]: add, remove or replace objects, change the setting or style, or change on-screen text or dialogue.Write

    Edit Video

    Edit an existing video clip from a text instruction with FLUX Video Edit [fast]: add, remove or replace objects, change the setting or style, or change on-screen text or dialogue. Returns the task id and polling_url; when Ready, get_result returns signed video URLs in result.samples. Duration, resolution, aspect ratio and audio follow the source clip. Use this to change a clip you already have. Use blackforestlabs_generate_video (mode v2v) to continue a clip and blackforestlabs_upscale_video to raise resolution. Then call blackforestlabs_get_result with the returned id until status is Ready.

    Inputs

    promptstringrequired
    Edit instruction, 1 to 4096 characters. Say what changes and where. Example: Replace the red car with a vintage blue convertible.
    videostringrequired
    Video to edit, as a public http(s) URL or base64-encoded mp4.
    safety_toleranceinteger
    Moderation tolerance for inputs and outputs, where 0 is the strictest. BFL documents 0-4 for this endpoint and defaults to 2; a value above the endpoint's maximum returns a 422 error. Example: 2
  • blackforestlabs_erase_objectRemove an object or region from an image using a mask with FLUX Erase.Write

    Erase Object

    Remove an object or region from an image using a mask with FLUX Erase. Returns the task id and polling_url (plus cost in credits when reported); the image is not in this response. Use this for prompt-free cleanup of masked objects. Use blackforestlabs_fill_image to replace the masked area with new content described in a prompt. Then call blackforestlabs_get_result with the returned id until status is Ready.

    Inputs

    imagestringrequired
    Image to clean up, as a public http(s) URL or a base64-encoded image.
    maskstringrequired
    Black and white mask with the same dimensions as the image, as a URL or base64. White pixels mark what to remove; black pixels are kept.
    dilate_pixelsinteger
    Pixels to grow the mask by before removal, 0 to 25 (server default 10). Helps cover object edges.
    output_formatstring
    File format of the generated image: jpeg, png, webp. Omit to use the endpoint default (png).one of jpegpngwebp
    safety_toleranceinteger
    Moderation tolerance for inputs and outputs, where 0 is the strictest. BFL documents 0-5 for this endpoint and defaults to 2; a value above the endpoint's maximum returns a 422 error. Example: 2
    seedinteger
    Optional seed for reproducible results. The same seed, prompt and settings give a similar image; omit for a random seed. Example: 42