Welcome to Sora2API
Sora2API empowers you to generate high-quality video content using advanced AI models. Whether you’re building applications, automating workflows, or creating content, our API provides simple and reliable access to AI video generation.Text to Video
Transform text prompts into stunning video content
Image to Video
Use existing images as the foundation for new video creations
Task Management
Track and monitor your generation tasks
Callback Notifications
Implement asynchronous task processing with callbacks
Authentication
All API requests require authentication using a Bearer token. Please obtain your API key from the API Key Management Page.API Base URL
Authentication Header
Quick Start Guide
Step 1: Generate Your First Video
Start with a simple text-to-video generation request:Step 2: Check Task Status
Use the returned task ID to check the generation status:Response Format
Success Response:Generation Modes
- Text to Video
- Image to Video
- Add Watermark
Generate videos from text descriptions:
Aspect Ratios
Choose the appropriate aspect ratio for your needs:Landscape
Use CasesHD videos, desktop wallpapers, horizontal viewing content
Portrait
Use CasesPhone wallpapers, short videos, vertical viewing content
Quality Options
Standard
Standard QualitySuitable for quick generation and preview, saves credits
HD
High DefinitionHigh-quality output, suitable for official releases and commercial use
Key Parameters
Text description of the desired video content. Be specific and descriptive for best results.Tips for Better Prompts:
- Include scene descriptions (e.g., “garden”, “beach”, “city street”)
- Specify subject actions (e.g., “running”, “dancing”, “flying”)
- Add atmosphere descriptions (e.g., “sunny”, “mysterious night”, “warm ambiance”)
Output video aspect ratio. Options:
landscape- Horizontal (suitable for desktop viewing)portrait- Vertical (suitable for mobile viewing)
Video quality:
standard- Standard qualityhd- High definition
Array of image URLs for image-to-video mode.Notes:
- Images must be publicly accessible URLs
- Supports common image formats (JPG, PNG, etc.)
Watermark text to display on the generated video.Note: Optional parameter, can be omitted if watermark is not needed.
Callback URL to receive task completion notifications.Recommendation: Use callbacks instead of polling in production environments for better efficiency.
Complete Workflow Example
Here’s a complete example of generating a video and waiting for completion:- JavaScript
- Python
Asynchronous Processing with Callbacks
For production applications, use callbacks instead of polling:Learn More About Callbacks
Complete guide to implementing and handling Sora2API callbacks
Best Practices
Prompt Engineering
Prompt Engineering
- Be specific and descriptive in your prompts
- Include scene, action, and atmosphere details
- Describe desired camera movements (e.g., “slow push in”, “orbit shot”)
- Test different prompt variations to find the best results
Performance Optimization
Performance Optimization
- Use callbacks instead of frequent polling
- Implement proper error handling and retry logic
- Cache results when possible
- Choose appropriate quality based on your needs
Cost Management
Cost Management
- Use standard quality for testing and preview
- Use HD option only when needed
- Monitor your credit usage regularly
- Set up usage alerts in your application
Error Handling
Error Handling
- Always check response status codes
- Use successFlag to determine actual task status
- Implement exponential backoff for retries
- Handle rate limiting gracefully
- Log errors for debugging and monitoring
Status Codes
Request processed successfully
Invalid request parameters or malformed JSON
Missing or invalid API key
Account doesn’t have enough credits for the operation
Too many requests - implement backoff strategy
Internal server error - contact support if persists
Generation Task Status
Task is currently being processed
Task completed successfully
Task creation failed
Task created successfully but generation failed
Video Storage and Retention
- Video URLs remain accessible for 15 days after generation
- Plan your workflow to download or process videos before expiration
- Consider implementing automatic download systems for production use
Next Steps
Generate Videos
Complete API reference for video generation
Callback Setup
Implement webhooks for asynchronous processing
Task Details
Query and monitor task status
Account Credits
Monitor your API usage and credits
Support
Need help? Our technical support team is here to assist you.
- Email: [email protected]
- Documentation: docs.sora2api.ai
- API Status: Check our status page for real-time API health
Ready to start generating amazing AI videos? Get your API key and begin creating today!
