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.
- Più varianti per diversi livelli di velocità / qualità
- Il model skill include documentazione, schema e note di setup
- Funziona con workflow di sviluppo app
- Le generazioni fallite non vengono addebitate
Confronta tutte le varianti API
| Variant | Billing | From | |
|---|---|---|---|
| flux-kontext-max | call | $0.100 | Visualizza → |
| flux-kontext-pro | call | $0.050 | Visualizza → |
Installa lo skill Flux Kontext per lo sviluppo di app
Carica documentazione del modello, schema, note prezzi e passaggi di setup nel tuo workspace di codice.
# 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.
Dal model skill al primo risultato in quattro passaggi
Scegli il modello
Seleziona modello e variante adatti al tipo di output, al livello qualità e alla latenza target.
Configura
Imposta la tua chiave RunAPI e installa il model skill nel workspace di codice.
Implementa
Usa le istruzioni dello skill per aggiungere la feature modello dentro la tua applicazione.
Ricevi
Interroga per task ID, usa streaming dove supportato o gestisci il callback webhook.
Che cos'è l'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.
Perché usare l'API Flux Kontext tramite RunAPI
Un’unica autenticazione, tutti i provider
Una sola chiave RunAPI sblocca l’intero catalogo. Niente account separati, niente rotazione delle chiavi per integrazione.
Prezzi e billing unificati
Prezzi per chiamata in USD, fatturati mensilmente. Le generazioni fallite non vengono addebitate.
Skill con schema
Schema tipizzati e note di setup sono inclusi nel model skill, così l'implementazione parte dal contratto corretto.
Domande frequenti
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.
Da quale variante dovrei iniziare?
Scegli la variante più economica che soddisfa il tuo livello di qualità. La maggior parte dei team inizia con la variante veloce e passa alla pro per la produzione.
C’è un piano gratuito?
I nuovi account ricevono le prime chiamate gratuite su ogni modello. Dopo, paghi per chiamata.
Trasmettete i risultati in streaming?
Dove lo streaming è disponibile, RunAPI trasmette end-to-end.
Come vengono addebitati i fallimenti?
Le generazioni non riuscite non vengono addebitate.
Gli output vengono memorizzati nella cache?
Gli output generati vengono salvati e recuperabili tramite ID del task. Gli input non vengono memorizzati nella cache.
Posso usarlo a fini commerciali?
Sì — l’uso commerciale è incluso per ogni variante, salvo che una licenza del modello lo limiti esplicitamente; in tal caso è indicato nella pagina della variante.
E i limiti di rate limit?
I rate limit per chiave scalano in base al tier di utilizzo. Vedi la pagina prezzi per i limiti aggiornati.
Dove posso segnalare problemi?
Apri un issue nel repo GitHub pubblico oppure scrivi al supporto.