Ana içeriğe geç
black-forest-labs avatarı

FLUX.1 Kontext [dev] API

black-forest-labs/flux-kontext/dev

Mevcut bir görseli metin talimatıyla düzenleyin — nesneleri, tarzı, arka planı ya da metni değiştirin — fotoğrafın geri kalanı tutarlı kalsın.

düzenleme
görsel megapikseli başına 0.025

Model girdisi

Input

The edit instruction. Describe the change to apply to the source image (e.g. 'change the wooden floor to white marble') and name anything that should stay the same.

The source image to edit. Unmentioned regions are kept consistent while the described change is applied.

Min: 10 - Max: 50

Number of denoising steps. More steps can improve detail at the cost of speed.

Min: 1 - Max: 20

How strongly the result follows the edit instruction. Raise for stronger adherence; lower if the edit looks over-applied.

Output resolution. 'match_input' keeps the source image's resolution (recommended for alignment); 'auto' lets the model pick an optimal resolution matching the input aspect; or force an aspect ratio such as '16:9', '4:3', or '9:16'.

The format of the generated image.

Inference acceleration level. 'none' is highest quality; 'regular' and 'high' are progressively faster with a small quality trade-off. Does not change the price.

Random seed. The same seed, prompt, and image produce the same result.

Safety checker can only be disabled on API call

Min: 1 - Max: 4

The number of images to generate. Each generated image is billed.

You need to be logged in to run this model and view results.
Log in

Model çıktısı

Output

Loading
Generated in 11.423 seconds
Logs (1 lines)

Örnek istekler

Örnekler

Example output 1Example output 2Example output 3

FLUX.1 Kontext [dev] API

FLUX.1 Kontext [dev] is a image-to-image AI model by black-forest-labs. On ModelRunner it runs through a REST API or via MCP from any AI assistant, at $0.025 per megapixel.

POST https://queue.modelrunner.run/black-forest-labs/flux-kontext/dev

cURL

# Submit a request to the queue. Input fields go at the top level of the
# body. The optional reserved "metadata" object holds your own flat string
# tags — stored on the request, never sent to the model; filter later with
# GET https://queue.modelrunner.run/requests?metadata=<url-encoded JSON>.
curl -X POST https://queue.modelrunner.run/black-forest-labs/flux-kontext/dev \
  -H "Authorization: Key $MRUN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Repaint the car in glossy metallic teal and change the scene to a rainy neon-lit city street at night, reflections on…",
    "image_url": "https://media.modelrunner.ai/I0oucXokx5BIPjZDjvig6.png",
    "acceleration": "none",
    "output_format": "jpeg",
    "guidance_scale": 2.5,
    "resolution_mode": "match_input",
    "num_inference_steps": 28,
    "enable_safety_checker": true,
    "metadata": {
      "project": "my-project"
    }
  }'
# → { "request_id": "...", "status_url": "...", "response_url": "..." }

# Poll status_url until "COMPLETED", then fetch the result
curl "https://queue.modelrunner.run/black-forest-labs/flux-kontext/dev/requests/$REQUEST_ID/status" \
  -H "Authorization: Key $MRUN_API_KEY"
curl "https://queue.modelrunner.run/black-forest-labs/flux-kontext/dev/requests/$REQUEST_ID" \
  -H "Authorization: Key $MRUN_API_KEY"

JavaScript

import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("black-forest-labs/flux-kontext/dev", {
  input: {
    "prompt": "Repaint the car in glossy metallic teal and change the scene to a rainy neon-lit city street at night, reflections on…",
    "image_url": "https://media.modelrunner.ai/I0oucXokx5BIPjZDjvig6.png",
    "acceleration": "none",
    "output_format": "jpeg",
    "guidance_scale": 2.5,
    "resolution_mode": "match_input",
    "num_inference_steps": 28,
    "enable_safety_checker": true
  },
});
console.log(result);

Python

import os
import requests

headers = {"Authorization": f"Key {os.environ['MRUN_API_KEY']}"}

submitted = requests.post(
    "https://queue.modelrunner.run/black-forest-labs/flux-kontext/dev",
    headers=headers,
    json={
      "prompt": "Repaint the car in glossy metallic teal and change the scene to a rainy neon-lit city street at night, reflections on…",
      "image_url": "https://media.modelrunner.ai/I0oucXokx5BIPjZDjvig6.png",
      "acceleration": "none",
      "output_format": "jpeg",
      "guidance_scale": 2.5,
      "resolution_mode": "match_input",
      "num_inference_steps": 28,
      "enable_safety_checker": true
    },
).json()

# Poll submitted["status_url"] until "COMPLETED", then:
result = requests.get(submitted["response_url"], headers=headers).json()

Input parameters

Input parameters of FLUX.1 Kontext [dev]
NameTypeRequiredDescription
promptstringyesThe edit instruction. Describe the change to apply to the source image (e.g. 'change the wooden floor to white marble') and name anything that should stay the same.
image_urlstring (uri)yesThe source image to edit. Unmentioned regions are kept consistent while the described change is applied.
num_inference_stepsintegernoNumber of denoising steps. More steps can improve detail at the cost of speed. Default: 28.
guidance_scalenumbernoHow strongly the result follows the edit instruction. Raise for stronger adherence; lower if the edit looks over-applied. Default: 2.5.
resolution_modeenumnoOutput resolution. 'match_input' keeps the source image's resolution (recommended for alignment); 'auto' lets the model pick an optimal resolution matching the input aspect; or force an aspect ratio such as '16:9', '4:3', or '9:16'. One of: auto, match_input, 1:1, 16:9, 21:9, 3:2, 2:3, 4:5, 5:4, 3:4, 4:3, 9:16, 9:21. Default: "match_input".
output_formatenumnoThe format of the generated image. One of: jpeg, png. Default: "jpeg".
accelerationenumnoInference acceleration level. 'none' is highest quality; 'regular' and 'high' are progressively faster with a small quality trade-off. Does not change the price. One of: none, regular, high. Default: "none".
seedintegernoRandom seed. The same seed, prompt, and image produce the same result.
enable_safety_checkerbooleannoIf set to true, the safety checker will be enabled. Default: true.
num_imagesintegernoThe number of images to generate. Each generated image is billed. Default: 1.

Machine-readable: OpenAPI schema · llms.txt

Use FLUX.1 Kontext [dev] from Claude & Cursor (MCP)

Point Claude Code, Claude Desktop, Cursor, or any MCP client at the ModelRunner MCP server and FLUX.1 Kontext [dev] becomes a tool your assistant can call directly — it authorizes via OAuth (no API key in config) and runs this model with the run_model tool using the endpoint black-forest-labs/flux-kontext/dev.

MCP client config (Claude Desktop, Cursor)

{
  "mcpServers": {
    "modelrunner": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.modelrunner.run/mcp"]
    }
  }
}

Claude Code

claude mcp add --transport http modelrunner https://mcp.modelrunner.run/mcp

Then ask your assistant, for example: “Run black-forest-labs/flux-kontext/dev on ModelRunner to generate image”. MCP setup guide.

Model Detayları

Model Detayları

FLUX.1 Kontext [dev], verdiğiniz bir görseli düz bir dille yazılmış talimatı izleyerek düzenler. Bir kaynak fotoğraf ve değişikliği tarif eden bir prompt verirsiniz — bir nesneyi başkasıyla değiştirin, sahneyi yeniden tarzlayın, arka planı değiştirin, metni düzenleyin ya da rengi ayarlayın — ve model, bahsetmediğiniz her şeyi tutarlı tutarak görseli o düzenlemeyle yeniden üretir. Güçlü yanı, düzenlemeler boyunca korunan karakter ve sahne tutarlılığıdır: yüzler, ürünler, kompozisyon ve dokunulmayan bölgeler sıfırdan yeniden üretilmek yerine sabit kalır; böylece art arda yapılan düzenlemeler temiz biçimde birikir. Black Forest Labs imzalı açık ağırlıklı görsel düzenleme modelidir; talimata dayalı, hassas bölgesel ve bütünsel düzenlemeler için ayarlanmıştır.

## En uygun olduğu işler - Bir fotoğrafa talimatla yapılan düzenlemeler — "ahşap zemini beyaz mermer yap", "gece olsun", "soldaki kişiyi kaldır" - Öznenin kimliğini ve pozunu koruyarak bir sahneyi yeniden tarzlamak ya da yeniden aydınlatmak - Ön planı yeniden üretmeden arka planları değiştirmek ya da yeniden tarzlamak - Mevcut bir görselin içindeki metni ve tabelaları düzenlemek ya da düzeltmek - Tutarlılığın turlar boyunca korunması gereken yinelemeli, çok adımlı düzenlemeler

## Şu durumlarda başka bir model seçin - Kaynak fotoğrafınız yoksa ve yalnızca prompt’tan görsel üretmek istiyorsanız — bir text-to-image modeli kullanın - Düzenlenmiş sonucun canlandırılmasını ya da hareket etmesini istiyorsanız — bir image-to-video modeli kullanın - Yalnızca tek bir bölgenin hassas maskeli inpaint’i gerekiyorsa — özel bir inpainting modeli kullanın

## İpuçları - Değişikliği kesin biçimde tarif edin ve neyin aynı kalması gerektiğini söyleyin — Kontext bahsedilmeyen bölgeleri tutarlı tutar, dolayısıyla özgül talimatlar görselin daha azını değiştirir - Kaynak görselin boyutlarını korumak ve önce/sonra karşılaştırması için düzenlemeyi özgün görselle hizalı tutmak üzere `resolution_mode` alanını `match_input` (varsayılan) değerinde bırakın - Talimata daha güçlü uyum için `guidance_scale` değerini aralığın üst ucuna doğru yükseltin; düzenleme aşırı uygulanmış görünüyorsa düşürün

## Gelişmiş Yapılandırma - `num_inference_steps` (10–50, varsayılan 28) hız ile rafine sonuç arasında denge kurar; daha fazla adım detayı keskinleştirebilir. - `guidance_scale` (1–20, varsayılan 2.5) sonucun talimatı ne kadar güçlü izleyeceğini belirler; daha güçlü düzenleme için yükseltin. - `resolution_mode` (varsayılan `match_input`) çıktı çözünürlüğünü belirler: `match_input` kaynak boyutlarını korur, `auto` girdinin en-boy oranına en uygun çözünürlüğü modelin seçmesine bırakır; ya da `16:9`, `4:3` veya `9:16` gibi bir en-boy oranını zorlayabilirsiniz. - `acceleration` (`none`, `regular`, `high`, varsayılan `none`) kaliteden biraz ödün vererek inference’ı hızlandırır; fiyatı değiştirmez. - `output_format` `jpeg` (varsayılan) ya da `png` seçer.

ModelRunner JavaScript client ile çalıştırmak için: ```js import { modelrunner } from "@modelrunner/client";

const result = await modelrunner.subscribe("black-forest-labs/flux-kontext/dev", { input: { prompt: "Change the wooden floor to white marble.", image_url: "https://media.modelrunner.ai/OnB0a9tFqLGcUP53RQ46n.png", resolution_mode: "match_input", }, }); ```