# Qwen Image API via PiAPI Base URL: https://api.piapi.ai Auth: X-API-Key header (get your key at https://piapi.ai/workspace/key) Documentation: {{docs:qwen-image}} Models - Text-to-image: model "Qubico/qwen-image", task_type "txt2img" — $0.015 per image - Image edit: model "Qubico/qwen-image", task_type "image-edit" — $0.025 per image ## Text to Image POST /api/v1/task { "model": "Qubico/qwen-image", "task_type": "txt2img", "input": { "prompt": "A poster with the headline 'Harmony of Cultures' in English, Chinese, and Japanese", "negative_prompt": "", "seed": -1, "steps": 8, "width": 1024, "height": 1024, "flow_shift": 3 } } Parameters: width/height up to 1024 (default 1024), steps up to 16 (default 8), seed -1 = random, flow_shift 1–7 (default 3). ## Image Edit POST /api/v1/task { "model": "Qubico/qwen-image", "task_type": "image-edit", "input": { "image1": "https://example.com/source.jpg", "prompt": "Replace the English headline with 'Unity in Diversity', keep the layout", "negative_prompt": "", "seed": -1, "steps": 8, "flow_shift": 3 } } Up to 3 source images via image1 / image2 / image3. ## Get Task Result GET /api/v1/task/{task_id} Status: "pending" → "processing" → "completed" or "failed" Image URL: response.data.output.image_url (or output.image_urls[0]) ## 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