# WAN 2.1 Video API Documentation > LLM-optimized documentation for WAN 2.1 Video. Copy into your AI assistant for integration help. ## Overview **Model ID:** `wan-2.1-video` **Type:** Video Generation **Credit Cost:** 1.5 credits per second WAN 2.1 (14B) text & image to video with LoRA support. 480p/720p, 1-5 second clips. ## Endpoint ``` POST https://pixeldojo.ai/api/v1/models/wan-2.1-video/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 | No | - | Text description of the video to generate | | `image_url` | url | No | - | Optional starting-frame image (public HTTPS URL). When set, the tool runs image-to-video; when omitted, text-to-video. | | `negative_prompt` | string | No | - | What to avoid in the video | | `resolution` | enum | No | 480p | Output resolution (Options: 480p, 720p) | | `aspect_ratio` | enum | No | 16:9 | Aspect ratio of the output video (Options: 16:9, 9:16, 1:1) | | `duration` | integer | No | 5 | Video length in seconds (1-5, clips render at 16fps) (min: 1, max: 5) | | `fast_mode` | enum | No | Balanced | Acceleration level — faster modes may reduce quality slightly (Options: Off, Balanced, Fast) | | `lora_url` | string | No | - | HuggingFace, CivitAI, or .safetensors URL for a custom LoRA | | `lora_strength` | number | No | 1 | How strongly the LoRA is applied (0 disables it) (min: 0, max: 2) | | `sample_steps` | integer | No | 30 | Number of inference steps (min: 1, max: 40) | | `sample_guide_scale` | number | No | 5 | Higher values follow the prompt more closely (min: 0, max: 10) | | `sample_shift` | number | No | 8 | Flow shift parameter for video generation (min: 1, max: 12) | | `seed` | integer | No | - | Random seed for reproducibility | ## Supported Aspect Ratios - `16:9` - `9:16` - `1:1` ## Capabilities - Text to Video - Image to Video - LoRA Support - NSFW Content ## Quick Start ### 1. Submit a Job ```bash curl -X POST "https://pixeldojo.ai/api/v1/models/wan-2.1-video/run" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "A cat doing an acrobatic dive into a swimming pool at the olympics", "duration": 5 }' ``` **Response:** ```json { "jobId": "job_abc123...", "status": "pending", "statusUrl": "https://pixeldojo.ai/api/v1/jobs/job_abc123", "creditCost": 7.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": { "video": "https://temp.pixeldojo.ai/..." }, "creditCost": 7.5 } ``` ## Python Example ```python import requests import time API_KEY = "YOUR_API_KEY" # Submit job response = requests.post( "https://pixeldojo.ai/api/v1/models/wan-2.1-video/run", headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" }, json={ "prompt": "A cat doing an acrobatic dive into a swimming pool at the olympics", "duration": 5 } ) 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/wan-2.1-video/run', { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ "prompt": "A cat doing an acrobatic dive into a swimming pool at the olympics", "duration": 5 }) }); 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); ``` ## 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 | | `rate_limited` | 429 | Too many requests | | `internal_error` | 500 | Server error | ## Links - **Full Documentation:** https://pixeldojo.ai/api-platform/wan-2.1-video - **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