# Qwen Image 2.1 Turbo API Documentation > LLM-optimized documentation for Qwen Image 2.1 Turbo. Copy into your AI assistant for integration help. ## Overview **Model ID:** `qwen-image-2.1-turbo` **Type:** Image Generation **Credit Cost:** 0.5 credits per image 8-step distilled checkpoint: fast native-2K images and edits ## Endpoint ``` POST https://pixeldojo.ai/api/v1/models/qwen-image-2.1-turbo/run ``` ## Authentication All requests require an API key in the Authorization header: ``` Authorization: Bearer YOUR_API_KEY ``` Get your API key: https://pixeldojo.ai/api-platform/api-keys ## Input Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `prompt` | string | Yes | - | What to generate, or the edit to make to the reference images | | `model` | enum | No | turbo | turbo (8 steps, fast) or base (40 steps, highest detail) (Options: turbo, base) | | `aspect_ratio` | enum | No | 1:1 | Output aspect ratio (Options: 1:1, 4:3, 3:4, 3:2, 2:3...) | | `resolution` | enum | No | 2k | 1k (about 1 megapixel) or 2k (about 4 megapixels, the model native size) (Options: 1k, 2k) | | `num_images` | integer | No | 1 | Images to generate (1-4) (min: 1, max: 4) | | `reference_images` | array | No | - | Up to 10 image URLs to edit or compose from (people, products, scenes) | | `negative_prompt` | string | No | - | What to avoid (base model only) | | `seed` | integer | No | - | Random seed for reproducibility | | `output_format` | enum | No | jpeg | jpeg, png (keeps transparency) or webp (Options: jpeg, png, webp) | | `lora_weights` | string | No | - | URL or array of up to 3 Qwen Image 2.1 LoRA .safetensors URLs | | `lora_scales` | number | No | - | Strength of each LoRA (0-2), a number or an array matching lora_weights | ## Supported Aspect Ratios - `1:1` - `4:3` - `3:4` - `3:2` - `2:3` - `16:9` - `9:16` ## Capabilities - Text to Image - Image to Image - LoRA Support ## Quick Start ### 1. Submit a Job ```bash curl -X POST "https://pixeldojo.ai/api/v1/models/qwen-image-2.1-turbo/run" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "A neon shop sign that reads \"OPEN LATE\", rainy night, reflections on wet pavement", "aspect_ratio": "16:9" }' ``` **Response:** ```json { "jobId": "job_abc123...", "status": "pending", "statusUrl": "https://pixeldojo.ai/api/v1/jobs/job_abc123", "creditCost": 0.5, "creditsRemaining": 95 } ``` ### 2. Poll for Results ```bash curl "https://pixeldojo.ai/api/v1/jobs/job_abc123" \ -H "Authorization: Bearer YOUR_API_KEY" ``` **Completed Response:** ```json { "jobId": "job_abc123...", "status": "completed", "output": { "images": ["https://temp.pixeldojo.ai/..."] }, "creditCost": 0.5 } ``` ## Python Example ```python import requests import time API_KEY = "YOUR_API_KEY" # Submit job response = requests.post( "https://pixeldojo.ai/api/v1/models/qwen-image-2.1-turbo/run", headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" }, json={ "prompt": "A neon shop sign that reads \"OPEN LATE\", rainy night, reflections on wet pavement", "aspect_ratio": "16:9" } ) job = response.json() job_id = job["jobId"] # Poll for completion while True: status_response = requests.get( f"https://pixeldojo.ai/api/v1/jobs/{'{job_id}'}", headers={"Authorization": f"Bearer {API_KEY}"} ) status = status_response.json() if status["status"] == "completed": print("Output:", status["output"]) break elif status["status"] == "failed": print("Error:", status.get("error")) break time.sleep(2) ``` ## JavaScript Example ```javascript const API_KEY = 'YOUR_API_KEY'; // Submit job const submitResponse = await fetch('https://pixeldojo.ai/api/v1/models/qwen-image-2.1-turbo/run', { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ "prompt": "A neon shop sign that reads \"OPEN LATE\", rainy night, reflections on wet pavement", "aspect_ratio": "16:9" }) }); const job = await submitResponse.json(); // Poll for completion const pollForResult = async (jobId) => { while (true) { const statusResponse = await fetch(`https://pixeldojo.ai/api/v1/jobs/${jobId}`, { headers: { 'Authorization': `Bearer ${API_KEY}` } }); const status = await statusResponse.json(); if (status.status === 'completed') return status.output; if (status.status === 'failed') throw new Error(status.error); await new Promise(r => setTimeout(r, 2000)); } }; const output = await pollForResult(job.jobId); console.log('Output:', output); ``` ## Use Saved Characters (@Name) Write `@Name` in the prompt to use a character, product, outfit, location, prop or style saved in the account's Character Studio, for example `"@Mara on a beach at sunset"`. Its photos are added to `reference_images` automatically, after any images you send yourself, so your own image numbering is unchanged. List saved names with `GET /api/v1/characters` and save new ones with `POST /api/v1/characters`. An `@word` that names nothing saved stays plain text. ## Error Codes | Code | Status | Description | |------|--------|-------------| | `unauthorized` | 401 | Invalid or missing API key | | `insufficient_credits` | 402 | Not enough credits | | `invalid_request` | 400 | Invalid parameters | | `model_not_found` | 404 | Model ID not found | | `internal_error` | 500 | Server error | ## Links - **Full Documentation:** https://pixeldojo.ai/api-platform/qwen-image-2.1-turbo - **API Keys:** https://pixeldojo.ai/api-platform/api-keys - **Buy Credits:** https://pixeldojo.ai/api-platform/buy-credits - **All Models:** https://pixeldojo.ai/api/v1/models - **OpenAPI Spec:** https://pixeldojo.ai/api/openapi