# P-Video 2 Pro API Documentation > LLM-optimized documentation for P-Video 2 Pro. Copy into your AI assistant for integration help. ## Overview **Model ID:** `p-video-2-pro` **Type:** Video Generation **Credit Cost:** 1 credits per second (per-second by resolution: 480p: 1, 768p: 1) Pruna P-Video 2 Pro: text or image to video with generated audio, 5 to 15 seconds at 24 fps, with start and end frame control. ## Endpoint ``` POST https://pixeldojo.ai/api/v1/models/p-video-2-pro/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 | - | Text description of the video to generate. | | `image` | url | No | - | Optional first frame for image-to-video generation (jpg, jpeg, png, webp). | | `last_frame_image` | url | No | - | Optional last frame, so the clip lands on a target image. | | `duration` | integer | No | 5 | Output duration in seconds (5-15). (min: 5, max: 15) | | `resolution` | enum | No | 768p | Output resolution. Credits per second depend on resolution and mode. 480p: 1 cost, 1 speed, 2 quality. 768p: 1 cost, 1 speed, 3 quality. (Options: 480p, 768p) | | `mode` | enum | No | speed | Render tier. Credits per second: cost and speed are 1 at both resolutions, quality is 2 at 480p and 3 at 768p. (Options: quality, speed, cost) | | `aspect_ratio` | enum | No | 16:9 | Output aspect ratio. (Options: 16:9, 9:16, 4:3, 3:4, 3:2...) | | `prompt_upsampler` | enum | No | turbo | How much the model expands your prompt before generating. (Options: off, turbo, max) | | `seed` | integer | No | - | Optional integer seed for reproducible output. | ## Supported Aspect Ratios - `16:9` - `9:16` - `4:3` - `3:4` - `3:2` - `2:3` - `1:1` ## Capabilities - Text to Video - Image to Video - Audio Generation ## Quick Start ### 1. Submit a Job ```bash curl -X POST "https://pixeldojo.ai/api/v1/models/p-video-2-pro/run" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "Waves crashing on a beach at sunset", "duration": 5, "resolution": "768p", "mode": "speed", "aspect_ratio": "16:9" }' ``` **Response:** ```json { "jobId": "job_abc123...", "status": "pending", "statusUrl": "https://pixeldojo.ai/api/v1/jobs/job_abc123", "creditCost": 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": 5 } ``` ## Python Example ```python import requests import time API_KEY = "YOUR_API_KEY" # Submit job response = requests.post( "https://pixeldojo.ai/api/v1/models/p-video-2-pro/run", headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" }, json={ "prompt": "Waves crashing on a beach at sunset", "duration": 5, "resolution": "768p", "mode": "speed", "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/p-video-2-pro/run', { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ "prompt": "Waves crashing on a beach at sunset", "duration": 5, "resolution": "768p", "mode": "speed", "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) This model takes no reference images, so `@Name` of a saved character is refused (400) before anything is charged. A saved location, prop or style with a description is inserted as text. For saved characters, use a model that takes reference images, such as Nano Banana Pro or Seedream 5 for images, or Seedance 2.5 or WAN 3.0 for video. ## 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/p-video-2-pro - **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