Flux Kontext API
In-context image editing — local edits, style transfer, and character-consistent generation.
curl -X POST https://runapi.ai/api/v1/flux_kontext/text_to_image \
-H "Authorization: Bearer $RUNAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux-kontext-max",
"prompt": "Edit this product photo: change the background to a tropical beach while keeping the product exactly the same."
}'
import { FluxKontextClient } from "@runapi.ai/flux-kontext";
const client = new FluxKontextClient();
const result = await client.textToImage.run({
model: "flux-kontext-max",
prompt: "Edit this product photo: change the background to a tropical beach while keeping the product exactly the same.",
});
<?php
require __DIR__ . "/vendor/autoload.php";
use RunApi\FluxKontext\FluxKontextClient;
$client = new FluxKontextClient();
$result = $client->textToImage->run([
'model' => 'flux-kontext-max',
'prompt' => 'Edit this product photo: change the background to a tropical beach while keeping the product exactly the same.',
]);
require "runapi/flux_kontext"
client = RunApi::FluxKontext::Client.new
result = client.text_to_image.run(
model: "flux-kontext-max",
prompt: "Edit this product photo: change the background to a tropical beach while keeping the product exactly the same."
)
npx skills add runapi-ai/flux-kontext -g
# Claude Code
claude mcp add runapi -s user -- npx -y @runapi.ai/mcp
# Codex
codex plugin install runapi-mcp@agents
# Cursor / Windsurf / VS Code
npx @runapi.ai/mcp init cursor
Flux Kontext is Black Forest Labs' in-context image editing model that applies targeted edits while preserving style, character identity, and scene composition. It excels at style transfer and maintaining visual consistency.
- Wiele wariantów dla różnych poziomów szybkości i jakości
- Model skill zawiera dokumentację, schematy i notatki setupu
- Działa z workflow kodowania aplikacji
- Nie płacisz za nieudane generacje
Porównaj wszystkie warianty API
Zainstaluj skill Flux Kontext do tworzenia aplikacji
Wczytaj dokumentację modelu, schematy, notatki cenowe i kroki setupu do workspace kodu.
# Install the model skill for app development workflows
npx skills add runapi-ai/flux-kontext -g
Install the Flux Kontext skill for this app: 1. Add runapi-ai/flux-kontext with the skills installer. 2. Load SKILL.md in this workspace. 3. Use its docs, schemas, pricing notes, and setup steps when adding model features. 4. Confirm the install path when done.
Od model skilla do pierwszego wyniku w czterech krokach
Wybierz model
Wybierz model i wariant pasujące do typu wyjścia, progu jakości i celu opóźnienia.
Konfiguracja
Ustaw klucz RunAPI i zainstaluj model skill w workspace kodu.
Implementacja
Użyj instrukcji skilla, aby dodać funkcję modelu w swojej aplikacji.
Odbiór
Odpytuj po task ID, streamuj gdy wspierane albo obsłuż callback webhook.
Czym jest API Flux Kontext?
Flux Kontext is Black Forest Labs' context-aware editing model, built on the 12B-parameter Flux architecture. Through RunAPI, both Kontext Pro and Max variants share a single key.
Dlaczego używać API Flux Kontext przez RunAPI
Jedno uwierzytelnienie, wszyscy providerzy
Jeden klucz RunAPI odblokowuje cały katalog. Bez osobnych kont i rotacji kluczy dla każdej integracji.
Ujednolicony cennik i rozliczenia
Rozliczanie za wywołanie w USD, fakturowane co miesiąc. Nieudane generacje nie są naliczane.
Skill ze schematami
Typowane schematy i notatki setupu są spakowane w model skill, więc implementacja startuje od właściwego kontraktu.
Najczęstsze pytania
What is contextual editing?
Flux Kontext edits a specific region of an image while preserving the lighting, perspective, and style of the untouched areas.
What is the difference between Pro and Max?
Pro is the standard tier for most editing tasks. Max offers higher fidelity and is suited for complex multi-element edits.
What input formats are supported?
JPEG, PNG, and WebP. Keep input images under 10 MB for optimal performance.
Can I maintain character identity across edits?
Yes — Kontext is designed to preserve character consistency when editing backgrounds, clothing, or scene elements.
How fast is generation?
Typically 3–5 seconds per image, depending on complexity and variant.
Od jakiego wariantu powinienem zacząć?
Wybierz najtańszy wariant, który spełnia Twoje wymagania jakościowe. Większość zespołów zaczyna od szybkiego wariantu, a do produkcji przechodzi na pro.
Czy jest darmowy plan?
Nowe konta otrzymują darmowe pierwsze wywołania dla każdego modelu. Później płacisz za każde wywołanie.
Czy streamujecie wyniki?
Tam, gdzie streaming jest dostępny, RunAPI streamuje end-to-end.
Jak są rozliczane nieudane próby?
Nieudane generacje nie są obciążane opłatą.
Czy wyniki są buforowane?
Wygenerowane wyniki są zapisywane i można je pobrać po ID zadania. Dane wejściowe nie są buforowane.
Czy mogę używać komercyjnie?
Tak — użycie komercyjne jest dostępne dla każdego wariantu, chyba że licencja modelu wyraźnie to ogranicza; informacja taka jest podana na stronie wariantu.
A co z limitami zapytań?
Limity na klucz rosną wraz z poziomem wykorzystania. Aktualne limity znajdziesz na stronie cennika.
Gdzie mogę zgłosić problem?
Otwórz zgłoszenie w publicznym repozytorium GitHub albo napisz do supportu.