# FLUX.1 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/text-to-image ## Available Models - Qubico/flux1-schnell: $0.0015/image (batch_size 1–4; billed batch_size × price). Apache 2.0 — commercial use OK. - Qubico/flux1-dev: $0.015/image; super-resolution $0.015. Non-commercial license. - Qubico/flux1-dev-advanced: $0.02/image — LoRA / ControlNet / inpaint / outpaint / redux-variation / Kontext (needs Creator plan or higher for LoRA & ControlNet). Task types: txt2img, img2img, txt2img-lora, img2img-lora, fill-inpaint, fill-outpaint, redux-variation, controlnet-lora. ## Text to Image POST /api/v1/task { "model": "Qubico/flux1-schnell", "task_type": "txt2img", "input": { "prompt": "A beautiful landscape with mountains and a lake at sunrise.", "width": 1024, "height": 1024 } } width × height must be ≤ 1,048,576. Optional: negative_prompt, guidance_scale (1.5–5), batch_size (1–4, schnell only), lora_settings, control_net_settings. ## Image to Image POST /api/v1/task { "model": "Qubico/flux1-dev", "task_type": "img2img", "input": { "prompt": "Turn the boat red", "image": "https://example.com/reference.jpg", "denoise": 0.7 } } ## Get Task Result GET /api/v1/task/{task_id} Status: "pending" → "processing" → "completed" or "failed" Image URL: response.data.output.image_url ## Quick Start 1. Get API key: https://piapi.ai/workspace/key 2. Top up: https://piapi.ai/workspace/billing 3. POST /api/v1/task 4. Poll GET /api/v1/task/{task_id} until "completed" 5. Get image from response.data.output.image_url