# Credits & Billing Source: https://docs.bfl.ml/account_management/credits_billing Add credits, track usage, and handle billing for your organization ## Understanding Credits Credits are managed at the **organization level** and shared across all projects. All team members draw from the same credit pool, while usage is tracked per project so you can see which projects consume the most. ## Adding Credits Go to [dashboard.bfl.ai](https://dashboard.bfl.ai) and sign in In your organization sidebar, go to **API → Credits** Click **Add Credits** and choose the amount you want to purchase You'll be redirected to Stripe to complete your payment securely. Credits are available immediately. Check our [Pricing](/quick_start/pricing) page for the latest pricing for each model. Add credits button in dashboard ## Payment & Billing We accept all major credit cards through Stripe. Go to **API → Credits**, find your purchase in **Purchase History**, and click **View Invoice**. Stripe payment interface ## Track Your Usage Monitor your API consumption at the organization or project level: See total consumption across all projects at **API → Usage** in your organization view: Your current available credits Total consumption across all projects Cost breakdown per model Drill down into individual project usage at **API → Usage** within each project: Credits used by this specific project See which endpoints are used most Daily and hourly usage trends Cost breakdown per model Usage dashboard ## Transferring Credits Organization administrators can transfer credits between organizations they manage. This is useful when consolidating credits, moving credits before deleting an organization, or reallocating budget between teams. To transfer credits, go to your organization settings or contact support. ## Activity Log Track all billing and credit-related activities in your organization's **Activity Log**: credit purchases, credit transfers, and member changes that affect billing access. This provides a complete audit trail for compliance and accounting. ## Next Steps Learn more about structuring your workspace Invite members and manage roles # Organizations & Projects Source: https://docs.bfl.ml/account_management/organizations_projects Organize your teams, manage API keys, and control access with Organizations and Projects. Black Forest Labs uses **Organizations** and **Projects** to help you manage team collaboration, API access, and billing. This structure provides enterprise-grade access control while remaining simple for individual developers. ## Core Concepts Your team or company. Manages team members, billing, credits, and contains multiple projects. Workspaces within an organization. Each project has its own API keys and usage tracking. Organization and project structure When you create a BFL account, you automatically get a **Default Organization** and **Default Project** ready to use. You can rename these or create more at any time. ## Managing Organizations & Projects ### Creating an Organization Click your organization name in the sidebar Select **Create Organization** and enter a name Optionally create an initial project during setup ### Organization Settings Access your organization settings to rename it, manage members, view the activity log, or delete it. Deleting an organization is permanent. Transfer any remaining credits to another organization first. ### Creating a Project Go to your organization in the sidebar Click **Create Project** and enter a name ### Project Features Create and manage keys scoped to this project Track API consumption per project Add project-specific collaborators ## API Keys API keys are **scoped to projects**, providing better security and organization than account-level keys. ### Creating API Keys Select your project from the sidebar Click **Add Key** and give it a descriptive name The full key is only shown once — store it securely All BFL API keys use the format `bfl_`. In your dashboard, you'll see a preview like `bfl_ABC...xyz` to help identify keys. ## Environment Separation We recommend using **separate projects** for different environments: Set up `Production`, `Staging`, and `Development` projects Name keys clearly: `prod-server-1`, `staging-main`, `dev-local` This approach gives you independent usage tracking per environment and a clear audit trail for each project. ## Best Practices Create separate projects for production vs development to keep usage tracking clean. One organization for your company, with projects per app or environment. Use roles to control who can manage billing vs API keys. Create one organization per client, or use project-only access for client stakeholders within your agency org. Organizations per department, projects per application. Use activity logs for compliance. ## For Existing Users If you had a BFL account before December 2025, you've been automatically migrated. A "Default" organization and project were created, your credits moved to the organization level, and **your existing API keys continue to work unchanged**. ## Next Steps Learn about roles and inviting team members Manage your credits and billing # Team Management Source: https://docs.bfl.ml/account_management/team_management Invite team members, assign roles, and manage access to your organizations and projects. Collaborate with your team by inviting members to your organizations and projects. Our role-based access control lets you give each team member exactly the permissions they need. ## Roles Overview When you invite someone to an **organization**, they get access based on their role: **Full control** over the organization — manage members, billing, settings, and all projects. **Build and ship** — create projects, manage API keys, and view usage. **Handle finances** — manage credits and subscriptions, view usage (no API access). **Read-only access** — view everything, change nothing. **Playground users** — read-only access across the organization, plus the ability to generate images in the Playground. Intended for team members who should be able to create in the Playground without any configuration or billing access. Organization roles are automatically inherited by every project within the organization. Invite members directly to a **specific project** without organization-wide access: **Full project control** — manage project settings, API keys, and members. **Build within project** — manage API keys and view usage. **Project finances** — view usage metrics (no API access). **Read-only** — view project info, keys, and usage. **Playground users** — read-only access to the project, plus the ability to generate images in the Playground. Ideal for stakeholders or collaborators who should experiment in the Playground without touching API keys or project settings. **Project-only members** can only see the specific projects they're invited to. They cannot see other projects or organization-level settings. ## Inviting Team Members Inviting someone to your organization gives them access based on their role: In your organization sidebar, click **Members** Click the **Invite Member** button Enter their email address and select their role Click **Send Invitation** — they'll receive an email with a link to join For contractors, consultants, or team members who only need access to specific projects: Select the project from your sidebar Click **Members** in the project menu Click **Invite Member**, enter their email, and select a project role Project-only members can only see the projects they're explicitly invited to — they cannot view organization settings, other projects, or organization-wide billing. Invitations expire after **7 days**. You can cancel pending invitations and resend if needed. ## Managing Members Go to **Members**, click a member's current role, and select a new one. Changes take effect immediately. Go to **Members**, find the member, and click remove. They immediately lose access. Go to **Members**, find the pending invitation, and click **Cancel** to revoke it. When you remove someone, their API keys remain active. Rotate keys if the removed member had access to them. ## Best Practices * Make 2-3 people Administrators for redundancy * Use Developer role for engineers * Consider Billing Manager for finance/ops * Create separate organizations per client, OR * Use project-only access for client stakeholders * Keep API key access limited to your team * Use Administrators sparingly (principle of least privilege) * Billing Manager for finance team * Viewer role for stakeholders who need visibility * Project-only access for contractors ## Activity Tracking All member-related actions are logged in your organization's **Activity Log**: invitations sent, invitations accepted, role changes, and member removals. This provides a complete audit trail for compliance and security reviews. ## Next Steps Learn more about structuring your workspace Manage your credits and billing # Get the user's credits Source: https://docs.bfl.ml/api-reference/get-the-users-credits https://api.bfl.ai/openapi.json get /v1/credits Get the user's credits # Edit or create an image with FLUX.1 Kontext [max] Source: https://docs.bfl.ml/api-reference/models/edit-or-create-an-image-with-flux1-kontext-[max] https://api.bfl.ai/openapi.json post /v1/flux-kontext-max Submits an image creation task with FLUX.1 Kontext [max]. For image editing, prefer FLUX.2 [pro] (/flux-2-pro) or FLUX.2 [flex] (/flux-2-flex) which are the recommended default models for editing workflows. FLUX.1 Kontext \[max] is a legacy editing model. For new integrations, use FLUX.2 \[pro] (/flux-2-pro). See [which model to use](/flux_2/flux2_overview#which-model-to-choose). # Edit or create an image with FLUX.1 Kontext [pro] Source: https://docs.bfl.ml/api-reference/models/edit-or-create-an-image-with-flux1-kontext-[pro] https://api.bfl.ai/openapi.json post /v1/flux-kontext-pro Submits an image creation task with FLUX.1 Kontext [pro]. For image editing, prefer FLUX.2 [pro] (/flux-2-pro) or FLUX.2 [flex] (/flux-2-flex) which are the recommended default models for editing workflows. FLUX.1 Kontext \[pro] is a legacy editing model. For new integrations, use FLUX.2 \[pro] (/flux-2-pro). See [which model to use](/flux_2/flux2_overview#which-model-to-choose). # Erase an object from an image Source: https://docs.bfl.ml/api-reference/models/erase-an-object-from-an-image https://api.bfl.ai/openapi.json post /v1/flux-tools/erase-v1 Submits an erase task using an input image and a mask identifying the object or region to remove. # Expand an image with FLUX.1 Expand [pro] by adding pixels on any side Source: https://docs.bfl.ml/api-reference/models/expand-an-image-with-flux1-expand-[pro]-by-adding-pixels-on-any-side https://api.bfl.ai/openapi.json post /v1/flux-pro-1.0-expand Submits an image expansion task that adds the specified number of pixels to any combination of sides (top, bottom, left, right) while maintaining context. # Generate an image with FLUX 1.1 [pro] finetune with ultra mode. Source: https://docs.bfl.ml/api-reference/models/generate-an-image-with-flux-11-[pro]-finetune-with-ultra-mode https://api.bfl.ai/openapi.json post /v1/flux-pro-1.1-ultra-finetuned Submits an image generation task with FLUX 1.1 [pro] finetune with ultra mode. # Generate an image with FLUX.1 [dev] Source: https://docs.bfl.ml/api-reference/models/generate-an-image-with-flux1-[dev] https://api.bfl.ai/openapi.json post /v1/flux-dev Submits an image generation task with FLUX.1 [dev]. # Generate an image with FLUX.1 Fill [pro] finetune using an input image and mask. Source: https://docs.bfl.ml/api-reference/models/generate-an-image-with-flux1-fill-[pro]-finetune-using-an-input-image-and-mask https://api.bfl.ai/openapi.json post /v1/flux-pro-1.0-fill-finetuned Submits an image generation task with the FLUX.1 Fill [pro] finetune model using an input image and mask. Mask can be applied to alpha channel or submitted as a separate image. # Generate an image with FLUX1.1 [pro] Source: https://docs.bfl.ml/api-reference/models/generate-an-image-with-flux11-[pro] https://api.bfl.ai/openapi.json post /v1/flux-pro-1.1 Submits an image generation task with FLUX1.1 [pro]. # Generate an image with FLUX1.1 [pro] ultra mode Source: https://docs.bfl.ml/api-reference/models/generate-an-image-with-flux11-[pro]-ultra-mode https://api.bfl.ai/openapi.json post /v1/flux-pro-1.1-ultra Submits an image generation task with FLUX1.1 [pro] with ultra mode and optional raw mode. # Generate or edit an image with FLUX.2 [flex] Source: https://docs.bfl.ml/api-reference/models/generate-or-edit-an-image-with-flux2-[flex] https://api.bfl.ai/openapi.json post /v1/flux-2-flex Submits an image generation or editing task with FLUX.2 [flex]. Specialized for typography and text rendering, and for preserving small details. Supports text-to-image and image-to-image editing workflows. Best for text and typography in the image. For most use cases, start with FLUX.2 \[pro]. See [which model to use](/flux_2/flux2_overview#which-model-to-choose). # Generate or edit an image with FLUX.2 [klein] 4B Source: https://docs.bfl.ml/api-reference/models/generate-or-edit-an-image-with-flux2-[klein]-4b https://api.bfl.ai/openapi.json post /v1/flux-2-klein-4b Submits an image generation or editing task with FLUX.2 [klein] 4B. The fastest, most lightweight FLUX.2 model, with open weights that run on consumer GPUs. The fastest and most affordable model, with open weights that run on consumer GPUs. 9B trades some speed for higher quality. See [which model to use](/flux_2/flux2_overview#which-model-to-choose). # Generate or edit an image with FLUX.2 [klein] 9B Source: https://docs.bfl.ml/api-reference/models/generate-or-edit-an-image-with-flux2-[klein]-9b https://api.bfl.ai/openapi.json post /v1/flux-2-klein-9b Submits an image generation or editing task with FLUX.2 [klein] 9B. Sub-second inference with open weights, balancing quality and speed. Fastest and most affordable, with open weights. 9B balances quality and speed; 4B is the fastest. See [which model to use](/flux_2/flux2_overview#which-model-to-choose). # Generate or edit an image with FLUX.2 [klein] 9B (preview) Source: https://docs.bfl.ml/api-reference/models/generate-or-edit-an-image-with-flux2-[klein]-9b-preview https://api.bfl.ai/openapi.json post /v1/flux-2-klein-9b-preview Submits an image generation or editing task with the FLUX.2 [klein] 9B preview endpoint, where our latest quality and speed improvements land first. For stable production use, prefer FLUX.2 [klein] 9B (/flux-2-klein-9b). Preview endpoint for FLUX.2 \[klein] 9B. For stable production use, start with FLUX.2 \[klein] 9B. See [which model to use](/flux_2/flux2_overview#which-model-to-choose). # Generate or edit an image with FLUX.2 [max] Source: https://docs.bfl.ml/api-reference/models/generate-or-edit-an-image-with-flux2-[max] https://api.bfl.ai/openapi.json post /v1/flux-2-max Submits an image generation or editing task with FLUX.2 [max]. Highest quality FLUX.2 model for image generation and editing, with the strongest editing consistency and prompt following. Highest quality, for the hardest edits and maximum prompt following. For most use cases, start with FLUX.2 \[pro]. See [which model to use](/flux_2/flux2_overview#which-model-to-choose). # Generate or edit an image with FLUX.2 [pro] Source: https://docs.bfl.ml/api-reference/models/generate-or-edit-an-image-with-flux2-[pro] https://api.bfl.ai/openapi.json post /v1/flux-2-pro Submits an image generation or editing task with FLUX.2 [pro]. This is the recommended default model for image editing and generation. Supports text-to-image and image-to-image editing workflows. The recommended default model for most generation and editing. New to FLUX.2? See [which model to use](/flux_2/flux2_overview#which-model-to-choose). # Generate or edit an image with FLUX.2 [pro] (preview) Source: https://docs.bfl.ml/api-reference/models/generate-or-edit-an-image-with-flux2-[pro]-preview https://api.bfl.ai/openapi.json post /v1/flux-2-pro-preview Submits an image generation or editing task with the FLUX.2 [pro] preview endpoint, where our latest quality and speed improvements land first. For stable production use, prefer FLUX.2 [pro] (/flux-2-pro). Preview endpoint for FLUX.2 \[pro]. For stable production use, start with FLUX.2 \[pro]. See [which model to use](/flux_2/flux2_overview#which-model-to-choose). # Inpaint an image with FLUX.1 Fill [pro] using an input image and mask Source: https://docs.bfl.ml/api-reference/models/inpaint-an-image-with-flux1-fill-[pro]-using-an-input-image-and-mask https://api.bfl.ai/openapi.json post /v1/flux-pro-1.0-fill Submits an image generation task with the FLUX.1 Fill [pro] model using an input image and mask. Mask can be applied to alpha channel or submitted as a separate image. # Outpaint or extend an image Source: https://docs.bfl.ml/api-reference/models/outpaint-or-extend-an-image https://api.bfl.ai/openapi.json post /v1/flux-tools/outpainting-v1 Submits an outpainting task. The input image is placed on a (width, height) canvas at the given offset, and the surrounding region is generated by a FLUX outpainting model. # Remove blur from an image Source: https://docs.bfl.ml/api-reference/models/remove-blur-from-an-image https://api.bfl.ai/openapi.json post /v1/flux-tools/deblur-v1 Submits a deblur task. The input image is regenerated by a FLUX blur-removal model to sharpen it while preserving the original scene, objects, composition, and lighting. No prompt needed. # Report Model Usage Source: https://docs.bfl.ml/api-reference/models/report-model-usage https://api.bfl.ai/v1/licenses/docs/openapi.json post /v1/licenses/models/{model_slug}/usage # Virtual try-on Source: https://docs.bfl.ml/api-reference/models/virtual-try-on https://api.bfl.ai/openapi.json post /v1/flux-tools/vto-v1 Submits a virtual try-on task. Person and garment images are mapped to the underlying input image slots; prompts steer attribute transfer. # Virtual try-on (v2) Source: https://docs.bfl.ml/api-reference/models/virtual-try-on-v2 https://api.bfl.ai/openapi.json post /v1/flux-tools/vto-v2 Submits a virtual try-on task against the v2 model. Identical request shape to /vto-v1, with reference and output resolution supported up to 4MP. Person and garment images are mapped to the underlying input image slots; prompts steer attribute transfer. # Delete Finetune Source: https://docs.bfl.ml/api-reference/utility/delete-finetune https://api.bfl.ai/openapi.json post /v1/delete_finetune Delete a finetune_id that was created by the user # Finetune Details Source: https://docs.bfl.ml/api-reference/utility/finetune-details https://api.bfl.ai/openapi.json get /v1/finetune_details Get details about the training parameters and other metadata connected to a specific finetune_id that was created by the user. # Generate a video with FLUX 3 Source: https://docs.bfl.ml/api-reference/utility/generate-a-video-with-flux-3 https://api.bfl.ai/openapi.json POST /v1/flux-3-video Submits a video generation task to FLUX 3 via the harness. The mode is explicit: t2v (`text-to-video`), i2v (`image-continuation`, keyframes), v2v (`video-continuation`, start_video), or draft_enhance (`draft-enhance`, full-quality render of a prior draft's `draft_cache`); the spelled-out aliases are accepted anywhere the short key is. # Get Result Source: https://docs.bfl.ml/api-reference/utility/get-result https://api.bfl.ai/openapi.json get /v1/get_result An endpoint for getting generation task result. # My Finetunes Source: https://docs.bfl.ml/api-reference/utility/my-finetunes https://api.bfl.ai/openapi.json get /v1/my_finetunes List all finetune_ids created by the user # Errors Source: https://docs.bfl.ml/api_integration/errors Reference for HTTP status codes and response types returned by the FLUX API, including error handling guidance. ## HTTP Errors Our API uses standard HTTP status codes to indicate the success or failure of your requests: **400 - `Bad Request`** There was an issue with the format or content of your request. Check your request parameters and ensure all required fields are properly formatted. **402 - `Payment Required`** Your account has insufficient credits or your payment method needs to be updated. Add credits to your account to continue using the API. **403 - `Forbidden`** Your API key does not have permission to access the specified resource. **422 - `Unprocessable Entity`** The request you sent contains invalid request body or parameters. **429 - `Too Many Requests`** You've exceeded the rate limits for your account. **500 - `Internal Server Error`** An unexpected error occurred on our servers. **503 - `Service Unavailable`** Our service is temporarily unavailable, typically due to maintenance or high load. Try again in a few moments. ## Response Types When checking the status of your generation requests using `get_result`, you'll receive one of these response types: **`Ready`** Your generation is complete and the result is available for download. **`Pending`** Your request is still being processed. Check back in a few moments. **`Request Moderated`** Your input (prompt or image) was flagged by our content moderation system before processing began. **`Content Moderated`** The generated output was flagged by our content moderation system after processing completed. **`Task not found`** The specified task ID does not exist or has expired. **`Error`** An error occurred during processing. Check the error details for more information. ## Moderation Responses The moderation system can flag content at two stages, each with its own status: | Status | Stage | What it means | | ------------------- | ----------------- | ----------------------------------------------------------------------------------------- | | `Request Moderated` | Before processing | Your input (prompt or image) was flagged at submission time, so the request was rejected. | | `Content Moderated` | After processing | The generated output was flagged, so the result can't be delivered. | In both cases `result` is `null` and the `details` field includes a `Moderation Reasons` array naming the categories that triggered the filter (for example `Violence`, `Sexual Content`, or `Self Harm`). Use these reasons to adjust the request or to show a message to your users. ```json theme={null} { "id": "your-task-id", "status": "Request Moderated", "result": null, "progress": null, "details": { "Moderation Reasons": [ "Violence", "Sexual Content", "Self Harm" ] }, "preview": null } ``` A `Content Moderated` response has the same shape, with `"status": "Content Moderated"`. ### Adjusting moderation sensitivity You can control the moderation sensitivity using the `safety_tolerance` parameter when submitting generation requests. `0` is the strictest setting, and the accepted maximum depends on the model generation: | Range | Applies to | | ----- | --------------------------------------------------------------------- | | 0–4 | FLUX 3 video (all modes) | | 0–5 | FLUX.2 endpoints, plus Erase, Deblur, Outpainting, and Virtual Try-On | | 0–6 | FLUX.1-generation endpoints | The default value is `2` everywhere. Lower values result in more aggressive content filtering, while higher values allow more content through. Sending a value above the endpoint's maximum returns a `422` validation error. # FLUX API Integration Guide Source: https://docs.bfl.ml/api_integration/integration_guidelines Essential guide for integrating with FLUX API endpoints, including endpoint selection, polling, and content handling. ## API Endpoints Overview ### Primary Global Endpoint **`api.bfl.ai`** - Primary Endpoint * Routes requests across all available clusters globally * Provides automatic failover between clusters for enhanced uptime * Intelligent load distribution prevents bottlenecks during high traffic periods * **Important:** Always use the `polling_url` returned in responses when using this endpoint * **Suitable for:** Standard inference ### Regional Endpoints **`api.eu.bfl.ai`** - European Multi-cluster Endpoint * Multi-cluster routing limited to EU regions * GDPR compliant * Provides the same uptime and load balancing benefits within EU regions **`api.us.bfl.ai`** - US Multi-cluster Endpoint * Multi-cluster routing limited to US regions * Provides the same uptime and load balancing benefits within US regions ## Key Benefits of New Endpoints Reduced downtime through automatic cluster failover Intelligent traffic distribution prevents overload during peak usage Load balancing happens transparently on our end ## Polling URL Usage When using the primary global endpoint (`api.bfl.ai`) or regional endpoints (`api.eu.bfl.ai`, `api.us.bfl.ai`), you **must** use the `polling_url` returned in the initial request response. **Webhook Users:** If you're using webhooks to receive results, no changes are needed. The `polling_url` requirement only applies when implementing async polling behavior to check request status. ### Example Implementation ```python polling_example.py theme={null} import requests import time import os # Submit request to global endpoint response = requests.post( 'https://api.bfl.ai/v1/flux-2-pro-preview', headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), 'Content-Type': 'application/json', }, json={ 'prompt': 'A serene landscape with mountains', 'width': 1440, 'height': 810 } ) data = response.json() request_id = data['id'] polling_url = data['polling_url'] # Use this URL for polling # Poll using the returned polling_url while True: time.sleep(0.5) result = requests.get( polling_url, headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), } ).json() if result['status'] == 'Ready': print(f"Image ready: {result['result']['sample']}") break elif result['status'] in ['Error', 'Failed']: print(f"Generation failed: {result}") break ``` ```bash polling_example.sh theme={null} # Submit request and extract polling URL response=$(curl -X 'POST' \ 'https://api.bfl.ai/v1/flux-2-pro-preview' \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "prompt": "A serene landscape with mountains", "width": 1440, "height": 810 }') request_id=$(echo $response | jq -r .id) polling_url=$(echo $response | jq -r .polling_url) # Poll using the polling URL while true; do sleep 0.5 result=$(curl -s -X 'GET' \ "${polling_url}" \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}") status=$(echo $result | jq -r .status) echo "Status: $status" if [ "$status" == "Ready" ]; then echo "Result: $(echo $result | jq -r .result.sample)" break elif [ "$status" == "Error" ] || [ "$status" == "Failed" ]; then echo "Generation failed: $result" break fi done ``` ## Content Delivery and Storage Guidelines ### Delivery URLs Generated images are served from region-specific delivery URLs under `delivery.*.bfl.ai`. The region identifier is subject to change as we add or remove clusters, so do not rely on any specific hostname. ### Important Delivery Considerations **Not for Direct Serving:** The `result.sample` URLs from delivery endpoints are not meant to be served directly to end users. **No CORS Support:** We do not enable CORS on delivery URLs, which means they cannot be used directly in web browsers for cross-origin requests. **10-Minute Expiration:** Generated images expire after 10 minutes and become inaccessible. **Network Access:** If your infrastructure uses firewalls or network restrictions, whitelist the wildcard `delivery.*.bfl.ai` (or all of `*.bfl.ai`) to allow downloading generated images. Whitelisting individual regional hostnames is not recommended — region identifiers can change as clusters are added or removed. ### Recommended Image Handling **Download and Re-serve Pattern:** ```python download_and_serve.py theme={null} import requests import os from datetime import datetime from typing import Dict, Any def download_and_store_image(result_url: str, local_path: str) -> str: """ Download image from BFL delivery URL and store locally """ response = requests.get(result_url) response.raise_for_status() with open(local_path, 'wb') as f: f.write(response.content) return local_path def handle_generation_result(result: Dict[str, Any]) -> Dict[str, Any]: """ Process generation result and store image locally """ if result['status'] == 'Ready': sample_url = result['result']['sample'] # Generate unique filename timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") filename = f"generated_image_{timestamp}.jpg" local_path = os.path.join("./images", filename) # Ensure directory exists os.makedirs(os.path.dirname(local_path), exist_ok=True) # Download and store stored_path = download_and_store_image(sample_url, local_path) # Now serve from your own infrastructure return { 'status': 'ready', 'local_path': stored_path, 'public_url': f"https://yourdomain.com/images/{filename}" } return result ``` ```javascript download_and_serve.js theme={null} const fs = require('fs'); const path = require('path'); const https = require('https'); async function downloadAndStoreImage(resultUrl, localPath) { return new Promise((resolve, reject) => { const file = fs.createWriteStream(localPath); https.get(resultUrl, (response) => { response.pipe(file); file.on('finish', () => { file.close(); resolve(localPath); }); file.on('error', (err) => { fs.unlink(localPath, () => {}); // Delete incomplete file reject(err); }); }).on('error', reject); }); } async function handleGenerationResult(result) { if (result.status === 'Ready') { const sampleUrl = result.result.sample; // Generate unique filename const timestamp = new Date().toISOString().replace(/[:.]/g, '-'); const filename = `generated_image_${timestamp}.jpg`; const localPath = path.join('./images', filename); // Ensure directory exists fs.mkdirSync(path.dirname(localPath), { recursive: true }); // Download and store const storedPath = await downloadAndStoreImage(sampleUrl, localPath); // Return path for serving from your infrastructure return { status: 'ready', localPath: storedPath, publicUrl: `https://yourdomain.com/images/${filename}` }; } return result; } ``` ## Migration Checklist * Replace legacy endpoints with appropriate new endpoints based on your needs * Use `api.bfl.ai` for global load balancing * Use `api.eu.bfl.ai` or `api.us.bfl.ai` for regional preferences * Ensure your code extracts and uses the `polling_url` from API responses * Update polling logic to use the provided polling URL instead of hardcoded endpoints * Set up download and re-serve infrastructure for generated images * Plan for 10-minute expiration window * Consider implementing CDN or cloud storage for better performance ## Best Practices ### Error Handling ```python error_handling.py theme={null} import requests import time from typing import Dict, Any, Optional def robust_api_call(url: str, headers: Dict[str, str], json_data: Dict[str, Any], max_retries: int = 3) -> Dict[str, Any]: """ Robust API call with retry logic and proper error handling """ for attempt in range(max_retries): try: response = requests.post(url, headers=headers, json=json_data) if response.status_code == 429: # Rate limit exceeded, wait and retry wait_time = 2 ** attempt # Exponential backoff time.sleep(wait_time) continue elif response.status_code == 402: # Insufficient credits raise Exception("Insufficient credits. Please add credits to your account.") elif response.status_code >= 400: # Other client/server errors response.raise_for_status() return response.json() except requests.exceptions.RequestException as e: if attempt == max_retries - 1: raise e time.sleep(2 ** attempt) raise Exception(f"Failed after {max_retries} attempts") ``` ### Rate Limiting * Maximum 24 concurrent requests for most endpoints * Maximum 6 concurrent requests for `flux-kontext-max` * Implement exponential backoff for 429 responses ### Content Management * Download images immediately upon generation completion * Implement proper error handling for expired URLs * Consider implementing a queue system for high-volume applications * Use appropriate storage solutions (CDN, cloud storage) for serving images to users # FLUX MCP server Source: https://docs.bfl.ml/api_integration/mcp_integration Generate images and video, edit, vary, browse, and reuse FLUX results from any MCP-compatible client. OAuth sign-in, no API keys to manage. **Connect FLUX.** Most modern MCP clients can connect to `https://mcp.bfl.ai` directly and handle the OAuth flow on their own — pick your client from the tabs below. For stdio-only or OAuth-incompatible clients (for example Hermes), use the `mcp-remote` fallback tab. It runs locally, handles the browser OAuth flow, refreshes tokens for you, and exposes FLUX as a normal stdio server. **Bring FLUX into the tools you already use.** Generate options in parallel, edit attached images through prompts, branch into variations from any result you like, and generate video from the same conversation, inside Claude, Cursor, Codex, Windsurf, and any MCP-compatible client. No API code, no keys pasted into the conversation. ## Pricing You pay BFL directly. The organization selected during OAuth sign-in is billed for generated images. No shared quotas, no middleman. To change organizations, disconnect the connector and reconnect it. Current rates are listed at [bfl.ai/pricing](https://bfl.ai/pricing). ## Tool reference The MCP server exposes a small set of tools. Your client decides which to call based on your prompt — you do not need to invoke them by name. The reference is here for developers who want to know exactly what is available. | Tool | Purpose | Notes | | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `generate_image` | Generate one or up to 8 images in parallel. Covers text-to-image, edits, multi-reference composition, style transfer, inpainting-style edits, and outpainting through prompts. | Each entry in `requests` carries its own prompt, model, dimensions, seed, and up to 8 `input_image` slots. Outpainting uses `width`/`height` larger than the source. | | `vto` | Virtual try-on. Dress a person, pet, or mascot in a garment, hat, sunglasses, shoes, bag, or any other wearable taken from a reference image. Face, hair, and pose stay as they were; only the worn item changes. | Takes a `person` image and a `garment` image, each as a prior `request_id` or a public URL. One garment slot per call, so merge a multi-piece outfit into a single reference image first. | | `generate_variations` | Produce N more images "in the same direction" as a previous generation, identified by `request_id`. | Reuses the original prompt, model, dimensions, and any input image slots. Defaults to 4 variations, max 8. | | `get_history` | List recent generations as a thumbnail grid with per-tile actions (Variations, Edit, copy, download). | Keyset pagination on `created_at` via `cursor`; supports `before` / `after` date filters and a `status` filter. | | `get_credits` | Return the calling user's remaining BFL credit balance. | Useful when a generation fails for billing reasons. | | `generate_video` | Generate video with FLUX 3. Covers text-to-video, animating or morphing between supplied keyframe images, and continuing from an existing clip. | Each entry in `requests` sets `mode` (`t2v`, `i2v`, `v2v`) and a prompt, plus optional `duration` (5–20 seconds, or `auto`), `aspect_ratio`, and `resolution` (`hd` or `fhd`). Up to 4 clips per call. `generate_audio` is on by default. Returns a `request_id` immediately; see the video note below. | | `enhance_video` | Re-render a finished draft at full quality, keeping the same composition, seed, and prompt plan. | Takes the `request_id` of a ready draft and finishes at `fhd` by default. This is the commit step of the draft-then-enhance loop. | Available models on `generate_image`: `flux2_pro_preview` (default), `flux2_max` (highest quality), `flux2_klein_9b_preview` (faster, up to 4 input images), `flux2_flex` (best for typography), `flux2_klein_4b`. The full catalog, per-model reference-image limits, and the FLUX Tools are also exposed as the `bfl://models` MCP resource. Video runs on `flux3_video`. Note that `vto` is its own tool, not a model. Ask for a try-on in plain language and your client routes there; passing `vto` as a `model` value to `generate_image` fails. **Video returns a `request_id` first.** `generate_video` responds with `{"status": "pending", "request_id": "…"}` right away. Clips take minutes, and long ones can take considerably longer. Visual clients keep polling on their own. In a terminal client, ask again or have your agent call `get_result(request_id="…")` to pick the clip up. **Draft first, then enhance.** Setting `draft: true` renders a cheap `hd` pass so you can judge motion and timing before committing. When you like it, `enhance_video` re-renders that same draft at full quality. Drafts are `hd` only. ## Troubleshooting * In Claude Desktop or Claude.ai, open **Settings → Connectors** and confirm the FLUX connector shows as **Connected**. * If the connection failed silently, remove the connector and add it again. Make sure pop-ups are not blocked so the OAuth window can open. * In Claude Code, run `claude mcp list` to confirm the server is registered. * In Codex, run `codex mcp list` to confirm the `FLUX` server is registered, then start a new Codex session. If the FLUX tools are not responding, or you just installed or updated the connector, refreshing the connection can help. * **Claude.ai / Claude Desktop:** open **Settings → Connectors**, toggle the FLUX connector off and on, or click **Reconnect**. Restarting Claude Desktop is another way to pick up a fresh tool list. * **Claude Code:** run `/mcp` to view server status and reauthenticate. To rebuild the registration entirely, run `claude mcp remove FLUX` followed by `claude mcp add --transport http FLUX https://mcp.bfl.ai`. * **Codex:** run `codex mcp login FLUX` to reauthenticate. To rebuild the registration entirely, run `codex mcp remove FLUX` followed by `codex mcp add FLUX --url https://mcp.bfl.ai` — the OAuth browser flow runs automatically on add. * **`mcp-remote` clients:** clearing the cached OAuth tokens with `rm -rf ~/.mcp-auth` and restarting the client triggers a fresh browser sign-in. * To confirm the tools are live, ask your MCP client something simple like *"check my BFL credits"*. * Make sure you have a BFL account at [bfl.ai](https://bfl.ai). * Disconnect and reconnect the MCP server to redo the OAuth flow. * Check that the selected organization has sufficient credits. * Ask your MCP client to check your BFL credits if you want to verify the current balance. Large sets of images, FLUX.2 \[max], or complex edits can take longer than smaller generations. In Claude and other visual MCP clients, the image view keeps updating automatically. Video is slower by nature. You can expect a video to take minutes rather than seconds, on top of that duration and `fhd` resolution increase generation time. If your client has stopped showing progress, ask it to check the request again, or call `get_result` with the `request_id` from the original response. Use `draft: true` while you are still iterating. Your MCP client needs permission to upload attached images to BFL. If your client blocks outbound HTTPS from its sandbox, allow the `*.bfl.ai` domain or use a public image URL instead. * Use detailed prompts. Describe subject, style, composition, and lighting. * For typography or readable text, ask for FLUX.2 \[flex]. * For hero shots or final assets, ask for FLUX.2 \[max]. * For edits, say what should stay unchanged as well as what should change. Disconnect the FLUX connector in your client and reconnect it. The OAuth flow will prompt you to select an organization again. ## Prompt Tips * **Front-load the subject.** Put the most important object, person, or scene first. * **Describe lighting.** “Soft golden hour light” or “overcast diffused studio light” gives the model useful direction. * **Use hex colors.** `#FF6B6B (coral pink)` is more precise than “pinkish red”. * **Quote rendered text.** Use exact quoted strings for typography, labels, posters, and signs. * **Avoid negative prompts.** FLUX responds to what you describe, not a list of what to avoid. * **Iterate from results.** Use Variations for alternatives or Edit to keep refining a generated image. * **For video, name one thing that happens.** A clip needs a subject, a camera behaviour, and a single motivated event. Describe the sound you want too, since audio is generated with the picture. *** ## Agent Skills MCP and Agent Skills solve different problems: | | MCP | Agent Skills | | ---------------- | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | | **What it does** | Generates, edits, varies, and browses images and video directly in chat | Teaches your coding agent how to write FLUX API code and how to direct FLUX generations | | **Best for** | Creative work inside Claude or another MCP client | Building applications that call the FLUX API | | **Install on** | Claude Desktop, Claude.ai, Claude Code, and MCP-compatible clients | Claude Code, Cursor, Windsurf, and other skill-compatible tools | ### Installation ```bash theme={null} /plugin marketplace add black-forest-labs/skills /plugin install flux-image-best-practices@black-forest-labs /plugin install flux-3-video@black-forest-labs ``` ```bash theme={null} npx skills add black-forest-labs/skills ``` Or add manually by placing the skill files in `.cursor/skills/` in your project. ```bash theme={null} npx skills add black-forest-labs/skills ``` Skills follow the open [agentskills.io](https://agentskills.io) specification and work with any compatible tool. ### What Your Agent Learns **flux-image-best-practices** teaches prompting patterns: prompt structure, lighting vocabulary, hex colors, typography, model selection, and why FLUX does not use negative prompts. **bfl-api** teaches production API patterns: async generation, rate-limit handling, URL expiration, regional endpoints, webhook verification, and error handling. **flux-3-video** is a set of six skills for video work. `flux-3-video` routes a request to the ones it needs; `flux-3-prompt-doctor` catches the decisions that change the payload before anything is generated; `flux-3-cinematic-inserts` covers shot craft for text-to-video; `flux-3-keyframes-continuation` covers building from supplied images or extending an existing clip; `flux-3-audio-dialogue` covers ambience, effects, and speech; and `flux-3-generate` covers submitting, polling, drafts, and downloads. ### Updating ```bash theme={null} npx skills update black-forest-labs/skills ``` ### Resources * [BFL Skills on GitHub](https://github.com/black-forest-labs/skills) * [agentskills.io specification](https://agentskills.io) # FLUX.1 Fill [pro] Source: https://docs.bfl.ml/flux_1_fill Use FLUX.1 Fill for text-driven inpainting and outpainting to edit image regions or extend borders. ## What is FLUX.1 Fill? FLUX.1 Fill is a specialized inpainting model tailored for two complementary applications: **Selecting specific regions within an image and editing them** - Transform parts of your image while preserving the surrounding context. Change objects, enhance details, or remove unwanted elements naturally. **Adding new pixels at the image borders** - Extend images beyond their original boundaries to increase resolution or change aspect ratios. Perfect for expanding scenes or adapting content for different formats. ## Examples ### Inpainting: Object Replacement This example shows how FLUX.1 Fill can replace specific parts of an image while keeping everything else intact. On the top part of the image, we replace the jacket with a different style. On the bottom part of the image, we replace the text on the neon sign. When using a mask, black areas will be preserved while white areas will be inpainted. The second example demonstrates how you can use a black and white mask to define the area to change. The original "KILL BILL" title becomes "FLUX PILL" using a mask. ## Using FLUX.1 Fill API FLUX.1 Fill supports two approaches for specifying edit areas: * **Separate Mask**: Provide two files - your image plus a separate black/white mask image. Black areas preserve the original, white areas get inpainted. * **Alpha Channel**: Provide one PNG/WebP with transparency. Transparent areas get inpainted, opaque areas are preserved. No separate mask file needed. ### Create a Request ```bash curl theme={null} curl -X POST "https://api.bfl.ai/v1/flux-pro-1.0-fill" \ -H "x-key: $BFL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "", "image": "", "mask": "", "steps": 50, "guidance": 30, "output_format": "jpeg", "safety_tolerance": 2 }' ``` ```python Python theme={null} # Install `requests` (e.g. `pip install requests`) # and `Pillow` (e.g. `pip install Pillow`) import os import requests import base64 from PIL import Image from io import BytesIO # Load and encode your image # Replace "" with the path to your image file image = Image.open("") buffered = BytesIO() image.save(buffered, format="JPEG") # Or "PNG" if your image is PNG img_str = base64.b64encode(buffered.getvalue()).decode() mask = Image.open("") buffered = BytesIO() mask.save(buffered, format="PNG") mask_str = base64.b64encode(buffered.getvalue()).decode() response = requests.post( "https://api.bfl.ai/v1/flux-pro-1.0-fill", headers={ "x-key": os.environ.get("BFL_API_KEY"), "Content-Type": "application/json" }, json={ "prompt": "", "image": img_str, "mask": mask_str, "steps": 50, "guidance": 30, "output_format": "jpeg" } ) result = response.json() request_id = result["id"] polling_url = result["polling_url"] ``` ### Poll for Results After submitting a request, you need to poll using the returned `polling_url` to retrieve the output when ready. ```bash poll_result.sh theme={null} while true; do sleep 0.5 result=$(curl -s -X 'GET' \ "${polling_url}" \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}") status=$(echo $result | jq -r .status) echo "Status: $status" if [ "$status" == "Ready" ]; then echo "Result: $(echo $result | jq -r .result.sample)" break elif [ "$status" == "Error" ] || [ "$status" == "Failed" ]; then echo "Generation failed: $result" break fi done ``` ```python poll_result.py theme={null} # This assumes that the `polling_url` variable is set. import time import os import requests while True: time.sleep(0.5) result = requests.get( polling_url, headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), } ).json() if result['status'] == 'Ready': print(f"Image ready: {result['result']['sample']}") break elif result['status'] in ['Error', 'Failed']: print(f"Generation failed: {result}") break ``` A successful response will be a JSON object containing the result, and `result['sample']` is a signed URL for retrieval. Our signed URLs are only valid for 10 minutes. Please retrieve your result within this timeframe. # FLUX.2 Image Editing Source: https://docs.bfl.ml/flux_2/flux2_image_editing Edit images with FLUX.2 using text prompts and multi-reference support for up to 10 images, with advanced controls and up to 4MP output. **Edit images like magic.** Describe what you want changed, and FLUX.2 makes it happen. Combine furniture from multiple photos into one room. Replace people with animals while keeping proportions perfect. Change backgrounds, swap textures, edit text—all while maintaining photorealism that matches professional photography. Reference multiple images simultaneously - up to 8 via API, up to 10 in the playground. Use **\[max]** for highest precision editing, **\[pro]** for production at scale, **\[flex]** for fine-grained control, or **\[klein]** for cost-efficient high-volume editing. **Try it live** - Upload images and describe your edits in our [playground](https://playground.bfl.ai). See the magic happen in seconds. ## Examples ### Single Reference Foggy forest hillside Sunny forest hillside with birds ### Multi Reference ## API Integration ### Create Request ```python Python theme={null} import os import requests # Using image URLs directly (simplest) # flux-2-pro-preview reflects our latest advances (use flux-2-pro for a pinned model) response = requests.post( 'https://api.bfl.ai/v1/flux-2-pro-preview', headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), 'Content-Type': 'application/json', }, json={ 'prompt': '', 'input_image': 'https://example.com/your-image.jpg', # 'input_image_2': 'https://example.com/reference-2.jpg', # Optional }, ).json() request_id = response["id"] polling_url = response["polling_url"] ``` ```typescript TypeScript theme={null} // Using image URLs (simplest method) // flux-2-pro-preview reflects our latest advances (use flux-2-pro for a pinned model) const response = await fetch("https://api.bfl.ai/v1/flux-2-pro-preview", { method: "POST", headers: { accept: "application/json", "x-key": process.env.BFL_API_KEY!, "Content-Type": "application/json", }, body: JSON.stringify({ prompt: "", input_image: "https://example.com/your-image.jpg", // input_image_2: "https://example.com/reference-2.jpg", // Optional }), }); const { id: requestId, polling_url: pollingUrl } = await response.json(); ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "net/http" "os" ) func main() { // Using image URLs (simplest method) // flux-2-pro-preview reflects our latest advances (use flux-2-pro for a pinned model) payload, _ := json.Marshal(map[string]string{ "prompt": "", "input_image": "https://example.com/your-image.jpg", // "input_image_2": "https://example.com/reference-2.jpg", // Optional }) req, _ := http.NewRequest("POST", "https://api.bfl.ai/v1/flux-2-pro-preview", bytes.NewBuffer(payload)) req.Header.Set("accept", "application/json") req.Header.Set("x-key", os.Getenv("BFL_API_KEY")) req.Header.Set("Content-Type", "application/json") resp, _ := http.DefaultClient.Do(req) defer resp.Body.Close() var result map[string]interface{} json.NewDecoder(resp.Body).Decode(&result) requestId := result["id"].(string) pollingUrl := result["polling_url"].(string) fmt.Println(requestId, pollingUrl) } ``` ```bash cURL theme={null} # Using image URLs (simplest method) # flux-2-pro-preview reflects our latest advances (use flux-2-pro for a pinned model) request=$(curl -X POST \ 'https://api.bfl.ai/v1/flux-2-pro-preview' \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "prompt": "", "input_image": "https://example.com/your-image.jpg", "input_image_2": "https://example.com/reference-2.jpg" }') echo $request request_id=$(echo $request | jq -r .id) polling_url=$(echo $request | jq -r .polling_url) ``` ### Poll for Result ```python Python theme={null} # This assumes that the `polling_url` variable is set. import time import os import requests while True: time.sleep(0.5) result = requests.get( polling_url, headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), }, ).json() if result['status'] == 'Ready': print(f"Image ready: {result['result']['sample']}") break elif result['status'] in ['Error', 'Failed']: print(f"Generation failed: {result}") break ``` ```typescript TypeScript theme={null} // This assumes that the `pollingUrl` variable is set. while (true) { await new Promise((resolve) => setTimeout(resolve, 500)); const result = await fetch(pollingUrl, { headers: { accept: "application/json", "x-key": process.env.BFL_API_KEY!, }, }).then((res) => res.json()); if (result.status === "Ready") { console.log(`Image ready: ${result.result.sample}`); break; } else if (["Error", "Failed"].includes(result.status)) { console.log(`Generation failed: ${JSON.stringify(result)}`); break; } } ``` ```go Go theme={null} // This assumes that the `pollingUrl` variable is set. for { time.Sleep(500 * time.Millisecond) req, _ := http.NewRequest("GET", pollingUrl, nil) req.Header.Set("accept", "application/json") req.Header.Set("x-key", os.Getenv("BFL_API_KEY")) resp, _ := http.DefaultClient.Do(req) var result map[string]interface{} json.NewDecoder(resp.Body).Decode(&result) resp.Body.Close() status := result["status"].(string) fmt.Println("Status:", status) if status == "Ready" { sample := result["result"].(map[string]interface{})["sample"].(string) fmt.Println("Image ready:", sample) break } else if status == "Error" || status == "Failed" { fmt.Println("Generation failed:", result) break } } ``` ```bash cURL theme={null} while true; do sleep 0.5 result=$(curl -s -X 'GET' \ "${polling_url}" \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}") status=$(echo $result | jq -r .status) echo "Status: $status" if [ "$status" == "Ready" ]; then echo "Result: $(echo $result | jq -r .result.sample)" break elif [ "$status" == "Error" ] || [ "$status" == "Failed" ]; then echo "Generation failed: $result" break fi done ``` Signed URLs are only valid for 10 minutes. Please retrieve your result within this timeframe. For all available parameters and endpoint details, see the [API Reference](/api-reference). # FLUX.2 [klein] Training Source: https://docs.bfl.ml/flux_2/flux2_klein_training Fine-tune FLUX.2 [klein] models with custom datasets using LoRA training for specialized image generation. FLUX.2 Klein Training This guide covers how to train LoRAs and fine-tune FLUX.2 \[klein] models on your own datasets. With open weights available under Apache 2.0 (4B) and FLUX Non-Commercial License (9B), you can create custom models tailored to your specific needs. ## Overview FLUX.2 \[klein] Base models are ideal for fine-tuning due to their undistilled architecture, which preserves the full training signal. This makes them perfect for: * **LoRA Training**: Lightweight adapters for style transfer and character consistency * **Full Fine-tuning**: Complete model adaptation for specialized domains * **Research**: Experimentation with novel training techniques ## Why Train FLUX.2 \[klein] Models? Create custom artistic styles that can be applied to any subject matter. Perfect for consistent branding or artistic projects. Train models to generate specific characters or people with consistent features across different scenes and poses. Adapt models for specialized domains like medical imaging, technical illustrations, or specific art movements. Teach the model new concepts, objects, or visual patterns not well-represented in the base training data. ## Community Tools Open-source frameworks provide full control over the training process: All-in-one training suite with GUI and CLI. Optimized for consumer GPUs with 12GB+ VRAM. Official Hugging Face library with DreamBooth and LoRA training examples for FLUX.2. ## Model Variants Choose the right \[klein] variant for your use case: | Variant | **Best For** | **License** | | ---------------------------------------------------------------------------------- | --------------------------------- | ------------------- | | [**klein 4B Base**](https://huggingface.co/black-forest-labs/FLUX.2-klein-base-4B) | Quick iterations | Apache 2.0 | | [**klein 9B Base**](https://huggingface.co/black-forest-labs/FLUX.2-klein-base-9B) | Maximum quality, complex concepts | FLUX Non-Commercial | Base models are undistilled and provide higher output diversity, making them ideal starting points for fine-tuning. The 4B variant is recommended for most users due to lower hardware requirements. ## System Requirements ### Minimum Hardware * **GPU**: NVIDIA with 12GB VRAM (RTX 3060 12GB, RTX 4060 Ti 16GB) * **RAM**: 32GB system memory * **GPU**: NVIDIA with 22GB VRAM (RTX 3090, RTX 4090) * **RAM**: 64GB system memory ## Training Types ### LoRA Training **Low-Rank Adaptation (LoRA)** is the most popular training method: * ✅ Lightweight (typically 10-200MB) * ✅ Fast training (1-3 hours on consumer GPUs) * ✅ Easy to share and combine * ✅ Minimal hardware requirements **Use cases**: Style transfer, character consistency, concept learning ### Full Fine-tuning Complete model adaptation for maximum control: * ⚠️ Large file sizes * ⚠️ Longer training times (days to weeks) * ⚠️ High-end hardware recommended * ✅ Maximum flexibility and quality **Use cases**: Specialized domains, production deployments, checkpoint training, research ## Getting Started Follow our complete hands-on guide with a real dataset example. Learn how to prepare data, configure training, and use your trained LoRA. ### Quick Start Resources Get FLUX.2 Klein base models from Hugging Face. Learn how to prompt Klein models effectively. ## Training Best Practices ### Dataset Preparation * Use high-resolution images (1024px or higher) * Ensure consistent quality across all training images * Remove artifacts and low-quality samples * Use descriptive, detailed captions * Include your trigger word consistently: `[trigger]` * Describe everything visible except the style/concept you want to teach the model * Vary poses, angles, and compositions * Include different lighting conditions * Mix close-ups with full scenes * Avoid repetitive backgrounds ### Training Parameters * **LoRA Training**: 8e-5 to 1e-4 * **Full Fine-tuning**: 1e-5 to 5e-5 * Lower rates for style, higher for characters * **Style LoRAs**: 1500-2500 steps * **Character LoRAs**: 1500-3000 steps * Monitor sample outputs to avoid overfitting * Start with 512px for faster iterations * Use 1024px or higher for final training * Use higher resolution if you want to capture macro details ## Using Your Trained LoRA After training, you can use your LoRA with various tools: Upload your `.safetensors` in the Dashboard under [**Customization → Finetunes**](https://dashboard.bfl.ai/) and call the fine-tuned endpoint with the resulting `finetune_id` — no local GPU required. ```python theme={null} import os, requests response = requests.post( "https://api.bfl.ai/v1/flux-2-klein-9b-kv-finetuned", headers={"x-key": os.environ["BFL_API_KEY"], "Content-Type": "application/json"}, json={ "prompt": "a photo of ohwx in a garden on a sunny day", "finetune_id": "your-lora-id", "finetune_strength": 1.0, }, ) print(response.json()) ``` See the [LoRA Inference guide](/flux_2/flux2_lora_inference) for the full endpoint reference and managed-serving details. ```python theme={null} import torch from diffusers import Flux2KleinPipeline pipe = Flux2KleinPipeline.from_pretrained( "black-forest-labs/FLUX.2-klein-base-9B", torch_dtype=torch.bfloat16 ) pipe.load_lora_weights("path/to/your_lora.safetensors") pipe.to("cuda") image = pipe( "a photo of ohwx in a garden on a sunny day", # Use your trigger word num_inference_steps=50, guidance_scale=4.0, ).images[0] ``` 1. Place `.safetensors` file in `ComfyUI/models/loras/` 2. Add "Load LoRA" node to your workflow 3. Connect to your FLUX Klein model 4. Use trigger word in prompts ## Next Steps Complete step-by-step guide with real dataset. Upload your LoRA to the Dashboard and serve it through a managed endpoint. Learn effective prompting techniques. Download \[klein] Base models. # FLUX.2 [klein] Style Training Source: https://docs.bfl.ml/flux_2/flux2_klein_training_example Technical guide for training style LoRAs on FLUX.2 [klein] models with a Graphic Impressions style example FLUX.2 [klein] Training Example *** ## Overview This example walks through training a style LoRA using a fully synthetic dataset — images generated with FLUX.1 \[dev] and various illustrative LoRAs at different strengths. ### Output Characteristics The resulting style has painterly brushwork with strong graphic structure — bold shapes, deep shadows, saturated but limited colors. Edges go between soft and sharp, giving it a hand-painted feel. Style example *** ## Training Pipeline Training has three parts that need to work together: 1. **Training Data** – Source material the model learns from 2. **Configuration Parameters** – Training behavior and optimization targets 3. **Sampling Settings** – Inference-time extraction of learned characteristics *** ## Part 1: Dataset Preparation Example ### Dataset Size Requirements Optimal dataset size: 20-40 images * Below 20 images: Insufficient variation for generalization * Above 40 images: Style dilution through excessive variation Dataset composition should include diverse angles, subjects, and compositions to enable aesthetic generalization rather than scene memorization. **This example uses:** 27 training images with corresponding caption files. **Training Dataset:** Training 1 Training 2 Training 3 Training 4 Training 5 Training 6 Training 7 Training 8 Training 9 Training 10 Training 11 Training 12 Training 13 Training 14 Training 15 Training 16 Training 17 Training 18 Training 19 Training 20 Training 21 Training 22 Training 23 Training 24 Training 25 Training 26 Training 27 ### Caption Strategy for Style Training Captions should only describe what's in the image — no style descriptors. With a small dataset, the model strongly associates text with visuals. If you leave out style descriptions, it's forced to learn the visual style implicitly from the images themselves. A unique trigger word (e.g. `GFX_IMPR5N`) in every caption gives you a way to activate the style at inference without polluting the base model's vocabulary. ### Caption Example Scorpion training example **Caption:** *GFX\_IMPR5N. Close Up Three Quarter Left of a scorpion standing on a rounded rock surface. The scorpion's body angles from the lower left toward the upper right, with both pincers extended forward and the segmented tail arched upward over the back ending in a stinger. Multiple legs are spread to either side, and the abdomen shows distinct segment divisions. The rock occupies the lower foreground, with the scorpion centered above it against an open background.* **Omitted descriptors:** Solid black background, red highlight, painterly brushstrokes ### File Structure ``` gfx_imp_dataset/ ├── GFX_IMP (1).png ├── GFX_IMP (1).txt ├── GFX_IMP (2).png ├── GFX_IMP (2).txt ├── GFX_IMP (3).png ├── GFX_IMP (3).txt └── ... (27 images total) ``` `GFX_IMP (1).txt`: ``` GFX_IMPR5N. Waist Up Medium Shot Three Quarter Right of a person wearing a wide-brim cowboy hat and a suit jacket over a collared shirt and tie. The person is centered in the frame with shoulders squared and head slightly tilted upward, looking past the camera. Face details: long face shape, angled jawline, narrow pointed chin, prominent cheekbones, medium-height forehead, pronounced brow ridge, thick straight eyebrows, deep-set almond eyes, straight narrow nose bridge, narrow nostrils, thin upper lip with fuller lower lip, mouth slightly open with teeth not visible, clean-shaven cheeks and chin, short hair visible at the sides under the hat, medium ears slightly protruding. Wooden building facades sit in the left and right background, with a utility pole and wires behind the person on the right side, and scattered clouds in the sky. ``` `GFX_IMP (2).txt`: ``` GFX_IMPR5N. Medium Shot Profile Left of a shirtless person standing beside a multi-pane window. The person occupies the right half of the frame, torso angled slightly toward the window, head bowed with eyes closed. Face details: oval-to-long face shape, sharp jawline, pointed chin, defined cheekbones, medium forehead height, visible brow ridge, thick eyebrows, closed eyelids with hooded lids, straight narrow nose bridge, small nostrils, thin lips with mouth closed, clean-shaven jaw and upper lip, short hair with a messy fringe, visible ear with average size. The window fills the left background with vertical and horizontal muntins, while hanging drapery and wall panels appear in the upper right background. ``` `GFX_IMP (3).txt`: ``` GFX_IMPR5N. Close Up Three Quarter Left of a scorpion standing on a rounded rock surface. The scorpion's body angles from the lower left toward the upper right, with both pincers extended forward and the segmented tail arched upward over the back ending in a stinger. Multiple legs are spread to either side, and the abdomen shows distinct segment divisions. The rock occupies the lower foreground, with the scorpion centered above it against an open background. ``` `GFX_IMP (4).txt`: ``` GFX_IMPR5N. Shoulder Up Close Up Profile Right of two people lying face-to-face with their noses nearly touching. The left person fills the left foreground facing right, and the right person fills the right foreground facing left, with their cheeks and lips separated by a small gap; an arm wraps across the lower left foreground around the other person's shoulder. Left person face details: oval face shape, soft jawline, rounded chin, high cheekbones, medium forehead height, smooth brow ridge, thick arched eyebrows, closed eyelids with long lashes, straight nose bridge with a small rounded tip, medium-width lips with mouth closed, visible ear with a hoop earring, hair pulled back into a bun, no facial hair. Right person face details: long face shape, angular jawline, pointed chin, defined cheekbones, medium forehead height, pronounced brow ridge, thick eyebrows, closed eyelids, straight narrow nose bridge, fuller lips with mouth slightly open and teeth not visible, visible ear with average size, short hair swept back, clean-shaven cheeks and chin. Diagonal bands cross parts of both faces and necks, and the background is a bed surface with rumpled fabric. ``` `GFX_IMP (5).txt`: ``` GFX_IMPR5N. Shoulder Up Close Up Frontal of a person framed by flowering stems and leaves in the foreground. The person is slightly left of center, facing the camera with a neutral mouth and direct gaze; one flower overlaps one eye and another flower overlaps the upper forehead area. Face details: oval face shape, soft jawline, pointed chin, prominent cheekbones, short forehead hidden by blunt bangs, thick straight eyebrows, almond-shaped eyes with average spacing (one eye partially obscured), straight narrow nose bridge, small rounded nose tip, narrow nostrils, full lips with a defined cupid's bow, mouth closed with no teeth visible, clean-shaven face, long straight hair with blunt bangs and thick density. Plant leaves and flower heads overlap the lower foreground and the left edge, while the background is a plain wall with faint vertical seams. ``` `GFX_IMP (6).txt`: ``` GFX_IMPR5N. Medium Wide Shot Frontal of a person running toward the camera inside a narrow corridor lined with large rectangular panels on both sides. The runner is centered low in the frame, leaning forward with one arm bent and driving forward and the other arm pulled back, gaze fixed ahead. Face details: square face shape, strong angular jawline, squared chin, pronounced cheekbones, medium forehead height, prominent brow ridge, thick eyebrows, narrow eyes, straight nose bridge with medium width, small nostrils, thin lips pressed together, clean-shaven cheeks and chin, short wavy hair with a messy front, ears partially visible. The person wears a suit jacket over a high-collared top, and the corridor's parallel walls and ceiling lines converge toward a vanishing point in the upper center background. ``` `GFX_IMP (7).txt`: ``` GFX_IMPR5N. Full Body Shot Frontal of a kneeling person with large feathered wings spread wide behind them. The person is centered with knees on the ground and hands placed on the surface to either side, head bowed forward; facial features obscured. The figure wears a fitted long-sleeve outfit, and the wings extend outward beyond the left and right edges of the frame. The ground forms a horizontal band across the lower foreground, with a largely empty backdrop behind the wings. ``` `GFX_IMP (8).txt`: ``` GFX_IMPR5N. Full Body Shot Frontal of a person in a suit standing on flat ground while holding an umbrella overhead with one hand. The figure is centered with legs straight and the free arm hanging down at the side; facial features obscured by a vertical column of flames rising from the neck and upper torso area to the underside of the umbrella. The umbrella canopy sits above the head, and the handle is held at chest level. A low horizon line separates the ground plane in the lower third from an empty background. ``` `GFX_IMP (9).txt`: ``` GFX_IMPR5N. Wide Shot Frontal of a suspension bridge spanning across a body of water, with a small sailboat near the center foreground. Large flower clusters and leaves fill the top foreground, overlapping the upper portion of the scene. A person sits on a bridge beam in the left midground with legs dangling, holding a fishing rod angled outward; facial features not visible due to distance. The bridge towers and cables extend from left to right into the background, with rocky shoreline and hills behind the bridge, and low shrubs in the left foreground. ``` `GFX_IMP (10).txt`: ``` GFX_IMPR5N Medium Wide Shot Profile Left of a person standing in the right foreground on an elevated walkway, facing left over a street lined with posters and billboards. The person wears a long coat or jacket and stands behind a horizontal railing that cuts across the lower half of the frame; facial features obscured. A large poster with a screaming face is cropped along the left edge, and cars are visible on the road below in the center background. ``` `GFX_IMP (11).txt`: ``` GFX_IMPR5N Wide Shot Frontal of a large human head sculpture centered above a narrow stream in a dense grove of tall, thin tree trunks. The face is bald with an oval shape, soft jawline, rounded chin, prominent cheekbones, tall forehead, thin arched eyebrows, closed eyes with smooth eyelids, a straight narrow nose with a rounded tip, and medium full lips with a closed mouth; medium ears with small hoop earrings. The stream runs from the foreground toward the sculpture, with rocks and leafy plants crowding both banks in the left and right foreground. ``` `GFX_IMP (12).txt`: ``` GFX_IMPR5N Shoulder Up Close Up Frontal of a person centered inside a large circular frame, looking straight toward the camera. The face is oval with a soft jawline and rounded chin, moderately prominent cheekbones, a tall forehead, medium-thick eyebrows with a slight arch, almond-shaped eyes with slight hooding and average spacing, a straight narrow nose with a small rounded tip, and full lips with a defined cupid's bow and slightly parted mouth; clean-shaven with no facial hair. Short hair is swept back with a side part, and tall building facades rise behind the circular frame in the background. ``` `GFX_IMP (13).txt`: ``` GFX_IMPR5N Macro Close Up Frontal of an open hand held toward the camera with the palm facing forward and fingers spread. A small circular mark sits at the center of the palm with thin radiating lines around it. The wrist and lower forearm enter from the bottom edge, and small scattered flecks float around the hand against a plain background. ``` `GFX_IMP (14).txt`: ``` GFX_IMPR5N Medium Shot Frontal of a seated person centered in frame holding a cigarette up near the left side of their head. The person wears a suit jacket and rests the other hand on a rectangular book or notebook on their lap; facial features obscured. Two palm tree trunks frame the person on the left and right, with palm fronds hanging near the top edge and vertical architectural lines in the background. ``` `GFX_IMP (15).txt`: ``` GFX_IMPR5N Medium Shot Frontal of a person standing among dense flowers in the foreground with their head tilted down. The face is oval with a soft jawline, a small pointed chin, subtle cheekbones, a medium-height forehead, straight medium eyebrows, almond-shaped downcast eyes, a straight narrow nose, and medium lips with a closed mouth; no facial hair. The person has shoulder-length hair with bangs and wears a V-neck dress with a tied belt, while a flat horizon with distant trees and a circular sun sits in the background. ``` `GFX_IMP (16).txt`: ``` GFX_IMPR5N Medium Shot Frontal of two people riding a motorcycle directly toward the camera inside an arched tunnel. The front rider is centered gripping the handlebars, with a square face, angular jawline, pronounced chin, prominent cheekbones, strong brow ridge, thick eyebrows, deep-set almond eyes with close spacing, a straight nose with a broad bridge, and thin lips in a closed mouth; short wavy hair with a side part and no visible facial hair. The rear rider appears over the left shoulder behind them with an oval face, soft jawline, small chin, gentle cheekbones, straight thin eyebrows, downcast almond eyes, a small straight nose, and thin lips with a closed mouth; short bobbed hair with bangs. The motorcycle's round headlamp and side mirrors dominate the lower center foreground, and repeating tunnel ribs and rectangular wall panels recede into the background. ``` `GFX_IMP (17).txt`: ``` GFX_IMPR5N Neck Up Close Up Frontal of a person with their head tilted back and mouth wide open, showing upper and lower teeth. The face is long with a sharp jawline, pointed chin, prominent cheekbones, a medium forehead, thick eyebrows, eyes squeezed shut, a straight nose with visible nostrils from the upward tilt, and medium lips stretched around the open mouth; small freckles or spots on the cheeks and chin, and ears visible with slight protrusion. The bare neck and shoulders fill the lower frame while small debris fragments float in the background. ``` `GFX_IMP (18).txt`: ``` GFX_IMPR5N Wide Shot Three Quarter Rear Right of a person riding a bicycle across a suspension bridge, positioned in the left foreground and leaning forward over drop handlebars. The rider wears a jacket and backpack; facial features not visible. Bridge cables and railings form converging lines toward a tower in the far right background, with a distant skyline and roadway elements receding along the right side of the frame. ``` `GFX_IMP (19).txt`: ``` GFX_IMPR5N Medium Wide Shot (MWS) Profile Left of a shirtless person crouched on a rocky ledge in the right foreground with one arm extended down toward sparse tufts of ground plants. The person has a long oval face, a sharp angled jawline, a pointed chin, prominent cheekbones, a medium-height forehead, straight medium-thick eyebrows, almond-shaped eyes looking downward, a straight narrow nose bridge with a defined tip, and thin closed lips; short hair with a tousled side-swept fringe and a clean-shaven face. A large cratered moon sits in the left background above a star-filled sky, and a curved arc band crosses the upper frame from left to right above jagged rock spires in the midground. ``` `GFX_IMP (20).txt`: ``` GFX_IMPR5N Wide Shot (WS) Rear Facing of two people seated on separate swings in the center foreground, viewed from behind with their legs hanging down and feet pointed toward the ground. Both faces are not visible. The swing ropes run vertically up out of frame, and a bicycle and a bag rest on the ground in the left foreground near low plants and tall grass. The background shows a body of water between rocky banks and distant hills, with bare trees scattered along the shoreline and a large sun above the horizon. ``` `GFX_IMP (21).txt`: ``` GFX_IMPR5N Close Up (CU) Frontal of a person curled up with knees drawn to their chest, centered in frame with their head lowered toward one knee. The person has an oval face with a soft jawline, a small rounded chin, high cheekbones, a short forehead partly covered by fringe, thick straight eyebrows, hooded almond-shaped eyes looking downward, a straight narrow nose, and thin lips pressed together; short hair with a messy fringe, a visible ear, and a clean-shaven face. The person wears a long-sleeve top and pants, and the background is a close wall of vertical wooden boards with a doorway opening behind the head and shoulders. ``` `GFX_IMP (22).txt`: ``` GFX_IMPR5N Medium Close Up (MCU) Frontal of a person leaning out of a car window in the right foreground with their head tilted back and one arm raised above their head. The person has an oval face, a defined jawline, a pointed chin, prominent cheekbones, a medium-height forehead, thick eyebrows partly obscured, eyes obscured by large sunglasses, a straight nose with narrow nostrils, and full lips with the mouth open and upper teeth visible; short tousled hair with loose strands and no facial hair. The person wears drop earrings and wrist bracelets, and the car door frame and side mirror occupy the lower left foreground. In the left background, a street recedes between multi-story buildings with several vehicles parked along the curb. ``` `GFX_IMP (23).txt`: ``` GFX_IMPR5N Medium Close Up (MCU) Frontal of a person seated in the driver's seat, centered behind the steering wheel with one hand gripping the wheel in the right foreground. The person has a square face, a strong angled jawline, a broad chin, pronounced cheekbones, a tall forehead, thick straight eyebrows, deep-set almond-shaped eyes, a straight medium-width nose with a rounded tip, and medium-full lips held closed; short hair swept back and a clean-shaven face. The car interior frames the subject with the front seat back in the left foreground and the dashboard and windshield along the lower frame. Through the side windows in the background, multiple people stand outside near a wall and vertical structures. ``` `GFX_IMP (24).txt`: ``` GFX_IMPR5N Full Body Shot Profile Right of a person kneeling on a tiled bathroom floor in front of a freestanding bathtub, with their head resting on the tub rim and one arm draped over the edge. The person wears a short-sleeve button-up shirt, a pleated skirt, socks, and shoes, and their other hand rests on the floor near an open book; facial features obscured by hair and head angle. Notebook pages and the open book lie flat in the center foreground, with several rocks placed to the right of the book. The background includes the bathtub faucet and pipes, wall panels, a doorframe on the right, and a cable running across the floor near the tub. ``` `GFX_IMP (25).txt`: ``` GFX_IMPR5N Shoulder Up Close Up Frontal of a person's face framed between two curtains, centered and looking directly toward the camera. The person has a long oval face, a sharp jawline, a squared chin, prominent cheekbones, a tall forehead, very thick straight eyebrows, almond-shaped eyes with visible eyelids, slightly wide-set eye spacing, a straight narrow nose bridge with a defined tip, and medium-full lips held closed; short hair swept back with a slightly uneven hairline and a clean-shaven face. The curtains occupy the left and right foreground edges, and a patterned shirt collar and upper chest are visible at the lower frame. ``` `GFX_IMP (26).txt`: ``` GFX_IMPR5N Wide Shot (WS) Rear Facing of a person in a suit standing centered in the foreground with their back to the camera, facing a crowded room of seated and standing people. Faces in the crowd are not clearly visible at this distance. Tables and chairs fill the lower foreground with bottles and glassware on the left table, and multiple figures in suits line the left and right edges. A round ceiling fixture is centered above the crowd, with tall doorway openings and wall panels framing the room in the background. ``` `GFX_IMP (27).txt`: ``` GFX_IMPR5N Wide Shot (WS) Frontal of a roaring tiger centered in the foreground with its mouth open and teeth visible, standing among tall grasses. Two deer stand behind the tiger on the left and right midground, and a flock of birds flies across the upper background. A large eye symbol sits high in the sky above a circular sun disc, with layered clouds and a horizontal waterline behind the animals. Dense plants frame the lower left and right foreground edges. ``` *** ## Part 2: Configuration Parameters ### Training Guidelines * Slow loss decrease: increase to `2e-4` * Loss oscillation: decrease to `5e-5` * Baseline starting point: `1e-4` * Style LoRAs (10-20 images): 1200-1800 steps * Character LoRAs (10-15 images): 800-1200 steps * Medium datasets (20-40 images): 1200-2000 steps * Large datasets (50+ images): 2000-3000 steps * Enable `quantize: true` for 8-bit quantization * Reduce resolution to 512x512 * Use `gradient_accumulation_steps: 2` for effective batch size of 2 * Use high-resolution training images (1024px+) * Write detailed, descriptive captions * Include variety in poses, lighting, and backgrounds * Monitor training duration to prevent overfitting ### Default Configuration ```yaml theme={null} job: "extension" config: name: "my_first_lora_v1" process: - type: "diffusion_trainer" training_folder: "/app/ai-toolkit/output" device: "cuda" trigger_word: "TRIGGER WORD HERE" network: type: "lora" linear: 32 linear_alpha: 32 conv: 16 conv_alpha: 16 save: dtype: "bf16" save_every: 250 datasets: - folder_path: "/path/to/images/folder" caption_ext: "txt" resolution: - 512 - 768 - 1024 train: batch_size: 1 steps: 3000 lr: 0.0001 optimizer: "adamw8bit" timestep_type: "weighted" content_or_style: "balanced" model: name_or_path: "black-forest-labs/FLUX.2-klein-base-9B" quantize: true meta: name: "[name]" version: "1.0" ``` ### Graphic\_Impressions Configuration ```yaml theme={null} job: "extension" config: name: "Graphic_Impressions_Flux2-klein-base-9b" process: - type: "diffusion_trainer" training_folder: "/app/ai-toolkit/output" device: "cuda" trigger_word: "GFX_IMPR5N" network: type: "lora" linear: 128 linear_alpha: 64 conv: 64 conv_alpha: 32 save: dtype: "bf16" save_every: 150 max_step_saves_to_keep: 20 datasets: - folder_path: "/workspace/aitoolkit/datasets/Graphic_Impressions" caption_ext: "txt" resolution: - 256 - 512 - 768 - 1024 - 1280 - 1536 train: batch_size: 1 steps: 3000 lr: 0.000095 optimizer: "adamw8bit" timestep_type: "shift" content_or_style: "balanced" optimizer_params: weight_decay: 0.00015 model: name_or_path: "black-forest-labs/FLUX.2-klein-base-9B" quantize: true low_vram: false meta: name: "[name]" version: "1.0" ``` ### Parameter Modifications Here's what was changed from the defaults and why. #### Network Dimensions: 4:2:2:1 Ratio ``` linear: 128 linear_alpha: 64 conv: 64 conv_alpha: 32 ``` The larger network (approximately 500MB per model) captures low-frequency details including subtle textures, color relationships, and tonal variations. **Smaller dimension use cases:** * Low detail content (e.g., 2D vector logos) * Content-focused training (compositions, high-noise characteristics) * Training objectives focused on high-noise elements Smaller networks prevent interference with low-noise style characteristics. Film grain training exemplifies super low-noise processing, as grain exists at the granular pixel level. Such fine texture learning requires larger network dimensions for adequate capture. #### Style-Specific Parameter Adjustments **Timestep Bias: `shift`**\ Encourages overfitting of low-frequency information. Textures and colors adopt more rudimentary characteristics, producing unpolished, sketch-like qualities. **Learning Rate: `0.000095`**\ Decreased from default value. Preserves broken, gestural linework from training data rather than applying smoothing. **Weight Decay: `0.00015`**\ Increased from default value. Simplifies shapes and colors, reducing compositional complexity and emphasizing bolder, cleaner forms. #### Step Count Selection The 1500-step checkpoint produced optimal results. **Style-specific considerations:** The loose, sketch-like aesthetic required reduced training duration. Higher step counts introduced excessive realism, compromising painterly spontaneity. Step count, configuration parameters, and target aesthetic form an interdependent system. No universal optimal configuration exists; effectiveness depends on specific training objectives. Step count comparison

Progressive training visualization: Base model only (left) → 6000 training steps (right)

*** ## Part 3: Sampling Configuration Sampling settings at inference matter just as much as training config — they need to match. ### Recommended Sampling Parameters **Inference Steps: 8** Significantly reduced from typical ranges (20 to 50 steps). Aligns with reduced training duration to preserve soft, painterly, impressionistic qualities. *** ## Output Examples Output 1 Output 2 Output 3 Output 4 Output 5 Output 6 Output 7 Output 8 *** ## Adaptation Guidelines These settings work as starting points for other styles too: **Photo-realistic styles:** * Training steps: 7000 * Weight decay: 0.00001 * Sampling steps: 20 to 30 **Graphic/vector styles:** * Network dimensions: 64:32:32:16 * Dataset size: 15 to 20 images **Experimental applications:** * Push parameters beyond standard ranges (linear >128, weight decay >0.0002) * Accept aesthetic degradation as intentional output characteristic *** ## Additional Resources Complete training documentation Optimal prompting strategies for FLUX.2 models Advanced configuration options # Overview Source: https://docs.bfl.ml/flux_2/flux2_overview FLUX.2 model family overview — from sub-second generation to highest quality, with multi-reference editing, color control, and up to 4MP output. Black Forest **FLUX.2** spans the full spectrum of image generation—from **sub-second inference** with \[klein] to **highest quality** with \[max]. Generate photorealistic images with precise control over colors, poses, and composition, or edit existing images by referencing up to 10 sources simultaneously. Choose **\[klein]** for real-time, high-volume generation, **\[pro]** for production at scale, **\[flex]** for fine-grained control, or **\[max]** for maximum quality and grounding search. **Want to try first?** Test FLUX.2 \[max], \[pro], and \[flex] in our [playground](https://playground.bfl.ai). \[klein] is available via our [API](/flux_2/flux2_text_to_image) and on [Hugging Face](https://huggingface.co/black-forest-labs). ## What Can You Do? Combine elements from multiple images while maintaining identity across complex scenes. Create ad variants with consistent faces, product mockups in any context, or fashion editorials where models stay consistent. Generate photorealistic images with enhanced detail, texture, and lighting. FLUX.2 produces images that merge seamlessly with real photography—ideal for e-commerce and product marketing. Generate images grounded in real-time information with FLUX.2 \[max]. It searches the web when needed, so you can create visuals of yesterday’s football game, the weather in real-time of any city, or re-create historical events. Reliable text rendering for infographics, UI mockups, and marketing materials. Specify brand colors via hex codes with precision matching. No approximation—get the exact colors you need. **Example**: Gradient colors with hex codes **Prompt**: `A vase on a table in living room, the color of the vase is a gradient of color, starting with color #02eb3c and finishing with color #edfa3c. The flowers inside the vase have the color #ff0088` **Example**: Multiple hex colors for product design **Prompt**: `Luxury eyeshadow palette with 6 pans: top row #B76E79, #E8D5B7, #8B4789; bottom row #CD7F32, #F8F6F0, #800020` Use structured prompts for precise control over generation. Perfect for production workflows and automation. ```json Example: Structured Prompting theme={null} { "subject": "Mona Lisa painting by Leonardo da Vinci", "background": "museum gallery wall, ornate gold frame", "lighting": "soft gallery lighting, warm spotlights", "style": "digital art, high contrast", "camera_angle": "eye level view", "composition": "centered, portrait orientation" } ``` ## Which Model to Choose? | | **\[klein]** | **\[max]** | **\[pro]** | **\[flex]** | **\[dev]** | | -------------------- | ---------------------- | ------------------------------ | ------------------------------ | ------------------------------ | --------------------- | | **Best for** | Real-time, high-volume | Highest quality, final assets | Production at scale | Quality with control | Local development | | **Multi-reference** | Up to 4 | Up to 8 (API), 10 (playground) | Up to 8 (API), 10 (playground) | Up to 8 (API), 10 (playground) | Recommended max 6 | | **Controls** | Standard | Standard | Standard | Adjustable steps & guidance | Full customization | | **Grounding search** | No | Yes | No | No | No | | **Pricing** | from \$0.014 / image | from \$0.07 / MP | from \$0.03 / MP | \$0.06 / MP | Free (non-commercial) | **FLUX.2 \[klein]** delivers sub-second inference with open weights. 4B runs on consumer GPUs (\~13GB VRAM). Apache 2.0 for 4B, FLUX NCL for 9B. See [model details below](#flux2-klein-models). **FLUX.2 \[max]** includes **grounding search**: when prompted, it performs web searches to access real-time information to visualize trending products, current events, or the latest styles without manually sourcing reference material. ## Compare FLUX.2 Models ### At a Glance **Sub-second inference.** Our fastest models with open weights. Runs on consumer GPUs (\~13GB VRAM). From \$0.014/image via API, or run locally with Apache 2.0 (4B) / FLUX NCL (9B). **Maximum performance.** Highest editing consistency across tasks. Vast world knowledge. Strongest prompt following and faithful style representation. **Top performance at affordable price.** The high quality, production-grade image editing and generation model. **Specialized for typography.** Best for text rendering and preserving small details. ## FLUX.2 \[klein] Models FLUX.2 [klein] diverse output examples **Open weights available**: \[klein] 4B is fully open under **Apache 2.0**. \[klein] 9B is available under the **FLUX Non-Commercial License**. Download from [Hugging Face](https://huggingface.co/black-forest-labs). ### API Models | | **\[klein] 4B** | **\[klein] 9B** | | ------------------- | ----------------------------- | --------------------------- | | **Best for** | High volume, local deployment | Balanced quality and speed | | **Inference steps** | 4 (step-distilled) | 4 (step-distilled) | | **Speed** | Sub-second | Sub-second | | **API Pricing** | $0.014 + $0.001/MP | $0.015 + $0.002/MP | | **License** | Apache 2.0 | FLUX Non-Commercial License | ### Open Weights (Community) The **Base** variants are undistilled foundation models with full training signal—ideal for fine-tuning, LoRA training, research, and custom pipelines. Higher output diversity than distilled models. | | **\[klein] Base 4B** | **\[klein] Base 9B** | | -------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | **Best for** | Fine-tuning, research, custom pipelines | Maximum quality, research | | **Output diversity** | High | Highest | | **Step-distilled** | No (full capacity) | No (full capacity) | | **License** | Apache 2.0 | FLUX Non-Commercial License | | **Availability** | [Hugging Face](https://huggingface.co/black-forest-labs) | [Hugging Face](https://huggingface.co/black-forest-labs) | Base models are available as open weights for local development and research. They are not offered on the public API. FLUX.2 \[klein] does not include prompt upsampling. Write detailed, descriptive prompts for best results. See our [Prompting Guide](/guides/prompting_summary) for techniques. ## Preview Endpoints Preview endpoints are where our latest improvements land first. They reflect our most recent advances in quality and speed. | Endpoint | Description | | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | | `flux-2-pro-preview` | Our latest FLUX.2 \[pro] model. | | `flux-2-pro` | A fixed snapshot of FLUX.2 \[pro]. This endpoint will not change, making it suitable for workflows that require reproducibility. | | `flux-2-klein-9b-preview` | Our latest FLUX.2 \[klein] 9B model with KV caching for improved performance. | | `flux-2-klein-9b` | A fixed snapshot of FLUX.2 \[klein] 9B. Choose this when you need reproducibility. | **Which endpoint should I use?** For most use cases, the preview endpoints (`flux-2-pro-preview`, `flux-2-klein-9b-preview`) give you the best results. Choose the non-preview endpoints when you need a pinned model — for example, if your workflow depends on consistent outputs across runs or you have compliance requirements around model stability. The `flux-2-pro` and `flux-2-klein-9b` endpoints are unchanged. If you are already using them, no action is required. Both preview and non-preview endpoints share the same API contract — the request and response format is identical. Only the underlying model weights differ. ## Getting Started Test FLUX.2 \[max], \[pro], and \[flex] in your browser. No setup required. Get \[klein] weights from Hugging Face for local inference. Generate images from text prompts. Edit images with multi-reference support. Master prompting techniques — basics, style, JSON, editing, and use cases. Download \[dev] weights for local inference. # FLUX.2 Text to Image Source: https://docs.bfl.ml/flux_2/flux2_text_to_image FLUX.2 is the recommended model for text-to-image generation. Generate high-fidelity images with advanced control, exact colors, and flexible aspect ratios. **FLUX.2** brings enterprise-grade efficiency and professional precision to text-to-image generation. It closes the gap between generated and real imagery with accurate hands, faces, and textures—all while respecting brand guidelines through hex-code color steering. **\[max]** offers the highest quality with grounding search for real-time information. **Try it live** — Test FLUX.2 \[max], \[pro], \[flex] and \[klein] in the [playground](https://playground.bfl.ai). \[klein] is also available on [Hugging Face](https://huggingface.co/black-forest-labs). ## Examples ### Photorealistic Cinematic landscape with sentient tree ### Typography & Design Samsung Galaxy S25 Ultra product advertisement Cinematic lighting portrait Realistic skin texture close-up Hyper-realistic close-up portrait Product photography quality output Freiburg infographic with clean typography Ad creative with embedded text Magazine cover layout Automotive advertisement with headline FLUX.2 \[max] searches the web when prompted, so you can generate visuals grounded in real-time information — sports scores, weather, or historical events. Football game score generated from real-time data Real-time weather visualization for Freiburg Historical event recreation — Fall of the Berlin Wall Starlink satellite launch visualization Specify brand colors via hex codes with precision matching — no approximation. Vase with gradient hex colors and pink flowers Eyeshadow palette with precise hex colors Use JSON-structured prompts for precise control over generation — ideal for production workflows and automation. ```json Example: Structured Prompting theme={null} { "subject": "Mona Lisa painting by Leonardo da Vinci", "background": "museum gallery wall, ornate gold frame", "lighting": "soft gallery lighting, warm spotlights", "style": "digital art, high contrast", "camera_angle": "eye level view", "composition": "centered, portrait orientation" } ``` Mona Lisa in museum — eye level view Mona Lisa in museum — worm's eye view Comic book panel 1 Comic book panel 2 Comic book panel 3 Comic book panel 4 ## API Integration ### Create Request ```bash create_request.sh theme={null} request=$(curl -X POST \ 'https://api.bfl.ai/v1/flux-2-pro-preview' \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "prompt": "A serene mountain landscape at golden hour, soft diffused light filtering through clouds", "width": 1024, "height": 1024 }') echo $request request_id=$(echo $request | jq -r .id) polling_url=$(echo $request | jq -r .polling_url) ``` ```python create_request.py theme={null} import os import requests response = requests.post( 'https://api.bfl.ai/v1/flux-2-pro-preview', headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), 'Content-Type': 'application/json', }, json={ 'prompt': 'A serene mountain landscape at golden hour, soft diffused light filtering through clouds', 'width': 1024, 'height': 1024, }, ).json() request_id = response["id"] polling_url = response["polling_url"] ``` ### Poll for Result ```bash poll_result.sh theme={null} while true; do sleep 0.5 result=$(curl -s -X 'GET' \ "${polling_url}" \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}") status=$(echo $result | jq -r .status) echo "Status: $status" if [ "$status" == "Ready" ]; then echo "Result: $(echo $result | jq -r .result.sample)" break elif [ "$status" == "Error" ] || [ "$status" == "Failed" ]; then echo "Generation failed: $result" break fi done ``` ```python poll_result.py theme={null} import time import os import requests while True: time.sleep(0.5) result = requests.get( polling_url, headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), }, params={'id': request_id} ).json() if result['status'] == 'Ready': print(f"Image ready: {result['result']['sample']}") break elif result['status'] in ['Error', 'Failed']: print(f"Generation failed: {result}") break ``` Signed URLs are only valid for 10 minutes. Please retrieve your result within this timeframe. For all available parameters, endpoints, and model options, see the [API Reference](/api-reference). # FLUX 3 Source: https://docs.bfl.ml/flux_3/flux3_overview FLUX 3 is one multimodal model. Video with synchronized audio, one request shape keyed by mode.

FLUX 3

Overview

One model trained across image, video, and audio. Video with synchronized sound, live now.

## One model, multiple modalities FLUX 3 generates **video with synchronized audio**: from a text prompt, from pinned keyframes, or continuing an existing clip. More modalities ship on the same request shape as they land. * **Up to 20 seconds at FHD** (1920 × 1088 for 16:9), 24 fps, in a single request. * **Multilingual speech with strong lipsync**, plus effects and ambience, generated with the frames. * **Multiple scenes and camera angles in one generation.** Shots hold together across cuts. * **Stylistic range beyond cinematic:** animation, motion design, stylized artistic looks. * **Accurate text and typography** rendered inside the scene. FLUX 3 is a **preview** model. **Video editing** and **Omni Reference with images and videos** will be available soon. ## Modes Every request names a mode. The mode is how you tell FLUX 3 what you're starting from, and it decides what the model does with your media: start a clip from words alone, build one around images you pin, or carry an existing clip forward. There are three: * **Text to Video** (`t2v`) starts from nothing but your prompt. * **Image to Video** (`i2v`) starts from your images. They become frames of the clip itself. * **Video Continuation** (`v2v`) starts from a clip you already have and keeps it going. All three run on the same [flux-3-video endpoint](/api-reference/utility/generate-a-video-with-flux-3), and the rest of the request looks identical. To show how they connect, everything below is **one scene passed through the whole API**: the first request generates a clip, and every request after it runs on that clip's own frames. Each tab shows the request we sent and the video that came back. Describe the shot. `t2v` turns the prompt into a clip, sound included. This is the request that started the scene: ```bash theme={null} curl -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "mode": "t2v", "prompt": "she takes his hand and pulls him laughing through the lantern-lit alley, the camera chasing them, paper lanterns swaying overhead, their footsteps and laughter echoing off the walls", "duration": 8 }' ``` There is no separate start-frame field: `keyframes` is how you hand `i2v` images, and one image is the start frame. We extracted the **opening frame of the clip in the first tab** and pinned it, with a new camera direction: ```bash theme={null} curl -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "mode": "i2v", "prompt": "from this frame the camera rises slowly above the alley as they rush away beneath the lanterns, their laughter fading into the night", "keyframes": "data:image/png;base64," }' ``` `v2v` picks up where your clip ends. Momentum, framing, and scene logic carry into the new footage. We sent the **first tab's clip** as `start_video` and asked for the scene's next beat: ```bash theme={null} curl -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "mode": "v2v", "prompt": "they burst out of the alley into a crowded night market, drums and street chatter swelling, she pulls him into the lantern light", "start_video": "data:video/mp4;base64,", "duration": 8 }' ``` Everything else is optional. Set any field explicitly and it is used exactly; leave it out and the default takes over: * **`aspect_ratio`** and **`duration`** default to `auto` and fit themselves to the content. * **`resolution`** defaults to `hd`; `fhd` finishes the result at a higher resolution via the video upsampler. * **`generate_audio`** defaults to `true`. The full field list, constraints, and dimensions live in the [API reference](/api-reference/utility/generate-a-video-with-flux-3). ## Draft mode Iterate in draft, commit once. Drafts generate faster and cost about a third of a full render, so you can explore variants freely and only pay full price for the shot you keep. * **`draft: true`** returns a fast preview instead of a full render, plus a `draft_cache` bundle in the result. * **`mode: "draft_enhance"`** renders the preview you picked at full quality: send its bundle as `draft_cache` and the original generation is reproduced. Same shot, same seed, nothing re-interpreted. Here is the same prompt run through all three paths: Each fresh submit is its own generation, so the direct full render can interpret the shot differently from the draft you liked. Enhancing keeps it:
```bash theme={null} curl -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "mode": "t2v", "prompt": "a fox running through dawn mist", "draft": true }' ``` Download the winning preview's `draft_cache` URL from its result, then send the bundle back: ```bash theme={null} curl -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" \ -H "Content-Type: application/json" \ -d "{ \"mode\": \"draft_enhance\", \"draft_cache\": \"$(base64 -i draft_cache.bin)\" }" ``` Limits and constraints are in the [API reference](/api-reference/utility/generate-a-video-with-flux-3). ## Specifications | Mode | You send | Length | Full render | Draft | | ---------------------- | ---------------------- | ------ | ------------------------- | -------- | | **Text to Video** | a prompt | 5–20 s | \$0.17/s hd, \$0.29/s fhd | \$0.06/s | | **Image to Video** | a prompt + 1–10 images | 5–20 s | \$0.17/s hd, \$0.29/s fhd | \$0.06/s | | **Video Continuation** | a prompt + your clip | 5–15 s | \$0.43/s hd, \$0.54/s fhd | \$0.12/s | Every mode outputs 24 fps at `hd` or `fhd`, in aspect ratios 21:9, 2:1, 16:9, 4:3, 1:1, 3:4, and 9:16. Drafts render at `hd`. ## What it can do ## Start in ten seconds FLUX 3 is asynchronous. You **submit** a request and get back an `id` and a `polling_url`; then you **poll** that URL until the job turns `Ready` and returns your result. Here is the full round trip, text to video with audio. Result URLs are signed and expire about 2 hours after the job finishes. Download the video promptly once the status is `Ready`. ## Getting started Create an account, add credits, and make your first FLUX 3 call. Test FLUX 3 in your browser. No setup required. Generate from text, animate stills, pin keyframes, continue clips, all with audio. The full flux-3-video request contract: modes, fields, constraints.
# Video Source: https://docs.bfl.ml/flux_3/flux3_video Generate, animate, and continue video with FLUX 3. Up to full-HD and 20 seconds, with synchronized audio.
FLUX 3 Motion from a single line artwork

FLUX 3

Video

Generate, animate, and continue video with FLUX 3, with synchronized audio in the same call.

## Quickstart FLUX 3 video is asynchronous: you **submit** a request, get back a `polling_url`, and **poll** it until the clip is `Ready`. For the full field list and response schema, see the [API reference](/api-reference/utility/generate-a-video-with-flux-3). ```python Python theme={null} import os, time, requests BFL_API_KEY = os.environ["BFL_API_KEY"] # 1. Submit — returns an id and a polling_url submit = requests.post( "https://api.bfl.ai/v1/flux-3-video", headers={"x-key": BFL_API_KEY, "Content-Type": "application/json"}, json={ "mode": "t2v", "prompt": "a fox running through dawn mist", "generate_audio": True, }, ).json() # 2. Poll the returned URL until the job is Ready while True: time.sleep(2) result = requests.get(submit["polling_url"], headers={"x-key": BFL_API_KEY}).json() if result["status"] == "Ready": print(result["result"]["sample"]) # signed .mp4 URL break if result["status"] in ("Error", "Request Moderated", "Content Moderated"): raise RuntimeError(result["status"]) ``` ```bash cURL theme={null} # 1. Submit — returns an id and a polling_url curl -s -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "mode": "t2v", "prompt": "a fox running through dawn mist", "generate_audio": true }' # 2. Poll the polling_url from the response until "status": "Ready" curl -s "$POLLING_URL" -H "x-key: $BFL_API_KEY" ``` ## Modes One `mode` per request; the rest of the request stays the same. * **Text-to-Video** (`t2v`) — prompt only. * **Image-to-Video** (`i2v`) — add `keyframes`: one image is the opening frame, `[a, b]` pins start and end, and up to ten frames pinned to timestamps become a storyboard. * **Video Continuation** (`v2v`) — add `start_video`; the clip continues from its final frames.

t2v · Generate a video with audio

i2v · Animate an image and use multiple keyframes

v2v · Extend your clip

## Parameters Full schema and per-field constraints live in the [API reference](/api-reference/utility/generate-a-video-with-flux-3). | Field | Required | | | ------------------ | ------------------- | ---------------------------------------------------------------------------------------------------------- | | `mode` | always | `t2v`, `i2v`, `v2v`, or `draft_enhance`. | | `prompt` | always | What to generate. | | `keyframes` | for `i2v` | One image starts the clip, two pin start and end, `[seconds, image]` pairs pin exact times. URL or base64. | | `start_video` | for `v2v` | The clip to continue from, mp4 as URL or base64. | | `draft_cache` | for `draft_enhance` | The bundle from a prior draft; reproduces that generation at full quality. | | `resolution` | | `hd` (default) or `fhd`. | | `duration` | | Whole seconds, 5 to 20, or `auto` (default). | | `aspect_ratio` | | `auto` (default), `21:9`, `2:1`, `16:9`, `4:3`, `1:1`, `3:4`, or `9:16`. | | `generate_audio` | | On by default. Set `false` for a silent clip. | | `safety_tolerance` | | 0 (strictest) to 4, default 2. | | `draft` | | Set `true` for a fast hd preview; the result includes a `draft_cache` bundle. | | `version` | | `latest` (default) — always tracks the current release. | ## Use cases Deeply customizable, and built for use cases, visual styles, and aspect ratios far beyond conventional cinematic output. ### Text to video Generate a clip from words alone — FLUX 3 handles everything from a single line to a densely directed brief, filling in framing, motion, and mood wherever you leave them open.
```bash cURL theme={null} curl -s -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" -H "Content-Type: application/json" \ -d '{ "mode": "t2v", "prompt": "a fox running through dawn mist", "generate_audio": true }' ``` ### Image to video Animate from images you pin. A single still becomes the exact opening frame, a start-and-end pair interpolates the motion between them, and several frames spread across the clip.
```bash cURL theme={null} curl -s -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" -H "Content-Type: application/json" \ -d '{ "mode": "i2v", "prompt": "push forward through the trees", "keyframes": "https://example.com/still.jpg" }' ``` ### Multiple scenes Block several shots and camera angles in one generation. Character, look, and continuity hold across hard cuts, with a single audio bed carrying through.
```bash cURL theme={null} curl -s -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" -H "Content-Type: application/json" \ -d '{ "mode": "t2v", "prompt": "SHOT ONE: wide aerial of a desert highway at dawn. HARD CUT. SHOT TWO: interior close-up of the driver. HARD CUT. SHOT THREE: the car shrinks into the heat haze. One music bed across all shots.", "duration": 10 }' ``` ### Multilingual dialogue On-camera speech in many languages, with accurate accents and tight lipsync. Quote the line in your prompt and the character says it.
```bash cURL theme={null} curl -s -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" -H "Content-Type: application/json" \ -d '{ "mode": "t2v", "prompt": "A presenter speaks to the lens: \"Storm season is here.\" Clean studio lighting.", "generate_audio": true }' ``` ### Broad range of styles Photoreal cinematography, animation, motion design, and stylized looks — the same model spans styles far beyond conventional footage.
```bash cURL theme={null} curl -s -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" -H "Content-Type: application/json" \ -d '{ "mode": "t2v", "prompt": "2D hand-drawn animation of a fox leaping through a paper-cut forest, bold flat colors", "aspect_ratio": "16:9" }' ``` ### Text and typography Legible, well-placed text rendered as part of the scene — titles, signage, and lower-thirds that stay stable through motion.
```bash cURL theme={null} curl -s -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" -H "Content-Type: application/json" \ -d '{ "mode": "t2v", "prompt": "Bold kinetic title card, the word \"FLUX\" assembling from light streaks on a dark stage", "aspect_ratio": "16:9" }' ``` ### Keyframes Pin ordered keyframes and FLUX 3 interpolates one continuous shot through each — hit this pose, then this composition, then this — while the model handles the motion between them.
Keyframe — Start · 0:00

Start · 0:00

Keyframe — Key 2 · 0:03

Key 2 · 0:03

Keyframe — Key 3 · 0:07

Key 3 · 0:07

Keyframe — End · 0:10

End · 0:10

Keyframe — Start

Start

Keyframe — Key 2

Key 2

Keyframe — Key 3

Key 3

Keyframe — End

End

Keyframe — Start · 0:00

Start · 0:00

Keyframe — Key 2 · 0:03

Key 2 · 0:03

Keyframe — Key 3 · 0:07

Key 3 · 0:07

Keyframe — End · 0:10

End · 0:10

Keyframe — Start · 0:00

Start · 0:00

Keyframe — Key 2 · 0:03

Key 2 · 0:03

Keyframe — Key 3 · 0:07

Key 3 · 0:07

Keyframe — End · 0:10

End · 0:10

```bash cURL theme={null} curl -s -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" -H "Content-Type: application/json" \ -d '{ "mode": "i2v", "prompt": "a seed grows into a tree through the seasons", "duration": 10, "keyframes": [[0, "https://example.com/seed.png"], [4.5, "https://example.com/sapling.png"], [10, "https://example.com/tree.png"]] }' ``` ### Video continuation Feed an existing clip and FLUX 3 picks up from its final frames, carrying momentum, framing, and scene logic forward without a cut. ```bash cURL theme={null} curl -s -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" -H "Content-Type: application/json" \ -d '{ "mode": "v2v", "prompt": "she takes his hand and pulls him laughing through the lantern-lit alley, the camera chasing them", "start_video": "https://example.com/clip.mp4", "duration": 10 }' ``` ## Keep exploring Prompt formats, the schema, camera language, and audio. The full flux-3-video request contract: modes, fields, and constraints. Try FLUX 3 in your browser — no setup required. One request shape across image, video, and synchronized audio.
# FLUX1.1 [pro] Image Generation Source: https://docs.bfl.ml/flux_models/flux_1_1_pro Generate images with FLUX1.1 [pro], a fast and reliable text-to-image model with strong prompt adherence and competitive pricing. **FLUX1.1 \[pro]** is the standard for text-to-image generation with fast, reliable and consistently stunning results. To generate an image from text, you’ll make a request to the `/flux-pro-1.1` endpoint. ## Key Features State-of-the-art inference speeds with consistent, stunning results every time Proven baseline for accurate text-to-image generation that follows your prompts precisely Robust architecture ideal for high-volume, production-ready image generation Superior image quality at just \$0.04 per image ## Examples of Image Generation with FLUX.1 \[pro] ## Using FLUX1.1 \[pro] API for Text-to-Image Generation ### Create a Request Use the `/flux-pro-1.1` endpoint for standard FLUX1.1 \[pro] generation: ```bash create_request.sh theme={null} request=$(curl -X POST \ 'https://api.bfl.ai/v1/flux-pro-1.1' \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "prompt": "A futuristic city skyline at sunset with flying cars", "width": 1024, "height": 1024 }') request_id=$(echo $request | jq -r .id) polling_url=$(echo $request | jq -r .polling_url) ``` ```python create_request.py theme={null} import requests import os request = requests.post( 'https://api.bfl.ai/v1/flux-pro-1.1', headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), 'Content-Type': 'application/json', }, json={ 'prompt': 'A futuristic city skyline at sunset with flying cars', 'width': 1024, 'height': 1024 } ).json() print(request) request_id = request["id"] polling_url = request["polling_url"] # Use this URL for polling ``` ### Poll for Result After submitting a request, you need to poll using the returned `polling_url` to retrieve the output when ready. ```bash poll_result.sh theme={null} while true; do sleep 0.5 result=$(curl -s -X 'GET' \ "${polling_url}" \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}") status=$(echo $result | jq -r .status) echo "Status: $status" if [ "$status" == "Ready" ]; then echo "Result: $(echo $result | jq -r .result.sample)" break elif [ "$status" == "Error" ] || [ "$status" == "Failed" ]; then echo "Generation failed: $result" break fi done ``` ```python poll_result.py theme={null} # This assumes that the `polling_url` variable is set. import time import os import requests while True: time.sleep(0.5) result = requests.get( polling_url, headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), } ).json() if result['status'] == 'Ready': print(f"Image ready: {result['result']['sample']}") break elif result['status'] in ['Error', 'Failed']: print(f"Generation failed: {result}") break ``` A successful response will be a JSON object containing the result, and `result['sample']` is a signed URL for retrieval. Our signed URLs are only valid for 10 minutes. Please retrieve your result within this timeframe. ### FLUX1.1 \[pro] Parameters | Parameter | Type | Default | Description | Required | | ------------------- | ------- | ------- | ---------------------------------------------------------------------------------- | -------- | | `prompt` | string | | Text description of the desired image | **Yes** | | `width` | integer | 1024 | Image width in pixels | No | | `height` | integer | 1024 | Image height in pixels | No | | `prompt_upsampling` | boolean | false | Enhance prompt for better results | No | | `seed` | integer | null | Seed for reproducible results. Accepts any integer | No | | `safety_tolerance` | integer | 2 | Content moderation level. Value ranges from 0 (most strict) to 6 (more permissive) | No | | `output_format` | string | "jpeg" | Desired format of the output image. Can be "jpeg" or "png" | No | | `webhook_url` | string | null | URL for asynchronous completion notification. Must be a valid HTTP/HTTPS URL | No | | `webhook_secret` | string | null | Secret for webhook signature verification, sent in the `X-Webhook-Secret` header | No | ## Pricing FLUX1.1 \[pro] is available at **\$0.04 per image**. # FLUX1.1 [pro] Ultra Mode Source: https://docs.bfl.ml/flux_models/flux_1_1_pro_ultra_raw Generate up to 4MP resolution images with FLUX1.1 [pro] Ultra, featuring Raw mode for candid photography and image-to-image support. **FLUX1.1 \[pro] Ultra** delivers ultra-fast, ultra-high-resolution image creation - with more pixels in every picture. Generate varying aspect ratios from text, at 4MP resolution fast. To generate an image from text, you’ll make a request to the `/flux-pro-1.1-ultra` endpoint. ## Key Features Generate up to 4MP images without compromising prompt fidelity or quality 4MP resolution results delivered in unprecedented speed Captures the authentic feel of candid photography, at 4MP resolution Use existing images as visual context with adjustable influence strength ### Examples of Image Generation with FLUX.1 \[pro] Ultra ## Raw Mode FLUX1.1 \[pro] also supports **Raw mode** for creators seeking authenticity. When enabled, Raw mode captures the genuine feel of candid photography, generating images with a less synthetic, more natural aesthetic. This mode significantly increases diversity in human subjects and enhances the realism of nature photography. Enable Raw mode by setting `"raw": true` in your API request for more authentic, natural-looking results. ### Examples of Image Generation with FLUX.1 \[pro] Raw ## API Endpoint Use the `/flux-pro-1.1-ultra` endpoint for ultra-high-resolution generation: ```bash ultra_request.sh theme={null} request=$(curl -X POST \ 'https://api.bfl.ai/v1/flux-pro-1.1-ultra' \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "prompt": "Detailed architectural rendering of a modern glass skyscraper", "aspect_ratio": "1:1", "raw": false }') # Change "raw" to `true` for RAW output request_id=$(echo $request | jq -r .id) polling_url=$(echo $request | jq -r .polling_url) ``` ```python ultra_request.py theme={null} import requests import os request = requests.post( 'https://api.bfl.ai/v1/flux-pro-1.1-ultra', headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), 'Content-Type': 'application/json', }, json={ 'prompt': 'Detailed architectural rendering of a modern glass skyscraper', 'aspect_ratio': '1:1', 'raw': False # Replace with True for the RAW endpoint } ).json() print(request) request_id = request["id"] polling_url = request["polling_url"] # Use this URL for polling ``` ### Poll for Result After submitting a request, you need to poll using the returned `polling_url` to retrieve the output when ready. ```bash poll_result.sh theme={null} while true; do sleep 0.5 result=$(curl -s -X 'GET' \ "${polling_url}" \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}") status=$(echo $result | jq -r .status) echo "Status: $status" if [ "$status" == "Ready" ]; then echo "Result: $(echo $result | jq -r .result.sample)" break elif [ "$status" == "Error" ] || [ "$status" == "Failed" ]; then echo "Generation failed: $result" break fi done ``` ```python poll_result.py theme={null} # This assumes that the `polling_url` variable is set. import time import os import requests while True: time.sleep(0.5) result = requests.get( polling_url, headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), } ).json() if result['status'] == 'Ready': print(f"Image ready: {result['result']['sample']}") break elif result['status'] in ['Error', 'Failed']: print(f"Generation failed: {result}") break ``` A successful response will be a JSON object containing the result, and `result['sample']` is a signed URL for retrieval. Our signed URLs are only valid for 10 minutes. Please retrieve your result within this timeframe. ### FLUX1.1 \[pro] Ultra Parameters | Parameter | Type | Default | Description | Required | | ----------------------- | ------- | ------- | ---------------------------------------------------------------------------------- | -------- | | `prompt` | string | | Text description of the desired image | **Yes** | | `aspect_ratio` | string | "16:9" | Desired aspect ratio for the image (e.g., "16:9", "1:1", "4:3") | No | | `prompt_upsampling` | boolean | false | Enhance prompt for better results | No | | `seed` | integer | null | Seed for reproducible results. Accepts any integer | No | | `safety_tolerance` | integer | 2 | Content moderation level. Value ranges from 0 (most strict) to 6 (more permissive) | No | | `output_format` | string | "jpeg" | Desired format of the output image. Can be "jpeg" or "png" | No | | `raw` | boolean | false | Enable raw mode for more natural, authentic aesthetics | No | | `image_prompt` | string | null | Base64-encoded image to use as additional visual context for generation | No | | `image_prompt_strength` | float | 0.1 | Strength of the image prompt influence on generation (0.0 to 1.0) | No | | `webhook_url` | string | null | URL for asynchronous completion notification. Must be a valid HTTP/HTTPS URL | No | | `webhook_secret` | string | null | Secret for webhook signature verification, sent in the `X-Webhook-Secret` header | No | ## Pricing FLUX1.1 \[pro] Ultra mode is available at **\$0.06 per image**. # FLUX Deblur Source: https://docs.bfl.ml/flux_tools/flux_deblur Sharpen blurry images via API while preserving the original scene, character identity, colors, and composition. FLUX Deblur takes a single blurry image and returns a sharper version of the same scene. It is designed to restore detail while staying faithful to the input image, with no prompt and no mask required. ## Example output Drag the slider to compare the blurry input image (left) against the deblurred result (right). ### More examples ## Endpoint Submit a deblur job: ```http theme={null} POST https://api.bfl.ai/v1/flux-tools/deblur-v1 x-key: $BFL_API_KEY ``` Poll for the result: ```http theme={null} GET https://api.bfl.ai/v1/get_result?id= x-key: $BFL_API_KEY ``` ## Quick start The API uses an asynchronous workflow: POST your blurry input image to the endpoint as base64 or an HTTP(S) URL. The model sharpens the whole image automatically - no prompt or mask is accepted. Use the returned `polling_url` to check status until the deblurred image is ready. ```python Python theme={null} #!/usr/bin/env python3 import base64 import os import time import requests API_KEY = os.environ["BFL_API_KEY"] BASE = "https://api.bfl.ai" HEADERS = {"accept": "application/json", "x-key": API_KEY, "Content-Type": "application/json"} IMAGE_PATH = "/path/to/blurry-input.png" with open(IMAGE_PATH, "rb") as f: image_b64 = base64.b64encode(f.read()).decode() payload = { "image": image_b64, "output_format": "png", } submit = requests.post(f"{BASE}/v1/flux-tools/deblur-v1", headers=HEADERS, json=payload) submit.raise_for_status() meta = submit.json() task_id = meta["id"] poll_url = meta.get("polling_url", f"{BASE}/v1/get_result?id={task_id}") while True: r = requests.get(poll_url, headers={"accept": "application/json", "x-key": API_KEY}) r.raise_for_status() result = r.json() status = result.get("status") if status == "Ready": print("Result URL:", result["result"]["sample"]) break if status in {"Error", "Request Moderated", "Content Moderated", "Task not found"}: raise RuntimeError(f"Deblur failed with status: {status} | payload: {result}") time.sleep(1) ``` ```bash cURL theme={null} IMAGE_B64="$(base64 < /path/to/blurry-input.png | tr -d '\n')" jq -n \ --arg img "$IMAGE_B64" \ '{ image: $img, output_format: "png" }' > /tmp/deblur_request.json curl -sS -X POST "https://api.bfl.ai/v1/flux-tools/deblur-v1" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ -H "x-key: $BFL_API_KEY" \ --data-binary @/tmp/deblur_request.json # Poll for the result curl -sS "https://api.bfl.ai/v1/get_result?id=YOUR_TASK_ID" \ -H "accept: application/json" \ -H "x-key: $BFL_API_KEY" ``` ## Request parameters Use `image` as the minimum payload. | Parameter | Type | Required | Description | | ------------------ | ------- | -------- | -------------------------------------------------------------------------------- | | `image` | string | Yes | Blurry input image as base64 or an HTTP(S) image URL. Maximum image area is 4 MP | | `seed` | integer | No | Optional seed for reproducibility | | `safety_tolerance` | integer | No | `0-5`, defaults to `2`. Moderation strictness for input and output | | `output_format` | string | No | `png` (default), `jpeg`, or `webp` | | `webhook_url` | URL | No | Async callback | | `webhook_secret` | string | No | Signature secret | No `prompt` or `mask` parameter is sent by the caller. The server applies a fixed deblurring instruction to the whole image. ## Response format ### Initial response ```json theme={null} { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "polling_url": "https://api.bfl.ai/v1/get_result?id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" } ``` Always poll the URL returned in the response. ### Polling response (success) ```json theme={null} { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "status": "Ready", "result": { "sample": "https://delivery.bfl.ai/..." } } ``` When `status` is `"Ready"`, use `result.sample`. Signed delivery URLs are only valid for **10 minutes**. Retrieve your result within this timeframe. ## How it works FLUX Deblur treats blur removal as a guided image edit. It reconstructs fine detail while staying anchored to the input, so character identity, colors, objects, lighting, and composition remain faithful to the original scene instead of being re-imagined. The endpoint is powered by a FLUX.2 Klein 9B image-to-image finetune trained on blurry-to-sharp image pairs. Because it uses the Klein backbone, it is suitable for low-latency, lower-cost, high-volume, or interactive workflows. ## Tips for best results * Use images where the underlying scene is still recognizable. Heavy blur can be reduced substantially, but the endpoint is not a perfect restorer for severely degraded inputs. * Run deblur before downstream cleanup steps such as upscaling, outpainting, or publication export. ## Limitations * Heavily degraded inputs may contain residual blur or reconstructed details that are not exact. * Since the endpoint is based on Klein, typography and human anatomy can be faulty, especially for heavily blurred images. * Deblur is applied to the full image. It does not support region-specific masks. ## Troubleshooting * **`403 Forbidden`** - your API key is missing or your project does not have access to this endpoint. * **`422` / validation errors** - check base64 encoding, image URL accessibility, and the 4 MP maximum image area. * **Result still looks blurry** - the input may be too degraded; try using the least compressed source available. * **Unexpected artifacts** - try a cleaner source image or run deblur before other enhancement steps. For the full list of HTTP status codes and polling response types returned by the API, see the [Errors reference](/api_integration/errors). # FLUX Erase Source: https://docs.bfl.ml/flux_tools/flux_erase Remove objects from a photo via API — fast, mask-driven cleanup powered by FLUX.2 Klein 9B. FLUX Erase removes the masked object and reconstructs the scene behind it with contextually coherent content in a single call. Useful for product photography clean-up, removing unwanted elements, scene simplification, or privacy-aware image editing. ## Example output Drag the slider to compare the input image with the masked region outlined in green (left) against the cleaned result (right). ### More examples ## Endpoint Submit an erase job: ```http theme={null} POST https://api.bfl.ai/v1/flux-tools/erase-v1 x-key: $BFL_API_KEY ``` Poll for the result: ```http theme={null} GET https://api.bfl.ai/v1/get_result?id= x-key: $BFL_API_KEY ``` ## Quick start The API uses an asynchronous workflow: Create a black/white PNG at the same resolution as your input image. **White (255)** marks the pixels to remove, **black (0)** marks pixels to keep. POST the input image and mask (both base64-encoded) to the endpoint. No prompt is needed — the model uses a built-in erase instruction. Use the returned `polling_url` to check status until the image is ready. ```python Python theme={null} #!/usr/bin/env python3 import base64 import os import time import requests API_KEY = os.environ["BFL_API_KEY"] BASE = "https://api.bfl.ai" HEADERS = {"accept": "application/json", "x-key": API_KEY, "Content-Type": "application/json"} IMAGE_PATH = "/path/to/input.png" MASK_PATH = "/path/to/mask.png" # White (255) = remove, Black (0) = keep DILATE_PIXELS = 10 # Expand mask edges for cleaner removal with open(IMAGE_PATH, "rb") as f: image_b64 = base64.b64encode(f.read()).decode() with open(MASK_PATH, "rb") as f: mask_b64 = base64.b64encode(f.read()).decode() payload = { "image": image_b64, "mask": mask_b64, "dilate_pixels": DILATE_PIXELS, "output_format": "png", } submit = requests.post(f"{BASE}/v1/flux-tools/erase-v1", headers=HEADERS, json=payload) submit.raise_for_status() meta = submit.json() task_id = meta["id"] poll_url = meta.get("polling_url", f"{BASE}/v1/get_result?id={task_id}") while True: r = requests.get(poll_url, headers={"accept": "application/json", "x-key": API_KEY}) r.raise_for_status() result = r.json() status = result.get("status") if status == "Ready": print("Result URL:", result["result"]["sample"]) break if status in {"Error", "Request Moderated", "Content Moderated", "Task not found"}: raise RuntimeError(f"Erase failed with status: {status} | payload: {result}") time.sleep(1) ``` ```bash cURL theme={null} IMAGE_B64="$(base64 < /path/to/input.png | tr -d '\n')" MASK_B64="$(base64 < /path/to/mask.png | tr -d '\n')" jq -n \ --arg img "$IMAGE_B64" \ --arg mask "$MASK_B64" \ '{ image: $img, mask: $mask, dilate_pixels: 10, output_format: "png" }' > /tmp/erase_request.json curl -sS -X POST "https://api.bfl.ai/v1/flux-tools/erase-v1" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ -H "x-key: $BFL_API_KEY" \ --data-binary @/tmp/erase_request.json # Poll for the result curl -sS "https://api.bfl.ai/v1/get_result?id=YOUR_TASK_ID" \ -H "accept: application/json" \ -H "x-key: $BFL_API_KEY" ``` ## Request parameters | Parameter | Type | Required | Description | | --------------- | ------------- | -------- | -------------------------------------------------------------------------------------------------------------- | | `image` | base64 string | Yes | Input image | | `mask` | base64 string | Yes | Black/white mask. White (255) = remove, black (0) = keep. Must match the input image dimensions | | `dilate_pixels` | integer | No | Pixels to dilate the mask before removal. Range `0–25`, default `10`. Helps the model fully cover object edges | | `output_format` | string | No | `png` (default) or `jpeg` | No prompt is sent by the caller — the server applies a fixed erase instruction internally. ## Response format ### Initial response ```json theme={null} { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "polling_url": "https://api.bfl.ai/v1/get_result?id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" } ``` ### Polling response (success) ```json theme={null} { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "status": "Ready", "result": { "sample": "https://delivery.bfl.ai/..." } } ``` When `status` is `"Ready"`, use `result.sample`. Signed delivery URLs are only valid for **10 minutes**. Retrieve your result within this timeframe. ## Mask guidelines * **Format**: black-and-white PNG at the same resolution as the input image. * **White (255)** = pixels to remove. **Black (0)** = pixels to keep. * The server converts the binary mask to a green fill internally — callers only send the binary mask. * **Dilation** (`dilate_pixels`): expanding the mask by a few pixels typically improves removal quality by ensuring the model fully covers object edges. For typical SAM (Segment Anything) masks, start with `10`. ## Tips for best results * Use a mask that fully covers the object you want to remove. If the mask is leaving an edge, increase `dilate_pixels`. * For objects with **soft edges** (hair, fur, smoke) that masks rarely capture cleanly, use a higher `dilate_pixels` value (15–20). * The model was trained on images at **\~1 megapixel** across 9 aspect ratios from 1:2 to 2:1. Inputs close to these resolutions produce the best results — significant deviations may reduce quality. ## Troubleshooting * **`403 Forbidden`** — your API key is missing or your project doesn't have access to this endpoint. * **`422` / validation errors** — check base64 encoding and that the mask matches the input image dimensions exactly. * **Visible halo around removed object** — increase `dilate_pixels`. * **Reconstruction looks off** — verify the mask covers the entire object including shadows or reflections you want gone. For the full list of HTTP status codes and polling response types returned by the API, see the [Errors reference](/api_integration/errors). # FLUX Outpainting Source: https://docs.bfl.ml/flux_tools/flux_outpainting Expand any image beyond its borders in a single call. FLUX Outpainting extends an image naturally in any direction, filling new regions with contextually coherent content in a single call. Useful for aspect-ratio changes, banner generation, social media reformatting, or giving a composition more room to breathe. Try it interactively and for free in our [FLUX Outpainting demo](https://flux-tools.bfl.ai/outpainting). ## Example output Drag the slider to compare the input image padded onto the target canvas (left) with the outpainted result (right). No prompt was used — the model extended the scene on its own. ## Endpoint Submit an outpainting job: ```http theme={null} POST https://api.bfl.ai/v1/flux-tools/outpainting-v1 x-key: $BFL_API_KEY ``` Poll for the result: ```http theme={null} GET https://api.bfl.ai/v1/get_result?id= x-key: $BFL_API_KEY ``` ## Quick start The API uses an asynchronous workflow: POST your input image (base64) and the target canvas dimensions to the endpoint. The model extends the existing scene naturally — no prompt is needed. Use the returned `polling_url` to check status until the image is ready. ```python Python theme={null} #!/usr/bin/env python3 import base64 import os import time import requests API_KEY = os.environ["BFL_API_KEY"] BASE = "https://api.bfl.ai" HEADERS = {"accept": "application/json", "x-key": API_KEY, "Content-Type": "application/json"} IMAGE_PATH = "/path/to/input.png" WIDTH, HEIGHT = 1024, 1024 REFERENCE_OFFSET_X = 100 # None = center horizontally REFERENCE_OFFSET_Y = 50 # None = center vertically with open(IMAGE_PATH, "rb") as f: image_b64 = base64.b64encode(f.read()).decode() payload = { "input_image": image_b64, "width": WIDTH, "height": HEIGHT, "output_format": "png", } if REFERENCE_OFFSET_X is not None: payload["reference_offset_x"] = REFERENCE_OFFSET_X if REFERENCE_OFFSET_Y is not None: payload["reference_offset_y"] = REFERENCE_OFFSET_Y submit = requests.post(f"{BASE}/v1/flux-tools/outpainting-v1", headers=HEADERS, json=payload) submit.raise_for_status() meta = submit.json() task_id = meta["id"] poll_url = meta.get("polling_url", f"{BASE}/v1/get_result?id={task_id}") while True: r = requests.get(poll_url, headers={"accept": "application/json", "x-key": API_KEY}) r.raise_for_status() result = r.json() status = result.get("status") if status == "Ready": print("Result URL:", result["result"]["sample"]) break if status in {"Error", "Request Moderated", "Content Moderated", "Task not found"}: raise RuntimeError(f"Outpainting failed with status: {status} | payload: {result}") time.sleep(1) ``` ```bash cURL theme={null} IMAGE_B64="$(base64 < /path/to/input.png | tr -d '\n')" jq -n \ --arg img "$IMAGE_B64" \ '{ input_image: $img, width: 1024, height: 1024, reference_offset_x: 100, reference_offset_y: 50, output_format: "png" }' > /tmp/outpaint_request.json curl -sS -X POST "https://api.bfl.ai/v1/flux-tools/outpainting-v1" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ -H "x-key: $BFL_API_KEY" \ --data-binary @/tmp/outpaint_request.json # Poll for the result curl -sS "https://api.bfl.ai/v1/get_result?id=YOUR_TASK_ID" \ -H "accept: application/json" \ -H "x-key: $BFL_API_KEY" ``` ## Request parameters | Parameter | Type | Required | Description | | -------------------- | ------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | `input_image` | base64 string | Yes | Reference image to expand | | `width` | integer | Yes | Target canvas width in pixels (`>=64`). `width × height` must not exceed 4 MP | | `height` | integer | Yes | Target canvas height in pixels (`>=64`). `width × height` must not exceed 4 MP | | `reference_offset_x` | integer | No | Left offset (px) of the reference image's top-left corner on the canvas. Negative values allowed. `None` = center horizontally | | `reference_offset_y` | integer | No | Top offset (px) of the reference image's top-left corner on the canvas. Negative values allowed. `None` = center vertically | | `auto_crop` | boolean | No | If `true`, crop the reference image to the canvas bounds when it extends beyond the edges. Defaults to `false` (out-of-bounds placements return `422`) | | `mode` | string | No | Quality/speed trade-off: `high` (default) or `fast`. See [Choosing a mode](#choosing-a-mode) | | `output_format` | string | No | `png` (default) or `jpeg` | **Maximum canvas size: 4 MP.** The target canvas area (`width × height`) cannot exceed 4 megapixels (4,194,304 pixels). You're free to choose any aspect ratio within that budget — for example `2048 × 2048`, `2730 × 1536` (16:9), or `1024 × 4096` — as long as the two dimensions multiplied together stay at or below 4 MP. Requests above this limit return `422`. ### Image placement `reference_offset_x` and `reference_offset_y` set the top-left corner of the reference image on the output canvas. Drag the reference below to see how the offsets relate to the canvas: You have two options for placing the reference image on the output canvas: * **Centered (default)** — provide the image, set `width` and `height`, and leave `reference_offset_x` / `reference_offset_y` as `None`. The image is centered automatically. * **Custom position** — set `reference_offset_x` and `reference_offset_y` to control exactly where the top-left corner of the reference image lands on the canvas. Negative values are allowed; if any part of the reference falls outside the canvas, either set `auto_crop: true` or the request will return `422`. ## Choosing a mode The `mode` parameter trades quality for speed. Both modes accept the same request fields (`input_image`, `width`, `height`, `reference_offset_x` / `reference_offset_y`, `auto_crop`, `prompt`) and produce the same response format. | Mode | Speed | Best for | | ---------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `high` (default) | Slower | The highest-fidelity results — recommended whenever fine detail, prompt adherence, or consistency with complex content in the source image matters. | | `fast` | Significantly faster | Naturally extending most scenes — landscapes, backgrounds, textures, and products. May produce lower fidelity in the extended region than `high`. Typically lower cost as well. | If you omit `mode`, the request runs in `high` mode. ```python theme={null} payload = { "input_image": image_b64, "width": 1024, "height": 1024, "mode": "fast", # opt into the faster path "output_format": "png", } ``` **Fast mode requirements.** Fast mode encodes the reference and pads it in latent space, so a few extra constraints apply on top of the shared ones. Requests that violate them return `422`: * `input_image` must be a **base64-encoded image** — image URLs are not supported in `fast` mode. * The placed reference must be **at least 64 px per side** and have an **aspect ratio of at most 8:1**. * The canvas (`width × height`) plus internal alignment padding must stay **at or below 4 MP**. A canvas right at the 4 MP limit may be rejected because of the added padding — reduce it slightly if so. Any `reference_offset_x` / `reference_offset_y`, `width`, and `height` are otherwise accepted; you don't need to pre-align them. ## Response format ### Initial response ```json theme={null} { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "polling_url": "https://api.bfl.ai/v1/get_result?id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" } ``` Always poll the URL returned in the response. ### Polling response (success) ```json theme={null} { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "status": "Ready", "result": { "sample": "https://delivery.bfl.ai/..." } } ``` When `status` is `"Ready"`, use `result.sample`. Signed delivery URLs are only valid for **10 minutes**. Retrieve your result within this timeframe. ## Tips for best results * The model extends the existing scene naturally. The endpoint is tuned to continue the input image's content, lighting, and composition on its own. * The model was trained on green, blue, and magenta fill colors and performs best with those internally — no caller action needed; the server handles fill colors automatically. * Keep total output dimensions reasonable. The canvas area (`width × height`) is capped at 4 MP, and very large canvases or extreme aspect ratios may reduce quality even within that limit. ## Troubleshooting * **`403 Forbidden`** — your API key is missing or your project doesn't have access to this endpoint. * **`422` / validation errors** — check base64 encoding and that `width` / `height` are present, at least `64`, and that their product (`width × height`) does not exceed 4 MP. The endpoint rejects unknown fields: use `reference_offset_x` / `reference_offset_y` (not the older `bbox_x1` / `bbox_y1`). * **`422` in `fast` mode specifically** — fast mode adds extra geometry constraints (see [Choosing a mode](#choosing-a-mode)): pass a base64 image (not a URL), keep the placed reference ≥ 64 px per side and within an 8:1 aspect ratio, and leave headroom below 4 MP so internal alignment padding still fits. Switch to `mode: "high"` if your placement can't satisfy these. * **Visible seams** — give the model more canvas room around the reference image. For the full list of HTTP status codes and polling response types returned by the API, see the [Errors reference](/api_integration/errors). # FLUX Virtual Try-On (VTO) Source: https://docs.bfl.ml/flux_tools/flux_vto Generate virtual try-on results from a person image plus one or more garment references. FLUX VTO enables you and your customers to generate virtual try-on for any person on any garment! The endpoint is optimized for low latency, making it ideal for interactive applications like virtual fitting rooms and social media filters. Try it interactively and for free in our [BFL Shop Demo](https://flux-tools.bfl.ai/virtual-try-on). Make sure to read the [prompting tips](#prompting-tips) and [reference image guidance](#reference-images) below. They have a significant impact on the output quality. ### Examples A single garment shown as a packshot. Use this when you have an individual product shot. A complete outfit composed from multiple garments arranged on a single canvas. The garment reference is shown worn by a different model. Useful when you only have on-model imagery available. ## Prompting tips * Core prompt formula: **`The person of image 1, maintaining exactly their face and pose, wearing the {YOUR GARMENT DESCRIPTIONS} of image 2.`** * A good default is even a static prompt like **`The person of image 1, maintaining exactly their face and pose, wearing the garments of image 2.`**. But to get higher quality results, we recommend to add a concise description of the garments. Especially for complex garments, a detailed description can significantly improve the outcome.\ You can for instance specify the fit and category of the garment like for example: * *the oversized tee* * the cap with *Keep FLUXing* text * *the 7/8 length pants*. * When using another model shot as garment reference, only **describe what should be tried on from that image** and don't specify in the prompt what should be kept from the model image.\ For instance, if the garment reference image also shows a model wearing pants, but you only want to try on the top, your prompt could be: **`The person of image 1, maintaining exactly their face and pose, wearing the green jacket of image 2.`** ## Reference images ### General guidance * Input images (both **model** and **garment**) up to **4 Megapixels** are used as-is. The output resolution follows the model image, so `vto-v2` can generate results up to 4 Megapixels. * Inputs larger than 4 Megapixels are **not** rendered at full resolution — they are automatically downscaled to a **\~1 Megapixel** target while preserving aspect ratio. If you want a high-resolution result, downscale oversized inputs to at most 4 Megapixels yourself before submitting. * For the best balance of quality and latency, keep the **model image** and the **garment image** at around 1 Megapixel. Larger inputs produce higher-resolution outputs, but increase latency. * Some artifacts from existing clothing may be retained in the output. If you are consistently seeing this, you can try **preprocessing the model image to get a more neutral base for the try-on**. A neutral base could mean just wearing tight-fitting, plain clothing. * For the garment reference, clean, well-lit images with a clear view of the garment details work best. Both packshot and on-model references are supported, but **packshot references with a plain background tend to produce the best results**. ### Designing the garment image If you want to generate an image with more than one garment, merge them into a single canvas first. This reduces extra file handling overhead and optimizes for latency. Four garments (jacket, cap, t-shirt, pants) arranged in a 2x2 grid as a single garment reference image ## Endpoint Submit a try-on job: ```bash theme={null} curl -X POST https://api.bfl.ai/v1/flux-tools/vto-v2 \ -H "x-key: $BFL_API_KEY" ``` Poll for the result: ```bash theme={null} curl https://api.bfl.ai/v1/get_result?id= \ -H "x-key: $BFL_API_KEY" ``` ### Regional endpoints To reduce latency, you can pin requests to a specific region by swapping the host: * `https://api.eu.bfl.ai/v1/flux-tools/vto-v2` — Europe * `https://api.us.bfl.ai/v1/flux-tools/vto-v2` — US Pick the region closest to your traffic, this can make a **difference of up to 1 second in latency**. The `polling_url` returned in the submit response will match the region you submitted to — always poll the URL returned in the response rather than rewriting the host. Follow the [regional endpoints guide](https://docs.bfl.ai/api_integration/integration_guidelines#regional-endpoints) for more information on the regional endpoints and how to use them. ## Versions | Version | Endpoint | Status | | ------- | ---------------------------- | ----------------------------------------------------------- | | **v2** | `POST /v1/flux-tools/vto-v2` | Recommended — improved face preservation and garment detail | | v1 | `POST /v1/flux-tools/vto-v1` | Available — superseded by v2 | `vto-v2` improves on `vto-v1` in three areas: * **Face preservation** — markedly better retention of the model's identity and facial features in the try-on result. * **Garment detail** — minor gains in the fidelity of garment textures, prints, and trims. * **Higher-resolution output** — input images up to **4 Megapixels** are used as-is and the result follows the model image's resolution. `vto-v1` only kept inputs up to 2 Megapixels as-is. On both versions, oversized inputs are downscaled to a \~1 Megapixel target. ### Migrating from v1 The request and response formats are **identical** between versions — swap the endpoint path from `vto-v1` to `vto-v2` and no other changes are required. ```diff Endpoint theme={null} - https://api.bfl.ai/v1/flux-tools/vto-v1 + https://api.bfl.ai/v1/flux-tools/vto-v2 ``` ## Quick start The API uses an asynchronous workflow: POST a person image and one or more garment images, together with a styling prompt, to the model endpoint. Use the returned `polling_url` to check status until the image is ready. ```python Python theme={null} #!/usr/bin/env python3 import base64 import os import time import requests API_KEY = os.environ["BFL_API_KEY"] BASE = "https://api.bfl.ai" HEADERS = {"accept": "application/json", "x-key": API_KEY, "Content-Type": "application/json"} PROMPT = "The person of image 1, maintaining exactly their face and pose, wearing the white t-shirt of image 2." PERSON_PATH = "/path/to/person.png" GARMENT_PATH = "/path/to/garment_top.png" with open(PERSON_PATH, "rb") as f: person_b64 = base64.b64encode(f.read()).decode() with open(GARMENT_PATH, "rb") as f: garment_b64 = base64.b64encode(f.read()).decode() payload = { "prompt": PROMPT, "person": person_b64, "garment": garment_b64, "output_format": "webp", } submit = requests.post(f"{BASE}/v1/flux-tools/vto-v2", headers=HEADERS, json=payload) submit.raise_for_status() meta = submit.json() task_id = meta["id"] poll_url = meta.get("polling_url", f"{BASE}/v1/get_result?id={task_id}") while True: r = requests.get(poll_url, headers={"accept": "application/json", "x-key": API_KEY}) r.raise_for_status() result = r.json() status = result.get("status") if status == "Ready": print("Result URL:", result["result"]["sample"]) break if status in {"Error", "Request Moderated", "Content Moderated", "Task not found"}: raise RuntimeError(f"VTO failed with status: {status} | payload: {result}") time.sleep(1) ``` ```bash cURL theme={null} PERSON_B64="$(base64 < /path/to/person.png | tr -d '\n')" GARMENT_B64="$(base64 < /path/to/garment_top.png | tr -d '\n')" jq -n \ --arg person "$PERSON_B64" \ --arg garment "$GARMENT_B64" \ '{ prompt: "The person of image 1, maintaining exactly their face and pose, wearing the white t-shirt of image 2.", person: $person, garment: $garment, output_format: "webp" }' > /tmp/vto_request.json curl -sS -X POST "https://api.bfl.ai/v1/flux-tools/vto-v2" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ -H "x-key: $BFL_API_KEY" \ --data-binary @/tmp/vto_request.json # Poll for the result curl -sS "https://api.bfl.ai/v1/get_result?id=YOUR_TASK_ID" \ -H "accept: application/json" \ -H "x-key: $BFL_API_KEY" ``` ## Request parameters Use `person` + `garment` as the minimum payload. | Parameter | Type | Required | Description | | ------------------ | ------- | -------- | ------------------------------------------------------------------ | | `prompt` | string | Yes | Natural-language styling instruction | | `person` | string | Yes | Person image — URL or base64 (mapped to `input_image`) | | `garment` | string | Yes | Garment reference — URL or base64 (mapped to `input_image_2`) | | `seed` | integer | No | For reproducibility | | `safety_tolerance` | integer | No | `0–5`, defaults to `2`. Moderation strictness for input and output | | `output_format` | string | No | `jpeg` (default), `png`, `webp` | | `webhook_url` | URL | No | Async callback | | `webhook_secret` | string | No | Signature secret | ## Response format ### Initial response ```json theme={null} { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "polling_url": "https://api.bfl.ai/v1/get_result?id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" } ``` Always poll the URL returned in the response. ### Polling response (success) ```json theme={null} { "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "status": "Ready", "result": { "sample": "https://delivery.bfl.ai/..." } } ``` When `status` is `"Ready"`, use `result.sample`. Signed delivery URLs are only valid for **10 minutes**. Retrieve your result within this timeframe. For the full list of HTTP status codes and polling response types returned by the API, see the [Errors reference](/api_integration/errors). # Multi-Reference Editing Source: https://docs.bfl.ml/guides/prompting_editing_multi_reference Combine multiple input images for style transfer, composites, and editorial scenes Multi-reference editing combines multiple input images into a single generated output. Use it for fashion composites, interior design, product scenes, and character-consistent variations. When using several references, describe the role of each image so the model knows what to pull from where. **\[pro] API has a 9MP total limit for input + output.** At 1MP output you can use up to 8 reference images, at 2MP output up to 7, and so on. FLUX.2 \[klein] supports up to 4 references. Multi-reference works well for: * **Fashion shoots**: Combine clothing items into styled outfits * **Interior design**: Place furniture and decor in rooms * **Product composites**: Combine multiple products in scenes * **Character consistency**: Maintain identity across variations ## Example 1 ## Example 2 ## Example 3 ## Use Cases Multi-reference editing covers a wide range of creative and professional tasks. Below are the most common categories with real prompt examples. *** ### Scene Compositing Combine elements from multiple source images into a single coherent scene. *** ### Style & Material Transfer Apply the visual style, texture, or material of one image onto the content of another. *** ### Object Replacement Replace or fill objects with elements from another reference image. *** ### Logo & Branding Place logos from one image onto objects or scenes in another. *** ## Writing Effective Multi-Reference Prompts Be **specific** about what changes and **clear** about the target state. Reference image locations when needed (e.g., "image 1", "image 2") and let the references provide visual context. * "Add dramatic storm clouds to the sky" * "Change her dress from blue to deep burgundy" * "Age this portrait by 30 years" * "Change image 1 to match the style of image 2" * "Make it better" * "Improve the lighting" * "Make it more professional" * "Fix the image" # Image Editing Source: https://docs.bfl.ml/guides/prompting_editing_overview Overview of image editing with FLUX.2 — swap backgrounds, replace objects, transfer styles, and combine multi-reference images in natural language. FLUX.2 brings powerful image editing capabilities across the entire model family. Describe what you want changed in natural language — swap backgrounds, replace objects, transfer styles, adjust lighting — and FLUX.2 makes it happen while maintaining photorealism. All **FLUX.2** variants support multi-reference image editing, allowing you to combine elements from multiple source images into a single coherent result. ## Reference Images per Model | Model | Reference Images (API) | Reference Images (Playground) | | ---------------------- | ---------------------- | ----------------------------- | | **FLUX.2 \[max]** | Up to **8** | Up to **10** | | **FLUX.2 \[pro]** | Up to **8** | Up to **10** | | **FLUX.2 \[flex]** | Up to **8** | Up to **10** | | **FLUX.2 \[klein] 9B** | Up to **4** | — | | **FLUX.2 \[klein] 4B** | Up to **4** | — | | **FLUX.2 \[dev]** | Recommended max **6** | — | More reference images means more control. Use multiple inputs to maintain character consistency, combine furniture from different photos, or transfer styles — all in a single generation. ## Single Editing Example ## Multi-Reference Example Full editing documentation with API examples, parameters, and multi-reference techniques. Learn how to write effective prompts for image editing workflows. # Single-Reference Editing Source: https://docs.bfl.ml/guides/prompting_editing_single_reference How to edit images using a single reference with FLUX.2 Single-reference editing is the most common workflow: you provide **one input image** and describe the changes you want. FLUX.2 understands the context of your image and applies edits while preserving what you didn't ask to change. Refer to the [Image Editing Overview](/guides/prompting_editing_overview) for core concepts before diving into specific use cases. ## Example 1 ## Example 2 ## Example 3 ## Use Cases Single-reference editing covers a wide range of creative and professional tasks. Below are the most common categories with real prompt examples. *** ### Background Replacement Change or replace the background of your image while keeping the subject intact. Input: bottle product photo Output: bottle in strawberries on white background Input: subject with original background Output: subject in cozy home environment *** ### Style Transfer Transform the visual style or medium of an image — from illustration to photorealism, or from photo to painting. Input: original photo Output: oil painting style Input: architectural illustration Output: photorealistic house Input: abstract artwork Output: mountain vista transformation *** ### Object Manipulation Add, remove, or replace objects in a scene. Be specific about what should change and what should stay. Input: image with sprinkles Output: sprinkles removed Input: image with flower Output: flower replaced with lemon slice Input: gorge scene Output: goblins added to gorge wall Input: DJ scene Output: polar bear replaces DJ Input: jars with cherries Output: cherries replaced with sprinkles Input: moss-covered statues Output: clean stone statues Input: person on motorcycle Output: person on rearing black horse Input: portrait with feathers Output: portrait with rose petals *** ### Color & Material Changes Recolor specific elements or transform materials — FLUX.2 supports hex color codes for precision. Input: cow with natural colors Output: cow with custom colors Input: butterfly Output: silver butterfly Input: butterfly Output: ice butterfly *** ### Lighting, Weather & Season Changes Shift the time of day, season, or weather conditions with a simple instruction. Input: scene in original season Output: winter scene Input: daytime scene Output: nighttime scene Input: scene with original lighting Output: warm autumn lighting *** ### Text Editing Add, replace, or modify text within images — from simple swaps to full ad layouts. Input: image with original text Output: text changed to Flux.2 Input: neon sign with original text Output: neon sign with new text Input: shop scene Output: new neon sign and traffic light Input: fashion photo Output: fashion ad with text and CTA *** ### Virtual Try-On & Clothing Change outfits, add accessories, or adjust clothing colors — great for fashion and e-commerce. Input: woman in original outfit Output: woman in fuchsia dress Input: woman without jacket Output: woman with fluffy jacket and hat Input: white lace wedding dress Output: sky blue lace wedding dress *** ### Pose & Expression Changes Adjust gaze direction, body pose, or facial expressions of subjects. Input: owl with closed eyes Output: owl with open eyes Input: woman looking away Output: woman looking at camera Input: woman in casual pose Output: woman in model pose *** ## Writing Effective Single-Reference Prompts Be **specific** about what changes and **explicit** about what should stay the same. The more precise your instruction, the better the result. * "Change the shirt color to red" * "Replace the background with a sunset beach" * "Turn this into an oil painting" * "Add snow to the scene, keep everything else unchanged" * "Make it better" * "Improve the lighting" * "Make it more professional" * "Fix the image" # FLUX Prompting Guide Source: https://docs.bfl.ml/guides/prompting_summary Learn how to prompt FLUX — from the basics to advanced techniques. Welcome to the official **FLUX** Prompting Guide. Whether you're just getting started or looking to refine your results, this guide walks you through everything you need to get the most out of FLUX — from crafting your first prompt to mastering advanced techniques. A cinematic long shot with the camera positioned half underwater and half above the surface, showing a whale diving in the open ocean This guide covers prompting for the entire FLUX model family — FLUX.1, FLUX.1 Kontext and FLUX.2. Where behavior differs meaningfully between models, we'll call it out explicitly. If you're still choosing a model, see [Which Model to Choose?](/flux_2/flux2_overview#which-model-to-choose) in the FLUX.2 overview. How FLUX reads prompts — structure, word order, and what actually matters. Single-reference and multi-reference editing with FLUX.2. Prompt FLUX 3 for motion, camera behavior, clip continuation, and synchronized audio workflows. Photorealism, typography, style transfer, and more — with example prompts. Which FLUX.2 variant fits your workflow. # Prompting Basics Source: https://docs.bfl.ml/guides/prompting_unified_basics Core concepts and foundational knowledge for prompting FLUX models ### What is Prompting? Prompting in text-to-image generation refers to the process of entering a text description — the prompt — that FLUX uses to generate a matching image. Your prompt is the primary way you communicate intent: what should be in the image, how it should look, and what mood or style it should convey.
Chromatic 3D cursor on a black background
## What Can a Prompt Look Like? A prompt passed to FLUX can take many forms. There is no single correct format — what matters is that your description gives FLUX enough to work with. This template is a useful starting structure, not a strict formula. You can keep it concise, expand individual slots, or ignore parts that are not relevant to your image. ## Use Natural Language FLUX works best when your prompt reads like a clear description of the image you want to generate. Natural language helps the model understand what should appear in the image, how the elements relate to each other, and what visual direction to follow. The clearer the description, the easier it is for FLUX to produce a focused and consistent result. ## Text in images When you want FLUX to generate specific text inside an image, place the exact wording in quotation marks. This makes it clearer that the text should appear visibly in the final image, rather than being treated as part of the general prompt description. Quotation marks help separate written content from the rest of the scene, which gives FLUX a stronger signal to render the words as text. ## Refine As You Go Strong prompts usually come from iteration, not from trying to write the perfect prompt on the first attempt. A practical loop is: 1. Start with a simple version 2. Check what FLUX got right and wrong 3. Adjust one important detail at a time If the image is close but not there yet, tweak the subject, framing, lighting, or style before rewriting everything. ## Multilingual Prompting FLUX can be prompted in multiple languages. You don't need to write in English to get great results — FLUX understands a wide range of languages and responds to them with the same level of quality. That said, English prompts tend to produce the most precise results, as the majority of FLUX's training data is in English. ## Image Input With **FLUX.1 Kontext** and **FLUX.2**, your prompt isn't limited to text. These models accept up to 10 images as additional input alongside your text prompt — allowing you to edit existing images, transfer styles, maintain character consistency across generations, or composite multiple references into a single output. Red and black butterfly in flight Silver metallic butterfly in flight Image-based prompting is covered in depth in the [Image Editing with FLUX](/guides/prompting_editing_overview) section of this guide. # Building a Good Prompt Source: https://docs.bfl.ml/guides/prompting_unified_building How FLUX reads prompts and how to structure them into clear, controllable image instructions ## Prompt length FLUX.2 supports prompts up to 32K tokens. | Length | Words | Best For | | ---------- | ------- | ----------------------------------------------------- | | **Short** | 10-30 | Quick concepts, fast iteration, style exploration | | **Medium** | 30-80 | Most scenes and everyday prompting | | **Long** | 80-300+ | Complex multi-subject scenes or very directed outputs | Start short. Add only what changes the image. More words do not automatically mean better results. ## Structure helps The goal is not to write the longest possible prompt. The goal is to give FLUX a clear structure. A good prompt works like a set of instructions. It tells the model what kind of image you want, what the main subject is, where the scene happens, and how it should feel visually. One useful way to organize that information is this template: This is a prompt-building aid, not a rule. You do not need every slot every time. Use the parts that actually improve the image you want. Here are a few visual examples of that structure applied in practice: Prompt structure example showing a photorealistic portrait Prompt structure breakdown with labeled prompt components ## Start by describing the image Start with the core subject or content of the image. That can be something simple: * `a cat` * `a family on a beach` * `autumn foliage in a park` Then add the details that make the image more specific and visually interesting. Useful details include: * **What the subject is doing**: `looking up`, `playing`, `running` * **How the action feels**: `joyfully`, `fearfully`, `boldly` * **The mood of the image**: `ominous morning rain`, `dangerous sunset mountains`, `nostalgic coffee table` The more relevant detail you provide, the more likely you are to get a compelling result. But each model interprets prompts differently, so the same wording will not behave identically everywhere. For FLUX, the most reliable pattern is usually: 1. Start with a clear subject 2. Add the main action or state 3. Add mood, context, and visual direction only when they improve the image Specific detail helps. Filler hurts. The difference between a simple prompt and a directed prompt is often easy to see:
Basic prompt: dog in park
Detailed prompt: golden retriever jumping in living room
## The prompt components | Component | What it controls | Example | | ----------------------- | -------------------------------------------- | --------------------------------------------- | | **Image type** | The overall category or framing of the image | `portrait`, `landscape`, `macro` | | **Subject** | The main thing you want to see | `a young woman with curly red hair` | | **Location** | The setting or environment | `in a futuristic space station` | | **Style** | The artistic or visual direction | `editorial photography`, `anime illustration` | | **Camera settings** | Lens, framing, depth of field, shot style | `85mm lens, shallow depth of field` | | **Lighting** | How the image is lit | `soft window light`, `golden hour sunlight` | | **Colors** | The dominant palette | `muted earth tones`, `deep green and cream` | | **Effect** | Extra visual treatment | `motion blur`, `film grain`, `soft bloom` | | **Additional elements** | Supporting details that enrich the scene | `wind-blown fabric, falling leaves` | ## Image type The **image type** gives FLUX a broad idea of what kind of image to create. Even before you describe the subject, it affects composition and visual expectations. Useful starting points: * **Portrait**: close-up or medium shot focused on a person or character * **Landscape**: wide scene showing nature, architecture, or an environment * **Bird's-eye view**: top-down perspective, as if seen from high above * **Macro**: extreme close-up showing fine details * **Abstract**: shape, color, or texture-driven composition If you are learning how prompt parts change the result, start with a simple image type such as `portrait`. It makes the effect of later additions easier to see. ## Subject The **subject** is the main focus of the image. Be specific when it matters. Clear subjects are easier for FLUX to render consistently than vague ones. Examples: * `a young woman with curly red hair` * `an elderly man with a long white beard` * `a cyberpunk teenager with neon blue hair` * `a Siamese cat with a blue collar` * `a single red rose` ## Location The **location** sets the scene. It provides context and changes the mood of the image even when the subject stays the same. Examples: * `in a bustling city street` * `on a serene beach at sunset` * `in a futuristic space station` * `inside a dimly lit jazz club` * `in a dense forest after rain` Changing only the location is one of the fastest ways to explore variations on the same concept. ## Style The **style** tells FLUX what visual language to use. This can be photographic, illustrative, cinematic, painterly, or highly specific to a medium. Examples: * `fashion editorial photography` * `wildlife documentary style` * `anime illustration` * `oil painting` * `minimalist product photography` If style is central to the result, mention it early and keep it concrete. ### Art form and style If you want a specific visual effect, describe both the **art form** and the **style**. #### Photography Photography is useful when you want realistic images. You can control: * framing * lighting conditions * lens feel * camera distance * depth of field Example: `A child playing on a sunny beach, building a sandcastle, action photography, high shutter speed, soft warm light` #### Painting Painting prompts work well when you want texture, brushwork, and stronger artistic interpretation. You can combine: * techniques such as `oil painting` or `watercolor` * movements such as `impressionism` or `fauvism` * artist references when appropriate Example: `Impressionist oil painting of a small robot in a garden` #### Illustration Illustration is useful when you want a drawn or stylized result rather than a photo-like one. Examples of illustration directions: * `pencil drawing` * `charcoal sketch` * `cartoon illustration` * `poster illustration` Example: `Illustration of dinosaurs drawn in a childlike style, cute and playful` #### Digital art Digital art is useful when you want a more synthetic, graphic, or contemporary visual language. Example: `An isolated convenience store in the desert at sunset, lo-fi digital art, nostalgic atmosphere` #### Film still Film still is useful when you want something cinematic and emotionally charged. Example: `Buildings on fire, old film still, smoky atmosphere, dramatic contrast` #### Other art forms You can also experiment with: * `sculpture` * `collage` * `street art` * `textile art` * `installation art` * `ceramic art` * `lithography` Mixing art forms and styles can lead to strong results, but keep the combination coherent. ## Camera settings The **camera settings** define how the image is framed or captured. This is most useful when you want a photographic result. Examples: * `85mm lens` * `wide-angle shot` * `close-up framing` * `shallow depth of field` * `shot from a low angle` Use these when framing matters. If the exact camera look is not important, you can skip this part. ### Framing Framing controls how the subject is positioned in the image. Prompt order matters here too. If FLUX keeps pulling too far back, make the subject clear first and move environmental details later in the sentence. This version can lead to a wider scene than intended: `Person standing inside a forest fire, strong determined attitude, close-up shot, realistic` This rewrite usually gives you more control: `Person with a strong determined expression, forest fire in the background, close-up shot, realistic` Useful framing language: * `close-up` * `medium shot` * `wide shot` * `overhead view` * `point-of-view shot` * `dutch angle` * `low-angle shot` ## Lighting Lighting shapes contrast, mood, depth, and realism. Examples: * `soft window light` * `golden hour sunlight` * `harsh direct flash` * `overcast daylight` * `neon backlighting` You can also use: * `soft light` * `hard light` * `dramatic lighting` * `morning light` * `sunset light` * `golden hour` ## Colors Colors define the palette and help FLUX keep the image visually coherent. Examples: * `muted beige and forest green tones` * `deep blue and silver` * `warm orange and pink sunset colors` * `monochrome black and white` * `desaturated pastel palette` ### Color scheme Color scheme is especially useful when you want the entire image to feel unified. Example: `A futuristic busy city, purple and green color scheme` Lighting already influences color, but explicit palette direction helps FLUX stay more consistent. ## Effect Effect adds visual treatment on top of the base scene. Examples: * `film grain` * `soft bloom` * `motion blur` * `bokeh` * `double exposure effect` Use one or two strong effects. Too many can make the image feel unfocused. ## Additional elements Additional elements are the supporting details that make an image feel complete. Examples: * `floating dust particles` * `wind-blown fabric` * `falling leaves` * `glowing reflections on wet pavement` * `scattered flowers on the table` ## Detail and realism You can also add detail or realism cues when you want the image to feel sharper, more polished, or more believable. Examples: * `highly detailed` * `realistic` * `ultrarealistic` * `cinematic detail` * `sharp texture detail` Avoid stacking too many generic quality terms. One or two strong realism cues are usually enough. ## Build one prompt step by step Here is the same idea expanded gradually: `portrait, a young woman with curly red hair` Portrait of a young woman with curly red hair `portrait, a young woman with curly red hair, in a bustling city street` Young woman with curly red hair in a city street `portrait, a young woman with curly red hair, in a bustling city street, fashion editorial photography, 85mm lens, soft golden hour light` Fashion editorial portrait with golden hour light `portrait, a young woman with curly red hair, in a bustling city street, fashion editorial photography, 85mm lens, soft golden hour light, warm amber and charcoal tones, subtle film grain, wind-blown hair and blurred city lights` Final portrait with warm tones, film grain, and wind-blown hair ## Practical advice * Start with the image type and subject. * Add style and lighting next if the first result feels generic. * Use colors when you want stronger visual cohesion. * Add effect and additional elements last. These are refinements, not the foundation. * If a prompt gets bloated, remove the parts that do not clearly change the image. Do not treat the template like a checklist you must always fill out. Strong prompts are specific, not necessarily long. # Prompt Reference Source: https://docs.bfl.ml/guides/prompting_unified_reference Cheat sheet with camera terms, lighting and style keywords, and ready-to-use example prompts ## Camera & Lens Cheat Sheet | Term | Effect | | ------------------- | ------------------------------------------------- | | **f/1.4 – f/2.8** | Blurry background (shallow depth of field) | | **f/8 – f/16** | Everything sharp (deep depth of field) | | **24mm** | Wide angle — shows more of the scene | | **35mm** | Natural, documentary-style perspective | | **50mm** | Eye-level, neutral perspective | | **85mm** | Portrait-ideal, slight background compression | | **135mm+** | Telephoto — strong background compression | | **ISO 100** | Clean image, low noise | | **ISO 1600–3200** | Brighter but grainy — useful for film-style looks | | **Macro lens** | Extreme close-up detail | | **Anamorphic lens** | Widescreen cinematic look with oval bokeh | ## Lighting Keywords | Term | Effect | | ------------------------ | ------------------------------------------------------------ | | **Golden hour** | Warm, soft, flattering — just after sunrise or before sunset | | **Blue hour** | Cool, moody — just before sunrise or after sunset | | **Overcast** | Flat, even, shadow-free — great for product shots | | **Rembrandt lighting** | Dramatic triangle of light on the face | | **Split lighting** | High contrast, half-face illuminated | | **Chiaroscuro** | Strong light/shadow drama | | **Backlit / rim light** | Subject glowing at the edges | | **Soft box / key light** | Studio, controlled, even | | **Practical lighting** | Light sources visible in the scene (lamps, neon, fire) | | **Diffused light** | Soft, wrap-around, minimal shadows | | **Harsh direct light** | Strong shadows, high contrast | **Example lighting phrases:** ## Style Keywords | Category | Keywords | | ---------------- | ------------------------------------------------------------------------------------------------------------------ | | **Photographic** | "shot on Kodak Portra 400", "35mm film", "IMAX camera", "Sony A7IV", "Hasselblad X2D", "Canon 5D" | | **Cinematic** | "cinematic", "anamorphic lens flare", "teal and orange color grading", "film noir", "Roger Deakins cinematography" | | **Artistic** | "oil painting", "watercolor", "pencil sketch", "impasto texture", "Art Nouveau", "Bauhaus" | | **Digital art** | "concept art", "matte painting", "octane render", "unreal engine", "stylized 3D" | | **Illustration** | "flat design", "vector illustration", "comic art", "anime style", "graphic novel", "whimsical" | | **Vintage** | "80s vintage photo", "2000s digicam", "VHS aesthetic", "polaroid", "sepia tone" | ## Composition Techniques | Technique | When to Use | Example Phrase | | -------------------------------- | --------------------------------------- | ----------------------------------------------------- | | **Rule of thirds** | Natural, balanced framing | "composed using rule of thirds" | | **Leading lines** | Guide the eye through the image | "diagonal lines leading to main entrance" | | **Foreground/background layers** | Add depth and dimension | "strong foreground boulder, background mountains" | | **Low angle (worm's eye)** | Make subjects powerful and dominant | "low angle worm's eye view, dramatic diagonal lines" | | **High angle (bird's eye)** | Show patterns and spatial relationships | "bird's eye view, geometric patterns of city blocks" | | **Dutch angle** | Tension and psychological unease | "dutch angle, psychological tension" | | **Symmetrical** | Formal, balanced, architectural | "perfectly symmetrical composition" | | **Negative space** | Minimal, focused, product | "minimalist composition with generous negative space" | ## Model-Specific Quick Reference * No negative prompts supported * Excellent typography — use quotation marks for exact text * HEX color codes for brand-precise color matching: `"in color #FF5733"` * JSON structured prompts supported for production workflows * Reference specific camera models for authentic photorealistic looks See: [JSON Prompting →](/guides/usecases_t2i_json_prompting), [Typography & Design →](/guides/usecases_t2i_typography_design), [HEX Color Prompting →](/guides/usecases_t2i_hex_color_prompting) * What you write is exactly what the model receives * Write in prose, not keyword lists — describe scenes like a novelist * Lighting descriptions have the highest single impact on output quality * Supports image editing with single and multi-reference inputs * Add `Style: [style]. Mood: [mood].` at the end for consistent aesthetics See: [Single-Reference Editing →](/guides/prompting_editing_single_reference), [Multi-Reference Editing →](/guides/prompting_editing_multi_reference) * Specify what should **change** — the input image provides all other visual context * Use quotation marks for text editing: `Replace 'joy' with 'BFL'` * Be explicit about preservation: *"while maintaining the same facial features and hairstyle"* * Prefer specific verbs: "change the clothes" over "transform the person" * For multiple changes, add as many explicit details as possible # Style, Aesthetics & Text Source: https://docs.bfl.ml/guides/prompting_unified_style Style keywords, photorealistic looks, illustration styles, and how to get readable text in images ## Photorealistic Styles FLUX generates photorealistic images from natural language. Reference specific eras, cameras, and film stocks for distinctive looks. | Style | Key Descriptors | | ------------------ | ------------------------------------------------------------------------------------ | | **Modern Digital** | "shot on Sony A7IV, clean sharp, high dynamic range" | | **2000s Digicam** | "early digital camera, slight noise, flash photography, candid, 2000s digicam style" | | **80s Vintage** | "film grain, warm color cast, soft focus, 80s vintage photo" | | **Analog Film** | "shot on Kodak Portra 400, natural grain, organic colors" | ![Tiger cub under banana leaf in rainy jungle](https://cdn.sanity.io/images/2gpum2i6/production/bc6432890df19f127624df9eb47c7d5fdd984a3d-2656x1504.png) ![Sloth in Bangkok nightlife, digicam style](https://cdn.sanity.io/images/2gpum2i6/production/d02f27fc01e66dca0f812c02678e3502cf664d19-1328x752.png) ![Baby penguins in trampoline park, 80s vintage](https://cdn.sanity.io/images/2gpum2i6/production/ef2490df716e6b6eeaf7d7bc4e9af0200fa53b52-1328x752.png) ![Old faded family portrait](https://cdn.sanity.io/images/2gpum2i6/production/dc7ce17bfc1ec5d526ae33bc975d00459590f9de-1328x752.png) For photorealism, specify camera models, lenses, and film stocks. "Shot on Fujifilm X-T5, 35mm f/1.4" produces more authentic results than just "professional photo." ### Camera and Lens Simulation Be specific about camera settings for authentic results: ``` Shot on Hasselblad X2D, 80mm lens, f/2.8, natural lighting ``` ``` Canon 5D Mark IV, 24-70mm at 35mm, golden hour, shallow depth of field ``` ## Art Styles & Illustration FLUX handles a wide range of artistic styles beyond photorealism. Name the style specifically and describe its visual characteristics. **Style fusion** — Combine two styles with a unifying palette: *"Ancient Greek marble statue precision and anatomical detail, infused with cyberpunk neon lighting, holographic overlays, and electric blue/magenta glow effects, set against dark futuristic environments"* **Style + mood annotations** — Add explicit tags at the end of your prompt for consistent aesthetics: ``` [Scene description]. Style: Country chic meets luxury lifestyle editorial. Mood: Serene, romantic, grounded. ``` ``` [Scene description]. Shot on 35mm film (Kodak Portra 400) with shallow depth of field — subject razor-sharp, background softly blurred. ``` 1990s editorial Surreal interior Golden hour silhouette ## Lighting Lighting has the **greatest single impact** on output quality. Describe it like a photographer would — "good lighting" is not enough. **What to describe:** * **Source**: natural, artificial, ambient * **Quality**: soft, harsh, diffused, direct * **Direction**: side, back, overhead, fill * **Temperature**: warm, cool, golden, blue * **Interaction**: catches, filters, reflects on surfaces **Rembrandt lighting** (45° key light) — triangle of light on the face for dramatic portraits: *"Portrait with Rembrandt lighting, key light at 45 degrees, dramatic chiaroscuro effect"* **Split lighting** (90° side light) — half-face illuminated for high contrast: *"Artistic portrait, split lighting, strong side illumination, dramatic contrast"* Rembrandt lighting Split lighting **Window light** = soft, even illumination **Golden hour** = warm and soft **Blue hour** = cool and moody **Overhead artificial** = harsh and dramatic Window light Golden hour Blue hour Overhead artificial light **Chiaroscuro** — high contrast light/shadow for drama: *"Film noir detective scene, single practical desk lamp, strong chiaroscuro lighting"* **Practical lighting** — visible light sources in scene for realism: *"Cyberpunk street scene, neon signs and LED strips providing atmospheric lighting"* Chiaroscuro Practical lighting ## Text in Images FLUX handles text well when prompted correctly. Use this three-step approach: Use quotes for exact text: `"COFFEE SHOP"` or `"Est. 1952"` Specify where text appears: *"The text 'OPEN' appears in red neon letters above the door"* Name the style: *"elegant serif typography"* or *"bold industrial sans-serif lettering"* !['Open' neon sign](https://cdn.sanity.io/images/2gpum2i6/production/324a5024e679ee8a693821fc5bbdedb2c3fde129-1888x1056.png) Phone advertisement Groovy retro poster Magazine cover ### Text Rendering Tips * **Front-load text descriptions** for better accuracy * **Use quotation marks** around exact text you want rendered * **Describe color and effects**: "red neon letters", "gold serif lettering", "chalk on blackboard" * **Use hex codes** for brand-precise colors: *"The logo text 'ACME' in color #FF5733"* * **Keep text short** — long strings are harder to render accurately * **Specify font character**: serif = traditional/formal, sans-serif = modern, script = elegant, display = bold/impactful ### Typography Styles Reference | Style | Effect | Example | | ----------------- | ---------------------- | -------------------------------------------------------- | | **3D text** | Dimensional, impactful | "raised chrome letters with realistic metal reflections" | | **Neon effects** | Atmospheric, glowing | "glowing neon text with electric blue light" | | **Vintage signs** | Authentic, weathered | "weathered painted text with chipped paint and rust" | | **Environmental** | Integrated into scene | "carved directly into the ancient stone wall" | | **Object-based** | Printed on props | "printed on a newspaper being read by the character" | # Technical Parameters Source: https://docs.bfl.ml/guides/prompting_unified_technical Aspect ratios and working without negative prompts ## Aspect Ratios Choose the ratio that matches the compositional intent of your scene. Mismatched ratios force the model to either crop or pad the composition. | Ratio | Format | Best For | | -------- | -------------- | -------------------------------------- | | **1:1** | Square | Social media, profiles, product shots | | **16:9** | Landscape | Widescreen, web headers, presentations | | **9:16** | Portrait | Mobile, stories, vertical editorial | | **4:3** | Standard | Classic photography | | **3:2** | Photo standard | DSLR-style portrait and landscape | | **21:9** | Ultra-wide | Cinematic, panoramic scenes | A landscape-oriented prompt benefits from 16:9; a portrait prompt from 9:16. ## Working Without Negative Prompts Most FLUX models do not support negative prompts. Even when they can process them, AI models generally struggle with negation — writing *"a person without glasses"* causes the model to focus on "glasses" and often generate exactly what you were trying to avoid. ### The Replacement Strategy When you catch yourself writing negative phrases, use this mental process: 1. **Identify** the unwanted element: *"no crowds"* 2. **Ask** what would fill that space: *"What would I see there?"* 3. **Describe** the positive: *"peaceful solitude"* or *"empty pathways"* **Common replacements:** | Instead of... | Write... | | -------------------- | ---------------------------------------------- | | "no people" | "empty", "deserted", "solitary" | | "without clothes" | "bare skin", "natural form" | | "no colors" | "monochrome", "black and white", "grayscale" | | "no text" | "clean surfaces", "unmarked", "blank" | | "no modern elements" | "traditional", "historical", "period-accurate" | | "not dark" | "brightly lit", "sun-drenched" | | "not sad" | "joyful", "content" | | "not running" | "walking peacefully", "standing still" | | "not many" | "few", "single", "minimal" | ### Practical Examples * **Instead of**: "a street with no cars" **Write**: "a quiet pedestrian walkway with cobblestones" * **Instead of**: "a landscape without buildings" **Write**: "pristine wilderness with untouched natural terrain" * **Instead of**: "a room with no furniture" **Write**: "a spacious empty room with polished wooden floors" * **Instead of**: "a person without a hat" **Write**: "a person with natural hair flowing freely" * **Instead of**: "a portrait with no glasses" **Write**: "a portrait showing clear, unobstructed eyes" * **Instead of**: "not dark or scary" **Write**: "peaceful, welcoming, and warm atmosphere with soft golden lighting" * **Instead of**: "not too realistic" **Write**: "stylized illustration with simplified forms and bold color blocks" * **Instead of**: "portrait with no background distractions" **Write**: "portrait with smooth gradient background transitioning from deep blue to black" ### The Beach Progression Positive framing combined with specificity consistently produces better results: ### When Positive Alternatives Don't Work If you're still getting unwanted elements despite positive framing: 1. **Be more specific** about what you do want in that space 2. **Front-load the positive description** — word order signals priority 3. **Add more descriptive detail** to strengthen the positive alternative 4. **Use environmental context** to make the positive element feel natural Think visually about what you want to see, not what to avoid. ## Prompt Upsampling FLUX.2 \[pro], \[max], and \[flex] automatically enhance short prompts by adding visual detail and context while preserving your original intent. This is useful for: * Quick iterations without crafting detailed prompts * Exploring creative variations from a short concept * Generating richer output from a basic idea On FLUX.2 \[klein], what you write is what you get — be descriptive. Other FLUX.2 variants are more forgiving with short prompts. # Use Cases Source: https://docs.bfl.ml/guides/prompting_unified_usecases Real-world applications from marketing and design to e-commerce and image editing Explore what's possible with FLUX. Each use case below demonstrates a real-world application — from product photography and marketing creatives to style transfer and multi-image compositing. Click any image to see examples and prompts. ## Text-to-Image Use Cases ## Editing Use Cases # Audio and speech Source: https://docs.bfl.ml/guides/prompting_video_audio Learn how to prompt FLUX 3 for dialogue, voiceover, ambience, sound effects, music, and voice direction. FLUX 3 generates audio with the video. A scene that clearly implies sound may be enough for a first pass. When the sound matters, describe it as part of the shot instead of leaving the model to infer the whole soundtrack. ## Name the sound you want A useful video prompt can include four kinds of sound: | Layer | What to describe | Example | | -------- | -------------------------------------------------- | ------------------------------------------------------------------ | | Speech | Who speaks, the exact words, and how they say them | `The mechanic says, "Try it now." Quiet, matter-of-fact delivery.` | | Ambience | The sound of the place | `Rain against the windows, low diner chatter, refrigerator hum` | | Effects | Sounds tied to visible actions | `A ceramic mug clicks against the saucer` | | Music | Style, pace, and where it sits in the mix | `A sparse piano cue under the scene, low in the mix` | You do not need all four. A quiet room with one line of dialogue may only need speech and room tone. A product clip may need effects and music but no voice. ```text theme={null} [Shot and action]. Dialogue or voiceover: [speaker and exact words]. Ambience: [place]. Effects: [visible actions]. Music: [style and role]. ``` Specific sources usually work better than broad mood words. `Distant traffic and rain ticking against a metal awning` gives the model more to work with than `moody ambience`. Name the sound source you want rather than asking for silence. `Rain against the window` or `a soft piano bed` gives the model something concrete; `quiet room tone` may collapse into static or dead air. ## Dialogue and voiceover Put the exact spoken words in quotation marks and say who delivers them. For a visible speaker, describe the person speaking on camera: For an off-screen line, call it a voiceover: A quoted line without a visible speaker or a voiceover cue may be treated as text that belongs in the frame. Make the distinction explicit when it matters. A visible speaker gives FLUX 3 a face to lip-sync. An off-screen voice needs a clear `voiceover` or `narration` cue. ## Direct the speaker Phrases such as `professional, warm, and engaging` leave most of the voice to the model. They often produce the same polished read: careful diction, even pauses, and more energy than the scene needs. Give the voice a few concrete anchors instead: | Direction | Useful detail | | --------- | --------------------------------------------------------------------- | | Person | Age range and accent, when either matters to the character | | Register | Low, mid, bright, soft, rough, or another audible quality | | Recording | Close and dry, across a room, phone microphone, public-address system | | Delivery | Lightly amused, hesitant, practical, talking to one friend | | Guardrail | No announcer delivery, no sales voice, do not over-enunciate | Use only the details that change the read. Long stacks of personality adjectives can fight each other. Directions such as `one audible breath` can also make that breath too prominent. If you want natural timing, ask for a relaxed read and judge the result by ear. ### Write dialogue people can say Voice direction cannot rescue stiff copy. Read the line aloud before generating it. * Use contractions when the character would use them. * Cut setup the listener can already see. * Avoid a slogan at the end of every line. * Give the speaker a reason to say the words to someone in the scene. * Keep punctuation simple. Too many pauses can turn into a sing-song rhythm. ## Leave room for the line Speech takes time, and the line may not start right away. A short line in a longer clip is safer than copy written to fill every second. If the final word gets cut off, shorten the line or increase the clip duration. Timing instructions can give the model a target, but they are not exact: ```text theme={null} The voiceover speaks once and aims to finish by 8 seconds. For the final two seconds, only rain against the window. ``` Do not force several speakers, a long script, and multiple visual beats into a short clip. Split the scene when each part needs its own timing. Multi-speaker attribution and interruptions are still review-heavy. Name each speaker, keep turns short, and judge each take by ear before relying on who said what. ## Build the mix around the scene Name sounds that have a source in the frame or just outside it. This keeps the audio tied to the picture. If speech is the focus, keep other voices out of the background. Crowd conversation, a talking radio, or another narrator can compete with the main line. Weather, machinery, footsteps, and traffic are easier to layer under speech because they do not introduce more words. ## Languages and accents FLUX 3 can generate speech in many languages and accents, and it can switch languages within one performance. Name each language directly, place it beside the line it belongs to, and describe the delivery as you would for any other speaker. You can provide dialogue in native script, in a romanized or transliterated form, or as a plain-language instruction that names the target language and meaning. Use quoted dialogue when the exact words matter. No one format is always best, so use the one that fits how you write and review the result by ear. For one speaker changing languages: * Label each line with its language. * Put the lines in the intended order. * Say that the same speaker continues across the switch. * Keep each segment short enough to leave room for a natural pause. For several multilingual speakers, identify each person by a visible role or stable description. Assign each speaker a language, line, and delivery, then separate the turns instead of asking for overlapping dialogue. Treat accents as part of a character and situation rather than as an isolated adjective. Pair the accent with pace, projection, emotion, and who the person is speaking to: `natural Hindi delivery, warm and relieved`, or `French spoken softly over a suit radio, with quiet wonder`. Language, accent, line order, speaker attribution, and timing are directable targets rather than exact controls. Review each take by ear when the performance matters. ### Switch languages in one voice The language labels, exact order, and `same voice` cue make the handoff explicit without turning the prompt into a timing sheet. ### Give each speaker a language Visible roles such as `orange-suited astronaut` and `blue-suited astronaut` connect each language and line to the intended person. ### Use native-script dialogue Native-script dialogue can make the intended words explicit. Name the language as well as the quoted line, then describe how the speaker should deliver it. ## Keeping a voice across clips Reuse the full voice direction when a character returns. Keep the person, register, recording setup, and delivery wording stable, then replace only the script and scene details. This can preserve the same kind of voice, but it does not guarantee the same performer on every generation. Treat the prompt as casting direction rather than a fixed speaker identity. Compare takes by ear before cutting them into the same sequence. ## Troubleshooting | What happened | What to change | | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | The spoken line appears as text | Name a visible speaker or say `voiceover`, keep the exact line in quotes, and add `no on-screen text or subtitles` | | The read sounds like an ad | Replace generic praise words with a person, recording setup, and social situation; add `no announcer delivery` or `no sales voice` | | The cadence is sing-song | Simplify punctuation, remove repetitive sentence shapes, and ask for a relaxed conversational rhythm | | The words become garbled | Remove competing speech such as crowd conversation, a talking radio, or a second voice | | The last word is cut off | Shorten the line, raise the duration, or ask for the line to finish earlier | | The soundscape feels generic | Name the source of each sound and connect effects to visible actions | | The mix is too busy | Keep the one or two layers the scene needs and remove the rest | ## Related pages Build the shot, action, camera movement, pacing, and scene around the audio. Choose the FLUX 3 video workflow that fits the source material and shot. See how synchronized audio works in the API and how to turn it off. Pair sound direction with clear framing and camera movement. # Examples & Cheatsheet Source: https://docs.bfl.ml/guides/prompting_video_camera_terms A compact FLUX 3 reference for shot sizes, angles, composition, movement, and focus prompts. ## Shot sizes and framing ## Camera angles ## Composition techniques ## Camera movements Start with one framing term, one movement term, and one clear subject action. Too many camera instructions in a single sentence usually make the shot less readable. ## Focus techniques ## Lenses and optics ## Shutter and time ## Lighting styles ## Shot transitions ## POV and specialty rigs ## Aspect and format ## VFX and transformation ## Art direction ## Animation and media ## FAQ Yes, but keep it intentional. `low tracking shot` is clear. `low aerial handheld orbit push-in` usually is not. Usually start with the subject and action, then add framing, movement, and style around it. No. Add it when framing or motion behavior matters. If you leave it out, the model will infer a shot on its own. No. Treat them as reusable camera phrases that you combine with subject, environment, and motion details. ## Related pages Build full FLUX 3 prompts with subject action, camera behavior, and scene motion. Start here for workflow selection and the broader video prompting framework. See modes, examples, and implementation details for FLUX 3 video workflows. Revisit the general prompting principles that still apply before camera language. # Image-to-Video Source: https://docs.bfl.ml/guides/prompting_video_image_to_video Animate a still image with FLUX 3 — pin a startframe, set a start and end frame, or interpolate through several keyframes. Turning an image into video is not a single action. Depending on how strictly the model should follow your image — and whether it defines the *start*, the *end*, or just the *look* of a shot — FLUX 3 gives you several distinct ways to animate. The right approach depends on what your image should *become*: the literal opening frame of the shot, one end of a defined motion, or one of several waypoints the shot moves through. Choosing deliberately gives you far more control than sending the same image into every mode and hoping for the best. ## Overview `i2v` animates from the images you give it — all through one `keyframes` field. What changes is *how many* frames you pin and *where* they sit in the shot: | Shape | What your image(s) become | Best for | | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | **Startframe** — one image | The exact opening frame; the prompt animates forward | Bringing a single photo or render to life | | **Start + end frame** — two images | The first *and* last frame; FLUX 3 fills the motion between | Controlling exactly where a shot begins and where it lands | | **Keyframes** — three or more images, or `[seconds, image]` pairs | Ordered waypoints the shot passes through in turn, spread evenly or pinned to exact timestamps | Choreographing a shot through multiple beats | Reach for **Startframe** when the result must begin exactly on your image, **Start + end frame** when you know both ends of the motion, and **Keyframes** when the shot has to hit several specific moments along the way. Timestamped and 3+ keyframe requests need an explicit `duration`. ## Startframe In `i2v`, your image sets the opening frame and the prompt drives the motion. Click to animate. ### Examples Notice how the source frame is preserved exactly at the start of each clip — that first-frame fidelity is what makes **Startframe** the most literal way to animate an image. ## Start + end frame Give FLUX 3 two stills — the frame the shot should *open* on and the frame it should *land* on — and it generates the motion that carries one into the other. Reach for this when both ends of a shot matter: a reveal that has to resolve on a specific composition, a transformation with a defined before and after, or a loop that must return to where it began. Keep the two frames related — same subject, scene, or camera setup — so the interpolation has a plausible path between them. The wider the gap between start and end, the more freedom (and unpredictability) you hand the model. ### Examples Each example shows the two input frames — the **start** and the **end** — followed by the clip FLUX 3 generated to bridge them.
Start frame — city skyline by day

Start frame

End frame — city skyline at night

End frame

Start frame — blue and red ink

Start frame

End frame — magenta and violet ink

End frame

## Keyframes Pass several stills as ordered waypoints and FLUX 3 interpolates a single continuous shot that moves through each one in turn. Where **Start + end frame** pins only the two ends, keyframes let you choreograph the moments in between — hit this pose, then this composition, then this one — while the model handles the motion connecting them. Order matters: the frames are read as a timeline from first to last. Space them so each transition is achievable, and keep the look consistent across frames so the shot reads as one take rather than a series of cuts. ### Examples Each example shows the ordered keyframes pinned along a 5-second clip (`[[0, …], [2.5, …], [5, …]]`) followed by the shot FLUX 3 interpolated through them.
Keyframe 1 — magenta aurora

Keyframe 1 — 0s

Keyframe 2 — teal aurora

Keyframe 2 — 2.5s

Keyframe 3 — green aurora

Keyframe 3 — 5s

Keyframe 1 — choppy sea

Keyframe 1 — 0s

Keyframe 2 — cresting wave

Keyframe 2 — 2.5s

Keyframe 3 — stormy spray

Keyframe 3 — 5s

Keyframe 1 — city by day

Keyframe 1 — 0s

Keyframe 2 — moonrise over the city

Keyframe 2 — 2.5s

Keyframe 3 — city at night

Keyframe 3 — 5s

## Related pages Workflow selection and the broader FLUX 3 video prompting framework. Generate a shot from a text prompt when you don't need a fixed first frame. Reusable framing, angle, movement, and focus phrasing for your prompts. Modes, examples, and workflow breakdowns for FLUX 3 video. # Video Generation with FLUX Source: https://docs.bfl.ml/guides/prompting_video_overview Learn how to prompt FLUX 3 for text-to-video, image-to-video, clip extension, and video editing workflows FLUX 3 supports different Modes based on your Usecase. This Page will give you an Overview about the different Modes and their Capabilites. ## Choose the right workflow
Workflow Mode Jump Best for
Text-to-Video t2v Jump to section → Generating a new scene from scratch
Image-to-Video i2v Jump to section → Animating a still image
Keyframes i2v Jump to section → Choreograph a shot through ordered frames
Video Continuation v2v Jump to section → Extend existing Clips
Video Editing Soon
Omni Reference Soon
## **Text-to-Video** Describe the shot; FLUX 3 turns the prompt into a clip. Examples:
## **Image-to-Video** Start from a still image and describe how it should move. The source image sets the first frame; the prompt drives the motion.
## **Keyframes** Pass several stills as ordered keyframes and FLUX 3 interpolates one continuous shot that moves through each in turn. Each example shows the pinned input frames, then the interpolated result.
Keyframe — Start · 0:00

Start · 0:00

Keyframe — Key 2 · 0:03

Key 2 · 0:03

Keyframe — Key 3 · 0:07

Key 3 · 0:07

Keyframe — End · 0:10

End · 0:10

Keyframe — Start

Start

Keyframe — Key 2

Key 2

Keyframe — Key 3

Key 3

Keyframe — End

End

Keyframe — Start · 0:00

Start · 0:00

Keyframe — Key 2 · 0:03

Key 2 · 0:03

Keyframe — Key 3 · 0:07

Key 3 · 0:07

Keyframe — End · 0:10

End · 0:10

Keyframe — Start · 0:00

Start · 0:00

Keyframe — Key 2 · 0:03

Key 2 · 0:03

Keyframe — Key 3 · 0:07

Key 3 · 0:07

Keyframe — End · 0:10

End · 0:10

## **Video Continuation** Feed an existing clip and continue it. The original sets the motion, subjects, and look; the prompt guides how the shot keeps unfolding without a cut. ```text wrap theme={null} A herd of African elephants walks steadily toward the camera across a dry savanna beneath a huge hazy orange sunset, the animals growing larger in frame as the sun sinks lower behind them. ``` ```text wrap theme={null} An African penguin waddles across sun-warmed granite boulders behind swaying fynbos foliage, then hops down a rock shelf and pushes on between the boulders as the handheld camera follows. ``` ```text wrap theme={null} A low ground-level view of hiking boots and trekking poles stepping across a rocky alpine ridge continues, a second hiker's boots following through the frame as the misty peak looms beyond. ``` ```text wrap theme={null} A thundering close view of massive waterfall curtains pounds on continuously, mist billowing from the plunge pool as a faint rainbow arc glimmers in and out of the drifting spray. ``` ```text wrap theme={null} A giraffe in dry scrubland, framed through soft out-of-focus branches, surveys the plain and then begins an unhurried ambling walk across the frame behind the swaying foliage. ``` ```text wrap theme={null} A dark SUV drifting across a dusty construction flat in front of unfinished high-rises swings through another wide slide toward the camera, dust boiling off its tires as it powers past. ``` ## Workflow references Learn how to prompt FLUX 3 for action, camera movement, pacing, and cleaner shot logic. Direct dialogue, voiceover, ambience, effects, music, and the shape of a voice. Reference framing, angle, composition, movement, and focus language you can reuse directly in prompts. Text-to-video, image-to-video with keyframes, video continuation, and synchronized audio. Core prompting principles that still apply before you layer in motion and camera language. Use this when your workflow depends more on reference control than on pure generation. ## What to include in a strong video prompt 1. **Subject and action**: Who or what is moving, and what exactly happens. 2. **Camera direction**: Static shot, slow push-in, handheld follow, overhead drift, or rapid pan. 3. **Scene and atmosphere**: Environment, lighting, weather, time of day, and mood. 4. **Motion qualities**: Slow, abrupt, weightless, chaotic, precise, cinematic, documentary. 5. **Continuity constraints**: What must remain stable across the clip, especially for edits or extensions. # Text-to-Video Source: https://docs.bfl.ml/guides/prompting_video_text_to_video Learn how to prompt FLUX 3 for text-to-video generation with stronger action, camera language, pacing, lighting, and scene continuity. FLUX 3 understands a wide range of prompts and turns even simple ideas into creative videos. You can prompt with a short phrase, long natural language, timestep prompting, and much more. For longer shots we recommend a format — the [prompt schema](#prompt-schema) below — but it's only one of many ways to generate FLUX 3 videos. ## Before you prompt FLUX 3 understands multiple prompting formats. Explore each one below:
```text wrap theme={null} A red fox leaping through fresh snow, telephoto. ```
```text wrap theme={null} A cozy ramen shop on a rainy Tokyo night: steam rising from the broth, neon reflections in the window puddles, the cook working calmly. The camera drifts slowly past the counter. Rain patter and quiet kitchen sounds. ```
```text wrap theme={null} SHOT ONE: wide aerial of a desert highway at dawn, a single red car speeding through. HARD CUT. SHOT TWO: interior close-up, the driver's hands drumming the wheel. HARD CUT. SHOT THREE: from the roadside, the car shrinks into the heat haze. One music bed across all three shots. ```
```text wrap theme={null} A weather presenter on camera in front of a stylized storm map, speaking to the lens: "Storm season is here — and this time, we're ready." Confident delivery, clean studio lighting. No on-screen text, no subtitles. ```
For the best results, think of your prompt as **directing a scene**, not describing a collection of objects. Clearly define what is happening, how subjects move, how the camera behaves, and the overall atmosphere. Well-structured prompts with explicit motion, intentional shot language, and a clear narrative consistently produce stronger outputs. ## Short vs long prompt FLUX 3 takes short prompts and interprets them into a full story. Giving the model more freedom can lead to surprising, fresh results; longer prompts lead to more precise ones. Experiment and find what works for your use case.

Short prompt

```text wrap theme={null} A red fox leaping through fresh snow, telephoto. ```

Long prompt

```text wrap theme={null} A cozy ramen shop on a rainy Tokyo night: steam rising from the broth, neon reflections in the window puddles, the cook working calmly. The camera drifts slowly past the counter. Rain patter and quiet kitchen sounds. ```
| | Short prompt | Long prompt | | ------------ | ------------------------------------------------------- | ----------------------------------------------------- | | **Control** | The model fills in framing, motion, and mood | You direct scene, camera, pacing, and audio | | **Best for** | Fast exploration, single clear subject, happy accidents | Specific shots, multi-element scenes, consistent look | | **Risk** | Key details may be left to chance | Over-stuffing can make motion less coherent | Start short to explore an idea, then lengthen the prompt to lock in the details that matter. Add camera, motion, and atmosphere only where they improve control. Length alone is not the goal. ## Prompt schema FLUX 3 prompts follow a simple **schema** — a handful of elements you fill in, then assemble (see [Prompt formats](#prompt-formats)). Name each one with concrete nouns and verbs the camera can actually see; vague adjectives leave the result to chance. * **Core summary** — one line stating the whole sequence: who, where, and the arc, so every later choice has context. * **Scene** — per shot: setting, light quality, and depth of field. * **Subject description** — a fixed description held identically across shots, so identity stays consistent. * **Dynamic narrative** — per shot, timecoded: the camera move and the subject's action. Camera language lives here. * **Audio** — per shot, the soundscape; FLUX 3 renders it synchronized to the frames. * **Style & color** — the global look that ties the shots together: realism level, palette anchors, and grain. For the full vocabulary of shot sizes, angles, movements, and focus, see [Examples & Cheatsheet](/guides/prompting_video_camera_terms). Assembled, the six elements make one schema — a 10-second desert crossing: ```yaml wrap theme={null} Core summary: A first-person and third-person mixed cinematic sequence follows a lone man traversing a scorching desert, from a wide dune crossing through a sandstorm, discovering an oasis, and collapsing in exhaustion before crawling toward the water. Scene: Shot 1: A vast desert landscape with rolling golden sand dunes stretching to the horizon. Harsh, bright midday sun casting sharp shadows and a heat-shimmer haze. Deep depth of field. Shot 2: The same desert, now engulfed in a violent sandstorm with swirling orange-brown dust obscuring visibility. Muted, diffused lighting, grainy particles filling the air. Shallow depth of field. Shot 3: A small oasis, a cluster of palm trees and a shallow turquoise pool surrounded by sand. Warm, golden-hour sunlight, soft and inviting. Deep depth of field. Shot 4: A close, low-angle view of the sand near the oasis's edge, water gently rippling nearby. Warm, low light with soft reflections on the water. Shallow depth of field. Subject description: A rugged traveler in a tattered, sand-colored linen tunic, a loose scarf wrapped around head and neck, leather sandals, and a worn canvas satchel. Sunburned, weathered skin; lips cracked from dehydration. Dynamic narrative: Shot 1 [0.0s-2.5s]: A wide, tracking shot follows the man trudging up a massive dune, his silhouette stark against the bright sky. Footsteps sink deep into the sand, kicking up small clouds with each labored step. Shot 2 [2.5s-5.0s]: Hard cut to first-person as the sandstorm hits. He shields his eyes with his forearm, stumbling forward blindly as gusts of sand whip across the frame, nearly knocking him off balance. Shot 3 [5.0s-7.5s]: The storm clears abruptly, revealing the oasis. A wide shot shows him breaking into a weak run toward the palm trees, his pace increasing with desperate energy. Shot 4 [7.5s-10.0s]: He collapses at the water's edge, then drags himself forward on hands and knees. The camera pushes in close as his trembling hand touches the water, sending ripples outward. Audio: Shot 1: Low, dry desert wind, faint crunching footsteps on sand, sparse ambient silence emphasizing isolation. Shot 2: Roaring, chaotic wind howl mixed with gritty sand-whipping sounds and the man's muffled, strained breathing. Shot 3: Wind fades into a gentle breeze rustling palm fronds, faint birdsong, and the man's heavy, relieved panting. Shot 4: Soft splashing water, the man's shaky exhale, a warm ambient hum fading into a peaceful silence. Style and color: Realistic, high-fidelity cinematic sequence. Warm, sun-bleached palette of ochre, amber, and sandy beige, shifting to cool teal-blue during the oasis reveal. High dynamic range holds both blown-out sun highlights and deep shadow detail; fine grain adds gritty, tactile realism to the sand and dust. ``` This schema is just one format, not a requirement. You can prompt FLUX 3 with a short phrase, long natural language, or timesteps just as well — reach for the schema when a multi-shot look and story has to hold together. ## Prompt formats Three ways to structure a prompt, from simplest to most exhaustive. Pick by how much control the shot needs. ### Natural-language one-liner The best default. A single flowing sentence with a loose, consistent shape, so you can revise one part without touching the rest: ```text theme={null} [camera] shot of [subject] [action] in [environment]. [supporting visual and motion details] ``` ### Structured / labeled fields When you need tighter control, break the prompt into labeled fields so every lever is explicit and easy to tweak in isolation: ```text theme={null} Camera shot: wide shot, low angle Subject + action: a lone rider crosses a shallow desert river Depth of field: shallow (sharp on subject, blurred background) Lighting + palette: warm backlight with soft rim — amber, cream, walnut Motion: water splashes around the horse's legs, orange dust hangs in the light Style: epic western realism ``` ### Timestep prompting For action that has to land *on time*, describe the shot as a short timeline. Keep each beat achievable — two or three for a 5-second clip. Mark a **hard cut** where the angle changes. ```text theme={null} 0.0–1.5s — locked wide of a still harbor at dawn, boats motionless on glassy water 1.5–3.0s — a slow push-in begins as gulls lift off the water 3.0–5.0s — the sun breaks the horizon, warm light spreads and the camera settles ``` Reach for the **one-liner** for quick ideas and B-roll, **labeled fields** when you're tuning specific levers, and **timestep** when the action has to hit marks in time. For a look and story that must hold across several shots, use the [**prompt schema**](#prompt-schema). ## Iterate on your ideas Iteration is an essential part of the process — your first prompt is rarely your final one, it's the starting point. Review each result and refine: add context, remove ambiguity, change the emphasis, or explore a new direction. Small adjustments can have a significant impact. Step through one example:
```text wrap theme={null} a video of a eagle ```
```text wrap theme={null} a closeup video of a eagle ```
```text wrap theme={null} a closeup video of a eagle, the eagle sits on a tree in a forrest ```
```text wrap theme={null} a cinematic closeup of an eagle perched on a pine branch in a misty forest, feathers ruffling in the wind, slow push-in, golden-hour light ```
## If you want audio FLUX 3 renders synchronized audio with video, so describe scenes that naturally imply sound — the action should make the soundscape obvious. Unmute the clip below to hear it: Scenes with footsteps, impacts, rain, engines, or crowd motion give the audio generation clearer material than abstract visual scenes. For dialogue, voiceover, sound layers, timing, and voice direction, see [Audio and speech](/guides/prompting_video_audio). ## Related pages Start here for the broader FLUX 3 video prompting framework across all workflows. Reuse framing, angle, movement, composition, and focus phrasing in your FLUX 3 prompts. See the FLUX 3 video page for modes, parameters, and use cases. Direct speech, ambience, effects, music, and the shape of a voice. Core prompt-writing principles that still apply before you direct motion. # Character & Style Consistency Source: https://docs.bfl.ml/guides/usecases_editing_character_consistency Maintaining consistent characters and styles across image edits with FLUX FLUX.2 can maintain a character's identity — face, clothing, proportions, and style — across multiple generations. This is essential for editorial shoots, storyboards, product campaigns, and any workflow where visual continuity matters. ## How It Works Character consistency in FLUX.2 relies on **multi-reference editing**. You provide one or more reference images of your character, then describe the new scene, pose, or context. FLUX.2 preserves the character's identity while adapting them to the new setting. ## Examples ### Iterative editing with consistent identity FLUX excels at maintaining character consistency even after multiple sequential edits. Starting from a single reference photo, each edit changes the scene while the character stays recognizable throughout the entire sequence. Original reference photo Object removed, character preserved Same character in new scene Same character in snow scene ### Fashion editorial — consistent characters across scenes With multi-reference editing, you can create entire editorial series with consistent characters. Provide clothing items and a scene description — FLUX.2 generates a coherent model across every shot. Multi-reference fashion editorial showing consistent characters across scenes ### Character placed in new scene Place a character from one image into a completely different setting while preserving their appearance and style. Input: street scene Input: couple Couple placed in street scene with consistent style ### Season and outfit change — same character Change the environment, weather, and clothing while keeping the character's identity intact. Woman in original scene Same woman in winter scene # Fashion Source: https://docs.bfl.ml/guides/usecases_editing_clothing_tryon Change outfits, add accessories, and recolor garments on existing photos with FLUX.2, using hex color codes for precise control. FLUX.2 can change outfits, add accessories, recolor garments, and adapt clothing styles on existing photos. Use hex color codes for precise color control and describe fabric details to preserve realism. ## Examples ### Virtual try-on from product image Black hooded jacket product shot Man wearing black hooded jacket on beach ### Full outfit change Woman in original outfit Woman in fuchsia dress ### Precise dress recoloring White lace wedding dress Sky blue lace wedding dress ### Add accessories with hex colors Woman without jacket Woman with fluffy jacket and hat ### Seasonal outfit + scene change Woman in original scene Woman in winter outfit with snow ### Fashion editorial — volcanic landscape ### Fashion editorial — gas station night # Pose & Layout Guidance Source: https://docs.bfl.ml/guides/usecases_editing_controlnets Use reference images to control pose, composition, and spatial layout in FLUX Pose and layout guidance provides structural control for image generation — using references like poses, depth maps, or edge outlines to control the composition and layout of your output. With FLUX.2, structural control is achieved through **reference images and prompt instructions**, giving you precise control over positioning, body language, and spatial arrangement. ## How Structural Guidance Works in FLUX.2 Instead of dedicated ControlNet inputs, FLUX.2 uses its multi-reference editing system to achieve structural control. You provide a reference image that shows the desired structure (a pose, a layout, or a spatial arrangement) and describe how to apply it in your prompt. FLUX.2 supports up to 8 reference images. You can combine a structural reference (for pose or layout) with other references (for style, character identity, or objects) in a single generation. ## Pose Guidance The most common form of structural control is **pose guidance** — using a reference image to dictate body position, gaze direction, and limb placement. ### Example: Match a pose from a reference image Upload a pose reference image and FLUX.2 matches it precisely — perfect for maintaining consistency across shots or recreating specific poses. Original input image Pose guidance reference image Output with matched pose ### Prompting for Pose Transfer Describe which image provides the pose and which provides the character or scene: > *"Match the exact pose from image 2 — same arm position, same body angle, same gaze direction. Use the person and clothing from image 1."* ### Tips for Pose Guidance * **Use clear pose references**: Simple poses with visible limbs work best. Avoid heavily occluded or ambiguous poses. * **Be specific about what to match**: Instead of "use the pose from image 2", say "match the arm position, stance, and head tilt from image 2". * **Combine with identity preservation**: Pair pose guidance with character consistency by explicitly referencing both the pose source and identity source. ## Layout and Composition Control Beyond poses, you can use reference images to guide the overall spatial arrangement of a scene. ### Example: Collage-based layout control You can use a single collage image to guide the spatial composition of your output. Arrange reference elements in a collage and FLUX.2 interprets the layout. Collage input with building, people, and accessories Cinematic street scene composed from collage elements Quality may be slightly lower with the collage method compared to using multiple separate input images. For best results, use individual reference images when possible. ### Example: Multi-reference structural composition Combine structural elements from multiple references — each image contributes a specific piece (shoes, clothing, accessories) and FLUX.2 assembles them into a coherent result. ### Scene Layout > *"Use the spatial layout from image 1 — same composition, same positioning of elements. Replace all objects with futuristic sci-fi versions while keeping the arrangement identical."* ### Architectural and Interior Guidance > *"Keep the room layout and furniture positioning from image 1. Change the style to mid-century modern with warm wood tones and brass fixtures."* ## Common Prompt Patterns ### Pose Transfer with Style Change > *"The person from image 1 in the exact pose from image 2. Apply a cinematic film noir style — high contrast black and white, dramatic side lighting, deep shadows."* ### Pose Transfer with Scene Change > *"Place the person from image 1 into a sun-drenched Mediterranean terrace. Match the standing pose from image 2 exactly — same weight distribution, same arm position."* ### Layout Preservation with Content Swap > *"Keep the exact spatial arrangement from image 1. Replace the person with a robot, the chair with a hovering platform, and the window view with a cityscape. Maintain all proportions and positioning."* ### Multi-Reference Structural Control > *"Use the pose from image 1, the clothing from image 2, the face from image 3, and the background from image 4. Combine them into a single coherent fashion editorial shot."* ## Best Practices * Use clean, uncluttered reference images for structural guidance * Explicitly state which image provides the structure vs. content * Combine structural references with style or identity references * Be specific about which structural elements to preserve (pose, layout, depth) * Using ambiguous or low-quality pose references * Expecting pixel-perfect structural matching — FLUX.2 interprets structure semantically * Overloading the prompt with too many structural constraints at once * Forgetting to reference images by number in your prompt For full API documentation on multi-reference editing, including how to pass multiple input images, see [FLUX.2 Image Editing](/flux_2/flux2_image_editing). For general multi-reference prompting tips, see [Multi-Reference Editing](/guides/prompting_editing_multi_reference). # Drawing to Image (Rendering) Source: https://docs.bfl.ml/guides/usecases_editing_drawing_rendering Rendering drawings into images with FLUX editing FLUX.2 can transform sketches, illustrations, and stylized art into photorealistic renders. Upload a drawing and describe the target realism level — from simple "make it realistic" to detailed material specifications. ## Examples ### Simple drawing to photo Hand drawing Photorealistic render ### Architectural illustration to photorealism Architectural illustration Photorealistic house ### Quick realism conversion Stylized image Realistic version ### 3D with real materials Stylized illustration 3D render with real materials ### Photo to pastel illustration Red-eyed tree frog photograph Pastel illustration of tree frog ### Physical material transformation Original stylized image Realistic material render # Interior Design Source: https://docs.bfl.ml/guides/usecases_editing_interior_design Use FLUX.2 to repaint walls, swap flooring, restyle rooms, and adjust lighting in existing interior photos for instant design visualization. FLUX.2 can transform interior spaces — repaint walls, swap flooring, restyle rooms, and adjust lighting. Upload a photo of a room and describe the changes for instant design visualization. ## Examples ### Repaint + new flooring Original room Room with new paint and parquet ### Retro bedroom redesign Original bedroom Retro-styled bedroom ### Retro kitchen redesign Original kitchen Retro-styled kitchen ### Wall material + lighting change Interior with original wall Interior with black stone wall ### Fill closet + add reflection Empty closet Filled closet with mirror reflection # Lighting and Weather Transformation Source: https://docs.bfl.ml/guides/usecases_editing_lighting_weather Transforming lighting and weather in images with FLUX editing FLUX.2 can shift the time of day, season, and weather conditions of any scene. Simple instructions like "Change this to Winter" work well, and you can combine multiple environmental changes in a single prompt. ## Examples ### Season change — Winter Scene in original season Winter scene ### Time of day — Night ### Holiday decoration + snow Street scene Christmas-decorated snowy street ### Snow scene Original scene Snow scene ### Dramatic weather — Tornado House in normal conditions House in tornado # Multi-Image Referencing and Compositing Source: https://docs.bfl.ml/guides/usecases_editing_multi_image_compositing Multi-image referencing and compositing with FLUX editing FLUX.2 supports up to 8 reference images, enabling powerful compositing workflows. Combine people, objects, and backgrounds from different sources into a single coherent scene. Reference each image by number in your prompt. Refer to each input as "image 1", "image 2", etc. in your prompt. Be explicit about which element comes from which image. ## Examples ### Three-image scene composition Input: bathtub Input: coffee texture Input: person Person in coffee-filled bathtub ### Style-matched couple placement Input: street scene Input: couple Couple placed in street scene ### People + background merge Input: person 1 Input: person 2 Input: background Two people composited into background ### Mix-and-match outfit from multiple images Input: shoes Input: jeans Input: sweater Woman wearing outfit from three references ### Style transfer + object compositing Input: rabbit with sunglasses Input: abstract art style Input: wine glass with grapes Rabbit with wine glass in oil painting style ### Fantasy compositing — snow globe Input: woman Input: snow globe Input: trees Woman and trees inside snow globe # Object Removal Source: https://docs.bfl.ml/guides/usecases_editing_object_removal Cleanly remove objects, watermarks, and blemishes from images with FLUX.2 image editing while seamlessly filling the surrounding background. FLUX.2 can cleanly remove objects, watermarks, blemishes, and unwanted elements from images while seamlessly filling the void. Be specific about what to remove and what to preserve. ## Examples ### Remove vegetation from statues Moss-covered statues Clean stone statues ### Remove person from scene Woman on bike in front of yellow tram Empty street with yellow tram ### Remove specific elements Image with sprinkles Sprinkles removed ### Remove person + add weather Woman on boat in Dubai Marina at sunset Person removed, rainy night scene ### Remove background element Image with unwanted background element Background element removed # Insert the Person Into a Scene Source: https://docs.bfl.ml/guides/usecases_editing_person_in_scene Inserting a person into a scene with FLUX editing FLUX.2 can populate empty spaces with realistic people — adding visitors to restaurants, students to classrooms, or individuals into architectural scenes. Describe the people, their actions, and how they interact with the environment. ## Examples ### Add visitors to restaurant Empty restaurant Restaurant with visitors ### Add person to architectural space Empty architectural space Person added to space ### Populate an auditorium Empty auditorium Auditorium with people ### Add students to classroom Empty classroom chairs Students sitting and waving # Product Consistency Source: https://docs.bfl.ml/guides/usecases_editing_product_consistency Maintaining product consistency across image edits with FLUX FLUX.2 keeps product identity intact while changing context, background, or presentation. Upload a product photo or logo and describe the new setting — the model preserves branding, labels, shapes, and materials. ## Examples ### Logo on new product Brand logo Logo on perfume bottle ### Product in new scene Product bottle Bottle in strawberry scene ### Product in aquatic setting Perfume bottle Perfume bottle in aquatic scene ### Product on retail packaging LEGO deer product LEGO deer on retail box ### Logo on merchandise Brand logo Merchandise with logo # Style Transfer Source: https://docs.bfl.ml/guides/usecases_editing_style_transfer Re-render images in different artistic mediums with FLUX.2 image editing while preserving original composition, subject, and key details. ## Transform any image into different artistic styles Style transfer lets you re-render a scene in a completely different artistic medium while preserving the original composition, subject, and key details. Style transfer with FLUX image editing ## Examples ### Oil painting with brushstrokes Original photo Oil painting style ### Pastel illustration Original photo Pastel illustration ### Charcoal and pencil drawing Original portrait Charcoal drawing ### Minimal line art Original scene Line art illustration ### Heavy impasto texture Original photo Impasto painting style # HEX Color Code Prompting Source: https://docs.bfl.ml/guides/usecases_t2i_hex_color_prompting Use hex color codes in FLUX.2 prompts for precise color matching — ideal for brand consistency, design work, and exact color control. FLUX.2 supports precise color matching using hex codes. Useful for brand consistency, design work, and any scenario where exact colors matter. Signal hex colors with keywords like "color" or "hex" followed by the code, and associate each hex value clearly with a specific object or surface. ## Basic Syntax Signal hex colors with keywords like "color" or "hex" followed by the code:
Basic hex color syntax example with blue apple illustration
Apple: #0047AB
Brand color example
Walls: #C4725A Sofa: #1B6B6F Accent: #E8A847
Sunflower with hex color prompting
Sunflower: #C92695
Liquid lucid composition with hex colors
#00FF2F #0D00FF #FF0000
## Gradient Colors Apply gradients by specifying start and end colors:
Vase with gradient colors
Start: #02eb3c End: #edfa3c Flowers: #ff0088
Round silk throw pillow with radial gradient
Center: #6A0DAD Edges: #FFD700
Panoramic sky with three horizontal gradient color zones
Upper: #1B0A3E Middle: #CF6A2E Horizon: #E8728A
Product shot with pink-to-purple-to-blue gradient backdrop
Pink: #FF0080 Violet: #7928CA Cobalt: #0070F3
Hex codes work best when clearly associated with specific objects. Vague references like "use #FF0000 somewhere" may produce inconsistent results. # Infographics Source: https://docs.bfl.ml/guides/usecases_t2i_infographics Generate clean, structured infographics with FLUX by specifying layout, content hierarchy, icons, and color palette in your prompts. FLUX can generate clean, visually appealing infographics from descriptive prompts. Specify the layout, content hierarchy, icons, and color palette to get structured visual information designs. Be explicit about the layout structure (steps, sections, columns) and visual style (minimalist, colorful, corporate). The more specific your content hierarchy, the better the result. ## Examples
Step-by-step sandwich infographic
Pistachio ice cream age infographic
CNN neural network infographic
How plants grow infographic
# JSON Structured Prompting Source: https://docs.bfl.ml/guides/usecases_t2i_json_prompting Use structured JSON prompts for precise control over complex scenes For complex scenes and production workflows, FLUX.2 interprets structured JSON prompts, giving you precise control over every aspect of your image. **When to use JSON**: * Production workflows requiring consistent structure * Automation and programmatic generation * Complex scenes with multiple subjects and relationships * When you need to iterate on specific elements independently **When natural language works better**: * Quick iterations and exploration * Simple, single-subject scenes * When prompt length isn't a concern * Creative workflows where flexibility matters FLUX.2 understands both formats equally well—choose based on your workflow needs. ## The Base Schema ```json theme={null} { "scene": "overall scene description", "subjects": [ { "description": "detailed subject description", "position": "where in frame", "action": "what they're doing" } ], "style": "artistic style", "color_palette": ["#hex1", "#hex2", "#hex3"], "lighting": "lighting description", "mood": "emotional tone", "background": "background details", "composition": "framing and layout", "camera": { "angle": "camera angle", "lens": "lens type", "depth_of_field": "focus behavior" } } ``` ## Building a Prompt Step by Step Let's build a product shot incrementally to see how each element contributes. ### Step 1: Generating a coffee mug ```json theme={null} { "scene": "Professional studio product photography setup with polished concrete surface", "subjects": [ { "description": "Minimalist ceramic coffee mug with steam rising from hot coffee inside", "pose": "Stationary on surface", "position": "Center foreground on polished concrete surface", "color_palette": ["matte black ceramic"] } ], "style": "Ultra-realistic product photography with commercial quality", "color_palette": ["matte black", "concrete gray", "soft white highlights"], "lighting": "Three-point softbox setup creating soft, diffused highlights with no harsh shadows", "mood": "Clean, professional, minimalist", "background": "Polished concrete surface with studio backdrop", "composition": "rule of thirds", "camera": { "angle": "high angle", "distance": "medium shot", "focus": "Sharp focus on steam rising from coffee and mug details", "lens-mm": 85, "f-number": "f/5.6", "ISO": 200 } } ``` ![Professional product shot of a single black coffee mug with steam](https://cdn.sanity.io/images/2gpum2i6/production/037c25d7ee0500d7f795b7fdd7d05a6c779ff5bd-1024x768.webp) ### Step 2: Adding a second mug in a different color ```json theme={null} { "scene": "Professional studio product photography setup with polished concrete surface", "subjects": [ { "description": "Minimalist ceramic coffee mug with steam rising from hot coffee inside", "pose": "Stationary on surface", "position": "Center foreground on polished concrete surface", "color_palette": ["matte black ceramic"] }, { "description": "Minimalist ceramic coffee mug, matching design to the black mug", "pose": "Stationary on surface", "position": "Right side of the black mug on polished concrete surface", "color_palette": ["matte yellow ceramic"] } ], "style": "Ultra-realistic product photography with commercial quality", "color_palette": ["matte black", "matte yellow", "concrete gray", "soft white highlights"], "lighting": "Three-point softbox setup creating soft, diffused highlights with no harsh shadows", "mood": "Clean, professional, minimalist", "background": "Polished concrete surface with studio backdrop", "composition": "rule of thirds", "camera": { "angle": "high angle", "distance": "medium shot", "focus": "Sharp focus on steam rising from coffee and both mugs in frame", "lens-mm": 85, "f-number": "f/5.6", "ISO": 200 } } ``` ![Product shot with black and yellow coffee mugs](https://cdn.sanity.io/images/2gpum2i6/production/d56be2a807b5923e15964eae6132f79bce66be22-1024x768.webp) ### Step 3: Change the color of the steam ```json theme={null} { "scene": "Professional studio product photography setup with polished concrete surface", "subjects": [ { "description": "Minimalist ceramic coffee mug with bright red steam rising from hot coffee inside", "pose": "Stationary on surface", "position": "Center foreground on polished concrete surface", "color_palette": ["matte black ceramic", "bright red steam"] }, { "description": "Minimalist ceramic coffee mug, matching design to the black mug", "pose": "Stationary on surface", "position": "Right side of the black mug on polished concrete surface", "color_palette": ["matte yellow ceramic"] } ], "style": "Ultra-realistic product photography with commercial quality", "color_palette": ["matte black", "matte yellow", "bright red", "concrete gray", "soft white highlights"], "lighting": "Three-point softbox setup creating soft, diffused highlights with no harsh shadows", "mood": "Clean, professional, minimalist", "background": "Polished concrete surface with studio backdrop", "composition": "rule of thirds", "camera": { "angle": "high angle", "distance": "medium shot", "focus": "Sharp focus on steam rising from coffee and both mugs in frame", "lens-mm": 85, "f-number": "f/5.6", "ISO": 200 } } ``` ![Product shot with black and yellow mugs, red steam rising from the black mug](https://cdn.sanity.io/images/2gpum2i6/production/50a2056e955f4f231e7968e69c3a89fd7d78270d-1024x768.webp) You can include the JSON directly in your prompt, or flatten it into natural language. FLUX.2 understands both formats. For precise brand color matching with hex codes, see [HEX Color Prompting](/guides/usecases_t2i_hex_color_prompting). # Multi-Language Prompting Source: https://docs.bfl.ml/guides/usecases_t2i_multi_language Prompt FLUX.2 in native languages for culturally authentic results FLUX.2 understands multiple languages. Prompting in the native language of the content you're creating often produces more culturally authentic results — local markets, architecture, and atmosphere are rendered with greater accuracy than with translated English prompts. Prompting in the native language of the content you're creating often produces more culturally authentic results — local markets, architecture, and atmosphere are rendered with greater accuracy. # Photorealistic Images Source: https://docs.bfl.ml/guides/usecases_t2i_photorealistic Generate photorealistic images with FLUX.2 across macro photography, cinematic landscapes, and documentary scenes using lens and lighting prompts. FLUX.2 excels at generating photorealistic images across a wide range of subjects — from macro photography to cinematic landscapes and documentary scenes. Prompt the model as if describing a real photograph: specify lens, lighting, framing, and texture details for maximum realism. To get believable photorealism, prompt the model as if a real photo is being captured in the moment. Use photography language (lens, lighting, framing) and explicitly ask for real texture (pores, wrinkles, fabric wear, imperfections). # Product Mockups Source: https://docs.bfl.ml/guides/usecases_t2i_product_mockups Creating product mockups with transparent backgrounds and label integrity using FLUX FLUX generates high-quality product photography with realistic materials, reflections, and lighting. Describe the product, surface, lighting setup, and composition to create ad-ready visuals. ## Examples
Perfume bottle in Moroccan courtyard
Black perfume bottle with volcanic backdrop
Perfume bottle on mossy rock in forest
Perfume bottle in misty forest setting
# Typography & Design Source: https://docs.bfl.ml/guides/usecases_t2i_typography_design Generate clean typography, product ads, magazine covers, and posters with FLUX.2 FLUX.2 generates readable text and clean typography for product marketing materials, magazine layouts, and posters. Describe the headline, placement, and style explicitly.
Phone advertisement
Women's Health magazine cover
White paper poster with avocado quote
Groovy retro poster with sleep quote
## Text Rendering Tips FLUX.2 can generate readable text when you describe it clearly: * **Use quotation marks**: *"The text 'OPEN' appears in red neon letters above the door"* * **Specify placement**: Where text appears relative to other elements * **Describe style**: "elegant serif typography", "bold industrial lettering", "handwritten script" * **Font size**: "large headline text", "small body copy", "medium subheading" * **Color**: Use hex codes for brand text: *"The logo text 'ACME' in color #FF5733"* # UI Mockups Source: https://docs.bfl.ml/guides/usecases_t2i_ui_mockups Generate website layouts, app interfaces, and game UI mockups with FLUX from descriptive prompts about structure and visual style. FLUX can generate website layouts, app interfaces, and game UIs directly from descriptive prompts. Describe the layout structure, content sections, and visual style to get usable design concepts. ## Examples
Catwalk cat clothing brand landing page
Retro 2003 Mediterranean food website
Holy Rollers retro website mockup
Sloth life simulation game UI
# World Knowledge Source: https://docs.bfl.ml/guides/usecases_t2i_world_knowledge Leveraging FLUX's world knowledge in image generation FLUX models encode extensive world knowledge — landmarks, architectural styles, cultural references, and geographic features. Simply name a real place or concept, and the model renders it with remarkable accuracy. ## Examples
Vik Church in Iceland at night
Sheikh Zayed Grand Mosque with child running
Mount Fuji in Ukiyo-e woodblock print style
Tibetan monk with prayer wheels
# Image Editing Source: https://docs.bfl.ml/kontext/kontext_image_editing FLUX.1 Kontext image editing model. For new projects, we recommend FLUX.2 with multi-reference support and up to 4MP output. **Looking for image editing? We recommend FLUX.2.** It offers improved editing quality, multi-reference support (up to 10 images), better text editing, and output up to 4MP. [Use FLUX.2 for editing →](/flux_2/flux2_image_editing) **FLUX.1 Kontext \[pro]** is a previous-generation model that edits images using simple text prompts. No complex workflows or fine-tuning needed. **Try it live** - Test image editing in our [playground](https://playground.bfl.ai) by uploading an image and typing what you want to change. ## Examples of Editing ### Basic Object Modifications FLUX.1 Kontext is really good at straightforward object modification, for example if we want to change the color of an object, we can prompt it. For example: `Change the car color to red` ### Iterative Editing FLUX.1 Kontext excels at character consistency, even after multiple edits. Starting from a reference picture, we can see that the character is consistent throughout the sequence. The prompts used for each edit are shown in the captions below each image. ### Text Editing FLUX.1 Kontext can directly edit text that appears in images, making it easy to update signs, posters, labels, and more without recreating the entire image. The most effective way to edit text is using quotation marks around the specific text you want to change: **Prompt Structure**: `Replace '[original text]' with '[new text]'` **Example -** We can see below where we have an input image with "Choose joy" written, and we replace "joy" with "BFL" - note the upper case format for BFL. Input image: Sign saying 'Choose joy' Output image: Sign changed to 'Choose BFL' Input image: Output image: Text replaced with 'FLUX & JOY' ### Edit Images with Annotation Boxes FLUX.1 Kontext allows using bright colored boxes as annotations for targeted local editing. Local annotated edits specifically work well for text edits that require text repositioning and resizing. Annotation boxes make referencing specific parts of the image in your prompt even more seamless. Input image: Cleaning detergent advertisement Output image: Cleaning detergent advertisement with replaced text FLUX Kontext \[pro] automatically acknowledges annotation boxes when included as part of `input_image`. In the output sample, annotation boxes are removed automatically. ## Using FLUX.1 Kontext API for Image Editing This **requires both** a **text prompt** and **an input image** to work, with the input image serving as the base that will be edited according to your prompt. To use Kontext for image editing, you'll make a request to the `/flux-kontext-pro` endpoint: ### Create Request ```bash create_request.sh theme={null} # Install `curl` and `jq`, then run: request=$(curl -X POST \ 'https://api.bfl.ai/v1/flux-kontext-pro' \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "prompt": "", "input_image": "", }') echo $request request_id=$(echo $request | jq -r .id) polling_url=$(echo $request | jq -r .polling_url) ``` ```python create_request.py theme={null} # Install `requests` (e.g. `pip install requests`) # and `Pillow` (e.g. `pip install Pillow`) import os import requests import base64 from PIL import Image from io import BytesIO # Load and encode your image # Replace "" with the path to your image file image = Image.open("") buffered = BytesIO() image.save(buffered, format="JPEG") # Or "PNG" if your image is PNG img_str = base64.b64encode(buffered.getvalue()).decode() request = requests.post( 'https://api.bfl.ai/v1/flux-kontext-pro', headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), 'Content-Type': 'application/json', }, json={ 'prompt': '', 'input_image': img_str, }, ).json() print(request) request_id = request["id"] polling_url = request["polling_url"] # Use this URL for polling ``` A successful response will be a JSON object containing the request's `id`, that will be used to retrieve the actual result. ### Poll for Result After submitting a request, you need to poll using the returned `polling_url` to retrieve the output when ready. ```bash poll_result.sh theme={null} while true; do sleep 0.5 result=$(curl -s -X 'GET' \ "${polling_url}" \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}") status=$(echo $result | jq -r .status) echo "Status: $status" if [ "$status" == "Ready" ]; then echo "Result: $(echo $result | jq -r .result.sample)" break elif [ "$status" == "Error" ] || [ "$status" == "Failed" ]; then echo "Generation failed: $result" break fi done ``` ```python poll_result.py theme={null} # This assumes that the `polling_url` variable is set. import time import os import requests while True: time.sleep(0.5) result = requests.get( polling_url, headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), }, ).json() if result['status'] == 'Ready': print(f"Image ready: {result['result']['sample']}") break elif result['status'] in ['Error', 'Failed']: print(f"Generation failed: {result}") break ``` A successful response will be a JSON object containing the result, and `result['sample']` is a signed URL for retrieval. Our signed URLs are only valid for 10 minutes. Please retrieve your result within this timeframe. ### FLUX.1 Kontext Image Editing Parameters For image editing, FLUX.1 Kontext tries to match the input image dimensions as closely as possible (rounded to multiples of 32). Use `aspect_ratio` to override this behavior if needed. * **Supported Range**: Aspect ratios can range from 3:7 (portrait) to 7:3 (landscape). List of FLUX.1 Kontext parameters for image editing via the `/flux-kontext-pro` endpoint: | Parameter | Type | Default | Description | Required | | ------------------- | -------------- | -------- | -------------------------------------------------------------------------------------------------- | -------- | | `prompt` | string | | Text description of the edit to be applied. | **Yes** | | `input_image` | string | | Base64 encoded image or URL of image to use as reference. Supports up to 20MB or 20 megapixels. | **Yes** | | `aspect_ratio` | string / null | `"1:1"` | Desired aspect ratio (e.g., "16:9"). All outputs are \~1MP total. Supports ratios from 3:7 to 7:3. | No | | `seed` | integer / null | `null` | Seed for reproducibility. If `null` or omitted, a random seed is used. Accepts any integer. | No | | `prompt_upsampling` | boolean | `false` | If true, performs upsampling on the prompt | No | | `safety_tolerance` | integer | `2` | Moderation level for inputs and outputs. Value ranges from 0 (most strict) to 6 (more permissive). | No | | `output_format` | string | `"jpeg"` | Desired format of the output image. Can be "jpeg" or "png". | No | | `webhook_url` | string / null | `null` | URL for asynchronous completion notification. Must be a valid HTTP/HTTPS URL. | No | | `webhook_secret` | string / null | `null` | Secret for webhook signature verification, sent in the `X-Webhook-Secret` header. | No | # Introduction Source: https://docs.bfl.ml/kontext/kontext_overview Overview of FLUX.1 Kontext, a model that combines text-to-image generation with context-aware image editing. For new projects, we recommend FLUX.2. **FLUX.2 is now our recommended model for image generation and editing.** It offers superior quality, multi-reference support (up to 10 images), improved text editing, and output up to 4MP. [Get started with FLUX.2 →](/flux_2/flux2_overview) **FLUX.1 Kontext \[pro]** is a previous-generation model that combines text-to-image generation with image editing. **Want to try first?** Test FLUX.1 Kontext \[pro] & \[max] in our [playground](https://playground.bfl.ai) before integrating the API. ## What Can You Do? Create stunning images from scratch using simple text prompts. FLUX.1 Kontext \[pro] delivers fast generation with strong prompt adherence. Edit specific parts of images while keeping everything else untouched using simple text prompts. Just describe what you want to change and get the results. Maintain character identity and unique features across multiple scenes and iterative edits. Replace text in signs, posters, and labels with precision while maintaining the original styling and context. Simply use quotes around the text you want to change: `Replace 'old text' with 'new text'`. Transform any image into completely different artistic styles or use reference images to apply their style to new scenes. ## Which Model to Choose? **Best Output Quality** Premium model with industry-leading results. Perfect when quality is the top priority. * Industry-leading typography * Maximum prompt adherence * Premium consistency * **\$0.08 per image** **Fast Production Ready** Best balance of speed and quality for most applications. Fast and with a unified editing and generation mode. * 5-6 seconds generation time * Unified editing & generation * Great prompt following * **\$0.04 per image** **Open Weights & Research** Perfect for local development and customization. Download the weights and run on your own infrastructure. * Editing mode only * Good for customization & fine-tuning * Open weights, non-commercial license * **Free** (commercial licensing available) **FLUX.1 Kontext \[dev]** has a non-commercial license, commercial use is possible through [licensing](https://bfl.ai/licensing). ## Getting Started **Start creating immediately** - Test Kontext \[pro] and \[max] in your browser. No setup required. Simple REST API integration with \[pro] and \[max]. **Master prompting** - Get the best results with our prompting guide. **Download & customize** - Use \[dev] weights locally, or on your own infrastructure. # Image Generation Source: https://docs.bfl.ml/kontext/kontext_text_to_image Generate images from text prompts using FLUX.1 Kontext. For new projects, we recommend FLUX.2 for text-to-image generation. **FLUX.2 is now our recommended model for image generation.** It offers superior quality, multi-reference support, and output up to 4MP. [Get started with FLUX.2 →](/flux_2/flux2_text_to_image) **FLUX.1 Kontext \[pro]** is a previous-generation model that creates images from text prompts, with capabilities for character consistency and editing. **Want to try first?** Test Kontext in our [playground](https://playground.bfl.ai) before integrating the API. ## Quick Examples **Prompts for the images above:** • **Abstract cat artwork:** "Abstract expressionist painting Pop Art and cubism early 20 century, straight lines and solids, cute cat face without body, warm colors, green, intricate details, hologram floating in space, a vibrant digital illustration, black background, flat color, 2D, strong lines." • **Robot and truck:** "A cute round rusted robot repairing a classic pickup truck, colorful, futuristic, vibrant glow, van gogh style" • **Furry elephant:** "A small furry elephant pet looks out from a cat house" • **Face paint portrait:** "A close-up of a face adorned with intricate black and blue patterns. The left side of the face is predominantly yellow, with symbols and doodles, while the right side is dark, featuring mechanical elements. The eye on the left is a striking shade of yellow, contrasting sharply with the surrounding patterns. The face is partially covered by a hooded garment, realistic style" **Prompts for the images above:** • **Rainy car scene:** "Close-up of a vintage car hood under heavy rain, droplets cascading down the deep cherry-red paint, windshield blurred with streaks of water, glowing headlights diffused through mist, reflections of crimson neon signage spelling "FLUX" dancing across the wet chrome grille, steam rising from the engine, ambient red light enveloping the scene, moody composition, shallow depth of field, monochromatic red palette, cinematic lighting with glossy textures." • **Burning temple warrior:** "A lone warrior, clad in bloodstained samurai armor, stands motionless before a massive pagoda engulfed in flames. Embers and ash swirl around him like ghosts of fallen enemies. The once-sacred temple is collapsing, its ornate carvings crumbling into the blaze as distant screams echo through the smoke-filled air. A tattered banner flutters beside him, the last symbol of a forgotten oath. The scene is both devastating and mesmerizing, with deep reds, burning oranges, and cold blue shadows creating a stark contrast. Cinematic composition, ultra-detailed textures, dynamic lighting, atmospheric fog, embers in the wind, dark fantasy realism, intense contrast." • **Foggy gas station:** "Remote gas station swallowed by crimson fog, green glow from overhead lights staining the asphalt, new tiny smart car idling with taillights cutting through the mist, vending machine humming beside cracked fuel pumps, oily puddles reflecting distorted neon, shadows stretching unnaturally long, skeletal trees barely visible in the background, wide-angle cinematic shot, deep green monochromatic palette with faint charcoal accents, backlighting and heavy atmosphere, surreal and ominous mood." • **Detective game character:** "Retro game style, man in old school suit, upper body, true detective, detailed character, night sky, crimson moon silhouette, american muscle car parked on dark street in background, complex background in style of Bill Sienkiewicz and Dave McKean and Carne Griffiths, extremely detailed, mysterious, grim, provocative, thrilling, dynamic, action-packed, fallout style, vintage, game theme, masterpiece, high contrast, stark. vivid colors, 16-bit, pixelated, textured, distressed" ## Using FLUX.1 Kontext API for Text-to-Image Generation ### Create a Request ```bash create_request.sh theme={null} # Install `curl` and `jq`, then run: # Ensure BFL_API_KEY is set # export BFL_API_KEY="your_api_key_here" request=$(curl -X POST \ 'https://api.bfl.ai/v1/flux-kontext-pro' \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}" \ -H 'Content-Type: application/json' \ -d '{ "prompt": "A small furry elephant pet looks out from a cat house", "aspect_ratio": "1:1" }') request_id=$(echo $request | jq -r .id) polling_url=$(echo $request | jq -r .polling_url) ``` ```python create_request.py theme={null} # Install `requests` (e.g. `pip install requests`) and `Pillow` (e.g. `pip install Pillow`), then run: import os import requests import time request = requests.post( 'https://api.bfl.ai/v1/flux-kontext-pro', headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), 'Content-Type': 'application/json', }, json={ 'prompt': 'A small furry elephant pet looks out from a cat house', }, ).json() print(request) request_id = request["id"] polling_url = request["polling_url"] # Use this URL for polling ``` A successful response will be a JSON object containing the request's `id`. This ID is used to retrieve the generated image. ### Poll for Result After submitting a request, you need to poll using the returned `polling_url` to retrieve the output when ready. ```bash poll_result.sh theme={null} while true; do sleep 0.5 result=$(curl -s -X 'GET' \ "${polling_url}" \ -H 'accept: application/json' \ -H "x-key: ${BFL_API_KEY}") status=$(echo $result | jq -r .status) echo "Status: $status" if [ "$status" == "Ready" ]; then echo "Result: $(echo $result | jq -r .result.sample)" break elif [ "$status" == "Error" ] || [ "$status" == "Failed" ]; then echo "Generation failed: $result" break fi done ``` ```python poll_result.py theme={null} # This assumes that the `polling_url` variable is set. import time import os import requests while True: time.sleep(0.5) result = requests.get( polling_url, headers={ 'accept': 'application/json', 'x-key': os.environ.get("BFL_API_KEY"), } ).json() if result['status'] == 'Ready': print(f"Image ready: {result['result']['sample']}") break elif result['status'] in ['Error', 'Failed']: print(f"Generation failed: {result}") break ``` A successful response will be a JSON object containing the result, and `result['sample']` is a signed URL for retrieval. Our signed URLs are only valid for 10 minutes. Please retrieve your result within this timeframe. ### FLUX.1 Kontext Text-to-Image Parameters FLUX.1 Kontext creates 1024x1024 images by default. Use `aspect_ratio` to adjust the dimensions while keeping the same total pixels. * **Supported Range**: Aspect ratios can range from 3:7 (portrait) to 7:3 (landscape). * **Default Behavior**: If `aspect_ratio` is not specified, the model defaults to 1:1 (1024x1024). | Parameter | Type | Default | Description | Required | | ------------------- | -------------- | -------- | -------------------------------------------------------------------------------------------------- | -------- | | `prompt` | string | | Text description of the desired image. | **Yes** | | `aspect_ratio` | string / null | `"1:1"` | Desired aspect ratio (e.g., "16:9"). All outputs are \~1MP total. Supports ratios from 3:7 to 7:3. | No | | `seed` | integer / null | `null` | Seed for reproducibility. If `null` or omitted, a random seed is used. Accepts any integer. | No | | `prompt_upsampling` | boolean | `false` | If true, performs upsampling on the prompt | No | | `safety_tolerance` | integer | `2` | Moderation level for inputs and outputs. Value ranges from 0 (most strict) to 6 (more permissive). | No | | `output_format` | string | `"jpeg"` | Desired format of the output image. Can be "jpeg" or "png". | No | | `webhook_url` | string / null | `null` | URL for asynchronous completion notification. Must be a valid HTTP/HTTPS URL. | No | | `webhook_secret` | string / null | `null` | Secret for webhook signature verification, sent in the `X-Webhook-Secret` header. | No | # Quick Start Source: https://docs.bfl.ml/quick_start/get_started Get started with FLUX in minutes — use the API to build and integrate directly, or connect via MCP for instant image generation inside your AI tools. Start generating images with FLUX: create an account, add credits, create an API key, and make your first call — for FLUX 3 or FLUX.2. Go to [dashboard.bfl.ai](https://dashboard.bfl.ai) and register your account. You'll need to confirm your email before logging in. When you create your account, we automatically set up: * A **Default Organization** - your workspace for managing team members and billing * A **Default Project** - where your API keys and usage are tracked **Organizations** group your team and billing. **Projects** isolate your work with separate API keys and usage tracking. Think of organizations as your company and projects as different apps or environments. Credits power all API and Playground usage. **Simple pricing:** 1 credit = \$0.01 USD **To add credits:** 1. Go to [dashboard.bfl.ai](https://dashboard.bfl.ai) 2. In your organization sidebar, navigate to **API → Credits** 3. Click **Add Credits** 4. Choose your amount and complete payment via Stripe Credits are available immediately after payment. Start with \$10-20 to experiment with different models. [Full credits & billing guide](/account_management/credits_billing) **Prefer an interactive experience?** Use our [Dashboard Quickstart](https://dashboard.bfl.ai/get-started) to create your API key and make your first call. Navigate to **API → Keys** in your project sidebar and click **Add Key**. Give it a descriptive name like "Production App" or "Testing Environment" — each key is scoped to its project. The key is shown **once**, so copy it right away, then add it to your environment: ```bash theme={null} export BFL_API_KEY="your_api_key_here" ``` Your API key is only shown once when created. Store it securely before closing the dialog and never expose it in client-side code — treat it like a password. Generation is **asynchronous**: you POST a request, get back a `polling_url`, then poll it for the finished result. Here is that first request — a FLUX 3 video from a text prompt. ```python Python theme={null} import os, requests r = requests.post( "https://api.bfl.ai/v1/flux-3-video", headers={"x-key": os.environ["BFL_API_KEY"], "Content-Type": "application/json"}, json={ "mode": "t2v", "prompt": "a fox running through dawn mist", }, ).json() print(r["polling_url"]) ``` ```bash cURL theme={null} curl -X POST https://api.bfl.ai/v1/flux-3-video \ -H "x-key: $BFL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "mode": "t2v", "prompt": "a fox running through dawn mist" }' ``` See the [image generation guide](/quick_start/generating_images) for the polling loop and full examples in Python, TypeScript, and cURL. Want to skip the code? Try our [Playground](https://playground.bfl.ai) to generate images directly in your browser. See our [full pricing page](/quick_start/pricing) for complete details or use the [pricing calculator](https://bfl.ai/pricing). Most modern MCP clients can connect to `https://mcp.bfl.ai` directly and handle the OAuth flow on their own — pick your client from the tabs below. For stdio-only or OAuth-incompatible clients (for example Hermes), use the `mcp-remote` fallback tab. It runs locally, handles the browser OAuth flow, refreshes tokens for you, and exposes FLUX as a normal stdio server.

See our [full pricing page](/quick_start/pricing) for complete details or use the [pricing calculator](https://bfl.ai/pricing).
## Next Steps Learn how to create images using our API Test models instantly without writing code Our latest and most powerful model family Get better results with effective prompts # The frontier of visual intelligence Source: https://docs.bfl.ml/quick_start/introduction FLUX models generate and edit images and video, render synchronized audio, and drive robotics. State-of-the-art quality and creative control, through one API.
Frontier Visual Intelligence artwork
## Start with FLUX 3 Our latest model family — one model, one API. Pick where you want to start. ## Choose your path Looking for **FLUX.2** or **FLUX.1 Kontext**? They're in the sidebar under their own sections. FLUX.2 remains fully supported for production image generation and editing. ## Host your own models Ready to start creating? [Try the playground](https://playground.bfl.ai) or [make your first API call](/quick_start/generating_images).
# Overview Source: https://docs.bfl.ml/quick_start/pricing Credit-based pricing for all FLUX models including FLUX 3, FLUX.2, FLUX.1, and batch requests. 1 credit equals $0.01 USD. **Simple credit-based pricing:** 1 credit = \$0.01 USD • Pay per image, or per second for video • Same price for API and Playground ## Pricing The following table shows pricing for all FLUX models and their variants: ### FLUX 3 Models (Video) FLUX 3 generates video with synchronized audio and uses **per-second pricing** — cost scales with clip length, resolution (`hd` or `fhd`), and whether you run a full render or a fast [draft](/flux_3/flux3_overview#draft-mode). | Mode | Full render | Draft | | -------------------------- | ------------------------- | -------- | | Text to Video (`t2v`) | \$0.17/s hd, \$0.29/s fhd | \$0.06/s | | Image to Video (`i2v`) | \$0.17/s hd, \$0.29/s fhd | \$0.06/s | | Video Continuation (`v2v`) | \$0.43/s hd, \$0.54/s fhd | \$0.12/s | Drafts render at `hd` and cost about a third of a full render, so you can explore variants freely and only pay full price for the shot you keep. See the [FLUX 3 overview](/flux_3/flux3_overview#specifications) for length limits and supported aspect ratios. ### FLUX Tools (Video) [FLUX Video Upscale](/flux_tools/flux_video_upscale) is priced **per output megapixel-second**: the megapixels per output frame multiplied by the output duration in seconds. | Variant | Price | | ----------------------------- | ----------------------------------- | | FLUX Video Upscale (Precise) | \$0.075 per megapixel-second¹ ² ³ ⁴ | | FLUX Video Upscale (Creative) | \$0.105 per megapixel-second¹ ² ³ ⁴ | ¹ One megapixel-second is one megapixel (1,048,576 pixels, i.e. 1024 × 1024) of output resolution for one second of output video. Charges are calculated on the delivered output's actual frame dimensions and duration: megapixels per output frame × output duration in seconds, with fractional values charged pro rata. Example: upscaling a 10-second clip to 1080p (1920 × 1080 = 1.98 megapixels) is 19.8 megapixel-seconds, i.e. \$1.48 (Precise) or \$2.08 (Creative). ² Charges are based on output only. Input resolution, upscale factor and optional prompts are not charged separately. ³ Rates apply to output at the standard frame rate of 24 frames per second. Where output at a higher frame rate is requested and supported, charges scale proportionally with frame rate (equivalently, the listed rate ÷ 24 per megapixel per frame). Supported input durations, resolutions, upscale factors and frame rates are set out in the [documentation](/flux_tools/flux_video_upscale). ⁴ Input videos up to 20 seconds. Sources longer than 20 seconds are rejected before processing; they are not truncated, and no charge applies. ### FLUX.2 Models FLUX.2 uses **megapixel-based pricing** — cost scales with output resolution. | Model | Text-to-Image | Image Editing | Best For | | ------------------ | ------------- | ------------- | -------------------------------------------- | | FLUX.2 \[klein] 4B | from \$0.014 | from \$0.014 | Real-time, high volume | | FLUX.2 \[klein] 9B | from \$0.015 | from \$0.015 | Balanced quality/speed | | FLUX.2 \[pro] | from \$0.03 | from \$0.045 | Production workflows, fast turnaround | | FLUX.2 \[max] | from \$0.07 | from \$0.07 | Highest quality, grounding search | | FLUX.2 \[flex] | from \$0.05 | from \$0.05 | Fine-grained control, typography | | FLUX.2 \[dev] | Local only | Local only | Open weights, non-commercial (no hosted API) | **Klein pricing explained:** The first megapixel costs a flat rate, then each additional MP adds to the total. For example, a 2MP image with Klein 4B costs \$0.014 + \$0.001 = \$0.015. FLUX.2 pricing varies by output resolution. Use the [pricing calculator](https://bfl.ai/pricing) for exact costs. ### Fine-tuned Endpoints (Public Beta) During public beta, fine-tuned FLUX.2 endpoints are billed at the **same rate as their base endpoints**. For example, a request to `flux-2-klein-9b-kv-finetuned` costs the same as the equivalent `flux-2-klein-9b` request at the same resolution. | Endpoint | Base Endpoint | Beta Pricing | | ------------------------------ | ----------------- | ------------ | | `flux-2-klein-9b-kv-finetuned` | `flux-2-klein-9b` | from \$0.015 | Pricing for fine-tuned endpoints may change once out of public beta. See the [LoRA inference guide](/flux_2/flux2_lora_inference) for details on how to call these endpoints. ### FLUX.1 Models (Previous Generation) | Model | Credits per Image | Price per Image | Description | | --------------------- | ----------------- | --------------- | ----------------------------------------------------------------------------------------------- | | FLUX.1 Kontext \[pro] | 4 credits | \$0.04 | Create and edit images with text and images | | FLUX.1 Kontext \[max] | 8 credits | \$0.08 | Create and edit images with text and images, maximum quality | | | | | | | FLUX1.1 \[pro] | 4 credits | \$0.04 | The standard for text-to-image generation with fast, reliable and consistently stunning results | | FLUX1.1 \[pro] Ultra | 6 credits | \$0.06 | Ultra-high-resolution image creation - with more pixels in every picture | | FLUX1.1 \[pro] Raw | 6 credits | \$0.06 | High-quality, with a genuine feel of candid photography | | FLUX.1 Fill \[pro] | 5 credits | \$0.05 | Targeted and fast text-driven image inpainting | | | | | | ## Batch Pricing **Batch requests multiply the base cost by the number of images** **Example:** FLUX.2 \[pro] batch of 4 images * Single image: from \$0.03 * Batch of 4: **from \$0.12** ## Getting Started Create account, add credits, and get API keys Start creating with our API Try our models without writing code # Release Notes Source: https://docs.bfl.ml/release-notes Latest FLUX model releases, API changes, performance upgrades, and feature announcements from Black Forest Labs. ## FLUX 3 — Video With Synchronized Audio FLUX 3 is our first video model: one model trained across image, video, and audio, generating video with synchronized sound. Available now as a preview. ### Key Features * **Up to 20 seconds at FHD** (1920 × 1088 for 16:9), 24 fps, in a single request * **Synchronized audio** — multilingual speech with strong lipsync, plus effects and ambience, generated with the frames * **Four modes on one endpoint** — text to video (`t2v`), image to video with 1–10 pinned keyframes (`i2v`), video continuation (`v2v`), and draft enhance (`draft_enhance`) * **Multiple scenes and camera angles in one generation**, with accurate in-scene text and typography ### Endpoint `POST /v1/flux-3-video` See the [FLUX 3 documentation](/flux_3/flux3_overview) to get started, and the [pricing page](/quick_start/pricing) for per-second rates. Video editing and Omni Reference with images and videos will be available soon. ## FLUX Virtual Try-On v2 — Sharper Face Preservation `vto-v2` is a new version of FLUX Virtual Try-On focused on keeping the person's identity intact, with additional gains in garment fidelity. ### Key Features * **Improved face preservation** — markedly better retention of the model's identity and facial features in the try-on result * **Better garment detail** — minor improvements to garment textures, prints, and trims * **Higher-resolution output** — inputs up to 4 Megapixels are used as-is, and the result follows the model image's resolution (up from 2 Megapixels in `vto-v1`) * **Drop-in migration** — identical request and response format to `vto-v1`; just swap the endpoint path ### Endpoint `POST /v1/flux-tools/vto-v2` `vto-v2` is now the recommended version. `vto-v1` remains available, and we recommend migrating to v2 — see the [FLUX Virtual Try-On documentation](/flux_tools/flux_vto#versions). ## FLUX Outpainting — New Fast Mode FLUX Outpainting now supports a `mode` parameter that trades quality for speed. ### Key Features * **`mode: "fast"`** — Significantly faster extension, well-suited for landscapes, backgrounds, textures, and products. Typically lower cost. * **`mode: "high"` (default)** — Unchanged highest-fidelity path; recommended when fine detail, prompt adherence, or consistency with complex source content matters. * **Same contract** — Both modes share the same request fields and response format; omit `mode` to keep the existing `high` behavior. ### Endpoint `POST /v1/flux-tools/outpainting-v1` See [Choosing a mode](/flux_tools/flux_outpainting#choosing-a-mode) in the FLUX Outpainting documentation. ## FLUX Virtual Try-On — See Any Garment On Any Person A new FLUX Tools endpoint that applies clothing to a person image while preserving their face and pose — built for interactive, low-latency applications. ### Key Features * **Flexible references** — Single garments, multi-garment outfits, and model-to-model references * **Packshot or on-model** — Accepts both flat-lay garment images and on-model imagery * **Low latency** — Optimized for fitting rooms, social filters, and interactive experiences * **Up to 2MP input** — Larger inputs auto-downscale to \~1MP ### Endpoint `POST /v1/flux-tools/vto-v1` Get started in the [FLUX Virtual Try-On documentation](/flux_tools/flux_vto), or try the [public demo](https://flux-tools.bfl.ai/virtual-try-on). ## FLUX Erase — Remove Anything, Leave No Trace A new FLUX Tools endpoint for clean, prompt-free object removal. Provide an image and a binary mask; the model removes the masked content and reconstructs the scene coherently. ### Key Features * **Broad removal scope** — Objects, people, text, watermarks, and complex compositions * **Coherent reconstruction** — Automatically matches lighting, texture, and background * **Optional edge expansion** — Cleaner results on soft-edged subjects * **No prompt required** — Just an image and a binary mask On a held-out benchmark of 198 object-removal images, FLUX Erase matches or outperforms frontier alternatives at substantially lower cost. ### Endpoint `POST /v1/flux-tools/erase-v1` Get started in the [FLUX Erase documentation](https://docs.bfl.ai/flux_tools/flux_erase), try the [public demo](https://flux-tools.bfl.ai/erase), or read the [announcement](https://bfl.ai/blog/flux-erase-remove-anything-leave-no-trace). ## FLUX Outpainting — Extend Any Image in Any Direction A new FLUX Tools endpoint that extends an image beyond its borders in a single call — no prompt required. ### Key Features * **Natural scene extension** — Carries lighting, texture, depth, and composition past the original frame * **Flexible canvas control** — Direct width / height and reference placement via `reference_offset_x` / `reference_offset_y` * **Up to 4MP output** — Production-ready resolutions for banners, social formats, and aspect-ratio changes * **No prompt needed** — The model continues the existing scene on its own ### Endpoint `POST /v1/flux-tools/outpainting-v1` Get started in the [FLUX Outpainting documentation](/flux_tools/flux_outpainting), try the [public demo](https://flux-tools.bfl.ai/outpainting), or read the [announcement](https://bfl.ai/blog/outpainting-extend-any-image-in-any-direction). ## FLUX.2 LoRA Inference — Public Beta Run your own trained LoRAs on FLUX.2 \[klein] through the BFL API. Train with the tools of your choice (AI-Toolkit, Diffusers, …), upload once in the Dashboard, then serve inference through a managed `-finetuned` endpoint — no GPUs to provision. This is a new self-serve path, separate from the FLUX.1-era Finetuning API deprecated in October 2025. ### Key Features * **Bring your own LoRA** — Upload trained LoRAs to the Dashboard, where they appear as Finetunes * **Same request shape** — Each `-finetuned` endpoint matches its base endpoint, with two added parameters: `finetune_id` and `finetune_strength` * **Six endpoints** — Covering FLUX.2 \[klein] 4B, 9B, and Base variants in FP8, plus a BF16 option * **Base-endpoint pricing during beta** — Fine-tuned requests are billed at the same rate as the underlying base endpoint ### Endpoints `POST /v1/{base_model}-finetuned`, e.g. `/v1/flux-2-klein-9b-kv-finetuned` See the [LoRA inference guide](/flux_2/flux2_lora_inference) for the full endpoint list and a worked example. ## FLUX.2 \[pro] Speed Upgrade & Preview Endpoint FLUX.2 \[pro] is now approximately **2x faster** across both text-to-image and image editing — with no quality loss and no price change. * **\~2x faster generation** — Across text-to-image and image editing workloads * **No quality loss** — On par with the original across all benchmarks * **No price change** — Faster generation at the same price * **Same API contract** — Drop-in upgrade, no code changes required ### New: `flux-2-pro-preview` Endpoint We're introducing `flux-2-pro-preview`, where our latest FLUX.2 \[pro] improvements land first. This speed upgrade is available now on `flux-2-pro-preview`, and the endpoint will continue to be updated as we ship new capabilities. The existing `flux-2-pro` endpoint remains **unchanged** as a fixed snapshot for workflows that require reproducibility. Learn more in the [Preview Endpoint documentation](/flux_2/flux2_overview#preview-endpoints). ## Webhook Payloads Now Match Polling Responses Webhook payloads are now consistent with polling responses. ### What Changed * Status field now returns `Ready` instead of `SUCCESS` ### Action Required If your webhook handler checks for `SUCCESS` status, update it to check for `Ready` instead. ## FLUX.2 \[flex] Performance Update FLUX.2 \[flex] is now up to **3x faster** while maintaining the same quality. Typography rendering, prompt adherence, and fine-grained control remain unchanged. ## FLUX.2 \[klein] Launch We're excited to announce **FLUX.2 \[klein]** — our fastest model family with **sub-second inference**. ### Key Features * **Sub-second generation** — Real-time image generation for interactive applications * **Two variants** — 4B from (\$0.014 / image) and 9B from (\$0.015 / image) models * **Runs on consumer hardware** — As little as 13GB VRAM required * **Open weights available** — 4B under Apache 2.0, 9B under FLUX Non-Commercial License ### API Endpoints * `flux-2-klein-4b` — Fastest, ideal for high-volume and local deployment * `flux-2-klein-9b` — Balanced quality and speed with 8B Qwen3 text embedder Download open weights from [Hugging Face](https://huggingface.co/black-forest-labs) or get started with the [API documentation](/flux_2/flux2_text_to_image). ## Credit Transfer You can now **transfer credits between organizations** directly from the dashboard. * Navigate to your organization's Credits page * Click "Transfer Credits" to move credits to another organization you own * Credits transfer instantly with full audit logging ## FLUX.2 \[max] Launch Introducing **FLUX.2 \[max]** — our highest quality model with groundbreaking capabilities. ### Key Features * **Maximum quality** — Highest editing consistency, strongest prompt following, and faithful style representation * **Grounding search** — Generate images grounded in real-time information from the web * **Multi-reference editing** — Combine up to 10 input images while maintaining identity * **Vast world knowledge** — Create visuals of current events, real-time weather, or historical moments ### Grounding Search Examples FLUX.2 \[max] can search the web to visualize: * Yesterday's football scores * Real-time weather in any city * Recent news events * Historical moments from specific dates and locations Try it in the [playground](https://playground.bfl.ai) or via the [API](/flux_2/flux2_text_to_image). ## Organizations & Projects We've introduced a new way to organize your teams and work with **Organizations** and **Projects**. ### What's New * **Organizations** - Create organizations to group your projects and team members. Each organization has its own billing, credits, and member management. * **Projects** - Organize your work into projects with dedicated API keys, usage tracking, and spending limits. * **Role-Based Access Control** - Invite team members with granular permissions: Administrator, Developer, Billing Manager, or Viewer. * **Project-Scoped API Keys** - API keys are now tied to specific projects for better security and tracking. * **Spending Limits** - Set daily, weekly, and monthly credit limits per project. * **Activity Logging** - Full audit trail of all organizational activity. ### For Existing Users Your account has been automatically migrated: * A "Default" organization was created with your existing credits * A "Default" project contains your existing API keys * **Your API keys continue to work** - no changes required Learn more in our [Organizations & Projects documentation](/account_management/organizations_projects). ## FLUX.2 \[pro] and \[flex] Launch Introducing the next generation of FLUX models — **FLUX.2 \[pro]** and **FLUX.2 \[flex]**. ### FLUX.2 \[pro] Production-grade image generation at scale. * **Top performance at affordable price** — High quality generation from \$0.03/MP * **Fast turnaround** — Optimized for high-volume applications * **Multi-reference editing** — Combine up to 8 input images (10 in playground) * **Photorealistic output** — Closes the gap between generated and real imagery ### FLUX.2 \[flex] Fine-grained control for precise results. * **Specialized for typography** — Best-in-class text rendering * **Adjustable parameters** — Control inference steps (up to 50) and guidance scale (1.5–10) * **Detail preservation** — Maintains small details in complex scenes * **Production workflows** — Ideal for designs requiring exact specifications ### Key Capabilities Both models support: * **Exact color control** — Specify brand colors via hex codes with precision matching * **Structured prompting** — JSON-style prompts for automated workflows * **Multi-reference editing** — Character consistency, style transfer, and pose guidance * **Up to 4MP output** — High-resolution generation at any aspect ratio Get started with the [API documentation](/flux_2/flux2_text_to_image) or try them in the [playground](https://playground.bfl.ai). ## API Deprecations - Now In Effect As of today, the Flux Pro 1.0 endpoints (`flux-pro-1.0`, `flux-pro-1.0-depth`, `flux-pro-1.0-canny`) and the Finetuning API are officially deprecated. See details in the October 3 announcement below. ## API Deprecations ### October 31, 2025 - Flux Pro 1.0 Endpoints The following endpoints will be deprecated. Migrate to [flux-pro-1.1](https://docs.bfl.ai/flux_models/flux_1_1_pro#using-flux1-1-%5Bpro%5D-api-for-text-to-image-generation) or [flux-kontext-pro](https://docs.bfl.ai/kontext/kontext_text_to_image#using-flux-1-kontext-api-for-text-to-image-generation). **Deprecated endpoints:** * `flux-pro-1.0` * `flux-pro-1.0-depth` * `flux-pro-1.0-canny` **Migration targets:** * [FLUX1.1 \[pro\] documentation](https://docs.bfl.ai/flux_models/flux_1_1_pro) * [FLUX.1 Kontext \[pro\] documentation](https://docs.bfl.ai/kontext/kontext_text_to_image) ### October 31, 2025 - Finetuning API The finetuning API will be deprecated, including all finetuning-related endpoints. **Deprecated endpoints:** * `/v1/finetune` * `flux-pro-finetuned` * `flux-pro-1.1-ultra-finetuned` * `flux-pro-1.0-depth-finetuned` * `flux-pro-1.0-canny-finetuned` * `flux-pro-1.0-fill-finetuned` No migration path available. Finetuning functionality will be discontinued.