qwen-bg
max-ico04
In
Out
max-ico02
Chat
max-ico03
active
FLUX.2 Edit
Its lightweight architecture enables rapid iterative workflows and high-volume editing, making it ideal for commercial and creative teams alike.
Free $1 Tokens for New Members
Text to Speech
                                        const main = async () => {
  const response = await fetch('https://api.ai.cc/v1/images/generations', {
    method: 'POST',
    headers: {
      Authorization: 'Bearer ',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      model: 'blackforestlabs/flux-2-edit',
      prompt: 'Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.',
      image_urls: [
        'https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png',
        'https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg',
      ],
    }),
  }).then((res) => res.json());

  console.log('Generation:', response);
};

main();

                                
                                        import requests


def main():
    response = requests.post(
        "https://api.ai.cc/v1/images/generations",
        headers={
            "Authorization": "Bearer ",
            "Content-Type": "application/json",
        },
        json={
            "model": "blackforestlabs/flux-2-edit",
            "prompt": "Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.",
            "image_urls": [
                "https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png",
                "https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg",
            ],
        },
    )

    response.raise_for_status()
    data = response.json()

    print("Generation:", data)


if __name__ == "__main__":
    main()
Docs

One API 300+ AI Models

Save 20% on Costs & $1 Free Tokens
  • ico01-1
    AI Playground

    Test all API models in the sandbox environment before you integrate.

    We provide more than 300 models to integrate into your app.

    copy-img02img01
qwenmax-bg
img
FLUX.2 Edit

Product Detail

💡 FLUX.2 API Overview

FLUX.2 is a state-of-the-art, high-speed image editing model engineered for professional-grade transformations without sacrificing quality. It excels in multi-reference image editing, seamlessly combining multiple input images through an efficient architecture. This enables rapid, precise, and natural language-driven edits, making complex visual modifications accessible and fast.

⚙️ Technical Specifications

  • Output Resolution: Supports up to 4 megapixels (e.g., 2048x2048 and beyond), ensuring high-fidelity outputs.
  • Input Resolution: Flexible input starting from a minimum of 64x64 pixels.
  • Multi-Reference Capability: Effortlessly handles up to 10 input images simultaneously for superior compositional coherence.
  • Architecture: Leverages latent flow matching combined with a massive 24B-parameter vision-language model (Mistral-3) and a rectified flow transformer for robust understanding of spatial and material properties.
  • Control Features: Offers adjustable inference steps and guidance scales to fine-tune the balance between speed, quality, and creative output. Includes support for hex color codes and pose control for exacting visual editing.

🚀 Performance Benchmarks

  • Generates edits significantly faster than heavier image editing models, making it ideal for tight production schedules.
  • Maintains high fidelity, adept at rendering fine image details such as fabrics, faces, hands, logos, and small objects that are often missed by other models.
FLUX.2 API in action showcasing high-quality image editing

✨ Key Features

  • Multi-Reference Editing: Maintain consistent characters, products, or styles across up to 10 images, perfect for ad variants, fashion editorials, or product mockups.
  • High-Resolution, Realistic Details: Captures textures, lighting, and subtle objects with photorealistic quality, ensuring every detail is rendered perfectly.
  • Natural Language Edits: Achieve precise image modifications controlled by natural language prompts, eliminating the need for manual masking or layering.
  • Professional Typography: Offers reliable and precise text manipulation within images, indispensable for marketing and branding requirements.

💲 FLUX.2 API Pricing

Experience FLUX.2 for only $0.0126 per Megapixel (calculated as 1 MP input + N MP output).

🎯 Use Cases

  • Creative Content Production: Ideal for advertising, including generating diverse image variants with consistent branding.
  • E-commerce Product Visualization: Create accurate product imagery with precise color and style replication.
  • Graphic Design Workflows: Streamline processes requiring precise text layout and typography edits within images.
  • Interior and Architectural Visualizations: Produce realistic material rendering for stunning architectural designs.
  • Media Production: Enable rapid iterations for style transfer, inpainting, and compositing tasks.

💻 Code Sample


# Example Python API call for FLUX.2 Image Editing
# For full documentation and more examples, visit:
# FLUX.2 Edit API Documentation

import requests
import base64

def encode_image(image_path):
    with open(image_path, "rb") as image_file:
        return base64.b64encode(image_file.read()).decode('utf-8')

# Replace with your actual API key and image paths
API_KEY = "YOUR_AIML_API_KEY"
INPUT_IMAGE_PATH = "path/to/your/input_image.jpg"
REFERENCE_IMAGE_PATH = "path/to/your/reference_image.jpg" # Optional

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

payload = {
    "model": "blackforestlabs/flux-2-edit",
    "inputs": [
        {"image": encode_image(INPUT_IMAGE_PATH), "id": "input_main"},
        # Add more inputs for multi-reference editing if needed
        {"image": encode_image(REFERENCE_IMAGE_PATH), "id": "reference_style"} 
    ],
    "text": "Change the background to a sunny beach with palm trees and add a vintage filter.",
    "output_resolution": "2048x2048",
    "control_features": {
        "guidance_scale": 7.0,
        "inference_steps": 25
    }
}

try:
    response = requests.post("YOUR_AIML_API_ENDPOINT/image.flux-edit", headers=headers, json=payload)
    response.raise_for_status() # Raise an exception for HTTP errors
    result = response.json()
    print("Edited Image URL:", result.get("output_image_url"))
except requests.exceptions.RequestException as e:
    print(f"API Request Failed: {e}")
    if response:
        print(f"Error Details: {response.text}")
            

⚖️ Comparison with Other Models

FLUX.2 vs. Stable Diffusion

FLUX.2 stands out for its rapid, user-friendly editing experience, requiring less technical complexity. It offers exceptional multi-image referencing and branding capabilities. While Stable Diffusion might demand stronger hardware, FLUX.2 is optimized for a lower computational overhead, making it more accessible.

FLUX.2 vs. Runway Gen 2

FLUX.2 specializes in static image editing, delivering rapid multi-reference and precise color control features. Runway Gen 2 is generally preferred for multimedia projects and complex generative video workflows, whereas FLUX.2 provides a focused, efficient cycle for image-specific edits.

FLUX.2 vs. DALL·E

FLUX.2 is highly specialized for high-speed, natural language-driven image editing, offering superior control over multiple references and exact color matching. It is better suited for workflows demanding iterative edits and strong brand consistency, in contrast to DALL·E's more freeform image generation approach.

❓ Frequently Asked Questions (FAQs)

Q1: What makes FLUX.2 different from other image editing models?

FLUX.2 differentiates itself with its high-speed, professional-grade transformations, robust multi-reference editing (up to 10 images), and precise natural language controls. It's optimized for efficiency and fidelity, excelling in rendering fine details and maintaining brand consistency across multiple assets.

Q2: Can FLUX.2 handle high-resolution image outputs?

Yes, absolutely. FLUX.2 supports output resolutions of up to 4 megapixels (e.g., 2048x2048 and beyond), ensuring that your edited images retain exceptional quality and detail, suitable for professional use.

Q3: How does FLUX.2 enable precise image editing?

FLUX.2 leverages a powerful 24B-parameter vision-language model and rectified flow transformer, enabling natural language prompts for precise modifications without manual masking. It also includes control features like adjustable inference steps, guidance scales, hex color codes, and pose control for exact visual manipulation.

Q4: Is FLUX.2 suitable for e-commerce and marketing content?

Definitely. Its multi-reference editing ensures consistent branding across ad variants, while high-resolution realistic details and professional typography capabilities make it perfect for e-commerce product visualization, graphic design, and marketing content requiring accurate color and style replication.

Q5: What is the pricing model for FLUX.2 API?

The FLUX.2 API is priced at $0.0126 per Megapixel. This is calculated based on the sum of 1 Megapixel for input plus N Megapixels for the output.

Learn how you can transformyour company with AICC APIs

Discover how to revolutionize your business with AICC API! Unlock powerfultools to automate processes, enhance decision-making, and personalize customer experiences.
Contact sales
api-right-1
model-bg02-1

One API
300+ AI Models

Save 20% on Costs