# Sora 2 Pro > Sora 2 Pro generates cinematic-quality videos from text and images with unmatched realism and detail. ## Overview - **Endpoint**: `https://api.segmind.com/v1/sora-2-pro` - **Model ID**: `sora-2-pro` - **Category**: Image-to-Video Generation - **Type**: Synchronous (Direct response) - **Average Cost**: $2.7328888888888887 ## Pricing | size | duration | cost | | --- | --- | --- | | 720x1280 | 4 | 1.716 | | 720x1280 | 8 | 3.432 | | 720x1280 | 12 | 5.148 | | 1280x720 | 4 | 1.716 | | 1280x720 | 8 | 3.432 | | 1280x720 | 12 | 5.148 | | 1024x1792 | 4 | 2.86 | | 1024x1792 | 8 | 5.72 | | 1024x1792 | 12 | 8.58 | | 1792x1024 | 4 | 2.86 | | 1792x1024 | 8 | 5.72 | | 1792x1024 | 12 | 8.58 | ## API Information This model uses a **synchronous response pattern**: 1. Make a POST request with your parameters 2. Receive the output directly in the response (binary for images/videos/audio, JSON for text) 3. No polling required - response is immediate ### Input Schema The API accepts the following input parameters: - **`prompt`** (`string`, _required_): Prompt Describe the scene vividly; choose action for dynamic tones or peace for calm ambiances. Example: A sorceress summoning a gentle breeze in a tranquil forest. - Default: `"A druid whispering to ancient trees under a golden sunset."` - **`input_reference`** (`File (URL)`, _optional_): Input reference Add an image URL for added visual guidance. Useful for inspiration or aligning with specific imagery. - **`duration`** (`integer | null`, _optional_): Duration Choose video length; 4s for brief intros, 12s for detailed scenes. Select based on video intent. - Default: `8` - Options: "4" (4), "8" (8), "12" (12) - **`size`** (`string | null`, _optional_): Size Adjust video dimensions; portrait suits mobile, landscape suits presentations. Choose based on target platform. - Default: `"1280x720"` - Options: "720x1280" (Portrait (720x1280)), "1280x720" (Landscape (1280x720)), "1024x1792" (Portrait (1024x1792)), "1792x1024" (Landscape (1792x1024)) **Required Parameters Example**: ```json { "prompt": "A druid whispering to ancient trees under a golden sunset." } ``` **Full Example**: ```json { "prompt": "A druid whispering to ancient trees under a golden sunset.", "input_reference": "https://example.com/image.jpg", "duration": "8", "size": "1280x720" } ``` ### Output Schema The API returns a synchronous response based on the model type: **For Image/Video/Audio Models**: - Response contains binary data (image/png, video/mp4, audio/mp3) - Content-Type header indicates the media type - Save the response body directly to a file **For Text Models**: - Response is JSON with the generated text - Structure varies by model **HTTP Response Codes**: - **200 - OK**: Request successful, output in response body - **400 - Bad Request**: Invalid parameters - **401 - Unauthorized**: Invalid or missing API key - **404 - Not Found**: Model not found - **406 - Not Acceptable**: Insufficient credits - **429 - Too Many Requests**: Rate limit exceeded - **500 - Server Error**: Internal server error ## Usage Examples ### cURL ```bash curl -X POST "https://api.segmind.com/v1/sora-2-pro" \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "A druid whispering to ancient trees under a golden sunset.", "input_reference": "https://example.com/image.jpg", "duration": "8", "size": "1280x720" }' ``` ### Python ```python import requests import json api_key = "YOUR_API_KEY" url = "https://api.segmind.com/v1/sora-2-pro" data = { "prompt": "A druid whispering to ancient trees under a golden sunset.", "input_reference": "https://example.com/image.jpg", "duration": "8", "size": "1280x720" } response = requests.post( url, json=data, headers={ 'x-api-key': api_key, 'Content-Type': 'application/json' } ) if response.status_code == 200: # For image/video/audio models, response.content contains the binary data with open('output.png', 'wb') as f: f.write(response.content) print('Generation complete, saved to output.png') else: print(f"Error: {response.status_code}") print(response.text) ``` ### JavaScript ```javascript const apiKey = 'YOUR_API_KEY'; const url = 'https://api.segmind.com/v1/sora-2-pro'; const data = { "prompt": "A druid whispering to ancient trees under a golden sunset.", "input_reference": "https://example.com/image.jpg", "duration": "8", "size": "1280x720" }; const response = await fetch(url, { method: 'POST', headers: { 'x-api-key': apiKey, 'Content-Type': 'application/json', }, body: JSON.stringify(data), }); if (response.ok) { // For image/video/audio models, response contains binary data const blob = await response.blob(); const downloadUrl = URL.createObjectURL(blob); // Create download link const a = document.createElement('a'); a.href = downloadUrl; a.download = 'output.png'; a.click(); console.log('Generation complete'); } ``` ## Additional Resources ### Documentation - [Model Playground](https://www.segmind.com/models/sora-2-pro) - [API Documentation](https://www.segmind.com/models/sora-2-pro/api) - [Pricing Details](https://www.segmind.com/models/sora-2-pro/pricing) - [Platform Documentation](https://docs.segmind.com/) ### Tags No tags available