# Flux Kontext API via PiAPI Base URL: https://api.piapi.ai Auth: X-API-KEY header (get your key at https://piapi.ai/workspace/key) Documentation: https://piapi.ai/docs/flux-api/kontext ## What it is Flux Kontext is Black Forest Labs' image-to-image editing model: it edits an input image from a natural-language instruction (style transfer, object / color changes, background replacement, text replacement, and more). ## Model & Pricing - model: Qubico/flux1-dev-advanced, task_type: kontext — $0.02/image. Pay only for successful generations; full commercial use rights. ## Edit an Image POST /api/v1/task { "model": "Qubico/flux1-dev-advanced", "task_type": "kontext", "input": { "prompt": "Change the car color to red.", "image": "https://example.com/input.png", "width": 1024, "height": 1024, "steps": 28, "seed": -1 } } input.image: URL or base64 string (required, under 10MB; JPEG/PNG/WebP). steps: optional, default 28, max 40. seed: optional, -1 = random. Optional webhook: config.webhook_config.endpoint + secret (https://piapi.ai/docs/unified-webhook). ## Get Task Result GET /api/v1/task/{task_id} Status: "pending" → "processing" → "completed" or "failed" Image URL: response.data.output.image_url Failed calls are not charged. ## Quick Start 1. Get API key: https://piapi.ai/workspace/key 2. Top up: https://piapi.ai/workspace/billing 3. POST /api/v1/task with your image URL + edit prompt 4. Poll GET /api/v1/task/{task_id} until "completed" 5. Get the edited image from response.data.output.image_url