Hurry! 1M Free Tokens Waiting for You – Register Today!

  • Home
  • Models
    • Suno v4.5
    • GPT-image-1 API
    • GPT-4.1 API
    • Qwen 3 API
    • Grok-3-Mini
    • Llama 4 API
    • GPT-4o API
    • GPT-4.5 API
    • Claude 3.7-Sonnet API
    • Grok 3 API
    • DeepSeek R1 API
    • Gemini2.5 pro
    • Runway Gen-3 Alpha API
    • FLUX 1.1 API
    • Kling 1.6 Pro API
    • All Models
  • Enterprise
  • Pricing
  • API Docs
  • Blog
  • Contact
Sign Up
Log in

Image Generation

Black Forest Labs

FLUX.1 Kontext API

The Flux.1 Kontext API offers a unified, RESTful and SDK-accessible interface for seamless multimodal image generation and iterative in-context editing, allowing developers to combine text and visual prompts into a single flow-matching workflow.
Get Free API Key
  • Flexible Solution
  • Constant Updates
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.cometapi.com/v1",
    api_key="<YOUR_API_KEY>",    
)

response = client.chat.completions.create(
    model="FLUX.1 Kontext",
    messages=[
        {
            "role": "system",
            "content": "You are an AI assistant who knows everything.",
        },
        {
            "role": "user",
            "content": "Tell me, why is the sky blue?"
        },
    ],
)

message = response.choices[0].message.content

print(f"Assistant: {message}")

All AI Models in One API
500+ AI Models

Free For A Limited Time! Register Now 

Get 1M Free Token Instantly!

FLUX

FLUX.1 Kontext API

The Flux.1 Kontext API offers a unified, RESTful and SDK-accessible interface for seamless multimodal image generation and iterative in-context editing, allowing developers to combine text and visual prompts into a single flow-matching workflow.

FLUX.1 Kontext is Black Forest Labs’ latest in-context generative flow matching model, designed to revolutionize how creators generate and edit images. Unlike traditional text-to-image systems, it natively accepts both text and image inputs, enabling seamless context-aware generation and precise local edits within a unified framework.

Basic Information & Features

  • Multimodal Inputs: Accepts text and image prompts simultaneously for richer context understanding.
  • Character Consistency: Maintains fidelity of subjects across multiple editing turns.
  • Local Editing: Targets specific regions without affecting the rest of the image.
  • Style Reference: Replicates existing visual styles for coherent scene generation.
  • Minimal Latency: Inference times of 3–5 seconds at 1 MP resolution, up to 8× faster than leading alternatives .

Technical Architecture

Flux.1 Kontext leverages rectified flow transformer blocks scaled to 12 billion parameters, operating in a latent space for high-fidelity outputs. It concatenates text and encoded image tokens into a unified sequence, enabling both local editing (targeted modifications) and global generation within one model . This design achieves:

  • Semantic Context Integration: Joint processing of visual and textual modalities.
  • Unified Workflow: No need for separate inpainting or text-to-image pipelines.
  • Latent-space Efficiency: Reduced memory footprint and faster inference on a variety of GPUs.

Model Versions & Availability

  • FLUX.1 Kontext [pro]: Balanced performance for iterative editing; up to an order of magnitude faster than previous state-of-the-art models.
  • FLUX.1 Kontext [max]: Prioritizes prompt fidelity, typography readability, and maximized speed.
  • FLUX.1 Kontext [dev]: A 12 B-parameter open-weight variant, currently in private beta.

Benchmark Performance

MetricFLUX.1 KontextOpenAI 4o/gpt-image-1
Prompt Adherence Rate98.7 %93.2 %
Average Generation Latency2.3 s3.1 s
Color Accuracy (ΔE₀₀)1.22.8
Multi-Scene ConsistencyHighMedium
  • Superior Prompt Following: Outperforms competitors with accurate semantic interpretation and stable stylization.
  • Reduced Artifacts: Eliminates common issues like yellow tint and banding, ensuring professional-quality outputs.

How to call FLUX.1 Kontext API from CometAPI

FLUX.1 Kontext API Pricing in CometAPI,lower than official price:

Model VariantsKontext [pro]Kontext [max]
Price in CometAPIPricing:$0.Pricing:$0.192
pay per viewpay per view
model nameflux-kontext-pro
black-forest-labs/flux-kontext-pro
flux-kontext-max;
black-forest-labs/flux-kontext-max

Required Steps

  • Log in to cometapi.com. If you are not our user yet, please register first
  • Get the access credential API key of the interface. Click “Add Token” at the API token in the personal center, get the token key: sk-xxxxx and submit.
  • Get the url of this site: https://api.cometapi.com/

Useage Methods

  1. Select the “flux-kontext-pro”or “black-forest-labs/flux-kontext-pro”endpoint to send the API request and set the request body. The request method and request body are obtained from our website API doc. Our website also provides Apifox test for your convenience.
  2. Replace <YOUR_AIMLAPI_KEY> with your actual CometAPI key from your account.
  3. Insert your question or request into the content field—this is what the model will respond to.
  4. . Process the API response to get the generated answer.

For Model lunched information in Comet API please see https://api.cometapi.com/new-model.

For Model Price information in Comet API please see https://api.cometapi.com/pricing.

Code Usage:

Method 1: black-forest-labs/flux-kontext-pro, black-forest-labs/flux-kontext-max

The above two models follow the replicate call format,Here’s a simplified example of a JSON request :

curl --location 
--request POST 'https://api.cometapi.com/replicate/v1/predictions' \
--header 'Authorization: Bearer sk-' \
--header 'Prefer: wait=10' \ 
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \ 
--header 'Content-Type: application/json' \ 
--header 'Accept: */*' \ 
--header 'Host: api.cometapi.com' \ 
--header 'Connection: keep-alive' \ 
--data-raw '{ "model": "black-forest-labs/flux-kontext-max", "input": { "prompt": "black forest gateau cake spelling out the words \"FLUX SCHNELL\", tasty, food photography, dynamic shot" } }'

Method 2: flux-kontext-pro, flux-kontext-max

The above two models follow the OpenAI chat standard call format and Calling through technical means. Here’s a simplified example of a JSON request:

curl --
location 
--request POST 'https://api.cometapi.com/v1/chat/completions' \ 
--header 'Authorization: sk-' \ 
--header 'User-Agent: Apifox/1.0.0 (https://apifox.com)' \ 
--header 'Content-Type: application/json' \ 
--header 'Accept: */*' \ 
--header 'Host: api.cometapi.com' \ 
--header 'Connection: keep-alive' \ --data-raw '{ "model": "flux-kontext-pro", "messages": [ { "role": "user", "content": "Generate a cute kitten sitting on a cloud in cartoon style" } ] }'

See Also GPT-image-1 API

Start Today

One API
Access 500+ AI Models!

Free For A Limited Time! Register Now
Get 1M Free Token Instantly!

Get Free API Key
API Docs

Related posts

Technology

What is Black Forest Labs’s Flux AI Used For?Professional Insights

2025-06-03 anna No comments yet

Flux AI has emerged as a transformative force in both creative and technical domainsIn this comprehensive article, we explore Flux AI’s core functionalities, real-world applications, recent developments, ethical considerations, and future prospects. Through a detailed examination of the latest news and industry analyses, we aim to provide a professional, in-depth understanding of what Flux AI […]

Technology

Black Forest Labs Launches FLUX.1 Kontext

2025-05-30 anna No comments yet

Black Forest Labs today unveiled FLUX.1 Kontext, a groundbreaking suite of generative flow-matching models that unites image generation and editing in a single architecture. Announced from Freiburg, Germany on May 29, 2025, FLUX.1 Kontext empowers creators, developers, and enterprises to generate, retouch, and iteratively refine images using both text and visual inputs—without any finetuning or […]

Technology

What Is Flux AI Image Generator?

2025-05-24 anna No comments yet

Flux AI Image Generator is a next-generation, AI-driven platform designed to transform textual descriptions into rich, high-fidelity images. Harnessing state-of-the-art models developed by Black Forest Labs, Flux AI offers a suite of tools that cater to creators, developers, and enterprises alike, enabling rapid prototyping, visual storytelling, and bespoke content creation. In this article, we explore […]

500+ AI Model API,All In One API. Just In CometAPI

Models API
  • GPT API
  • Suno API
  • Luma API
  • Sora API
Developer
  • Sign Up
  • API DashBoard
  • Documentation
  • Quick Start
Resources
  • Pricing
  • Enterprise
  • Blog
  • AI Model API Articles
  • Discord Community
Get in touch
  • [email protected]

© CometAPI. All Rights Reserved.   EFoxTech LLC.

  • Terms & Service
  • Privacy Policy