Sora 2
Sora 2 transforms detailed text descriptions into stunning, dynamic videos within seconds.
API
If you're looking for an API, you can choose from your desired programming language.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import requests
import base64
# Use this function to convert an image file from the filesystem to base64
def image_file_to_base64(image_path):
with open(image_path, 'rb') as f:
image_data = f.read()
return base64.b64encode(image_data).decode('utf-8')
# Use this function to fetch an image from a URL and convert it to base64
def image_url_to_base64(image_url):
response = requests.get(image_url)
image_data = response.content
return base64.b64encode(image_data).decode('utf-8')
# Use this function to convert a list of image URLs to base64
def image_urls_to_base64(image_urls):
return [image_url_to_base64(url) for url in image_urls]
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/sora-2"
# Request payload
data = {
"prompt": "A monk meditating under a waterfall, droplets misting around, capturing tranquility amidst nature's power.",
"duration": 8,
"size": "720x1280"
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
Attributes
Define the video content with detailed or abstract descriptions. Use detailed action scenes or serene landscapes to enhance creativity.
Provide an URL to an image for reference.
Set the animation duration in seconds. Use shorter durations for quick previews and longer for detailed animations.
Allowed values:
Select the video's aspect ratio. Choose portrait for social media stories or landscape for traditional videos.
Allowed values:
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Resources to get you started
Everything you need to know to get the most out of Sora 2
# Sora 2: Effective Usage Guide
Sora 2 is an advanced text-to-video AI model designed to turn detailed text prompts into dynamic, high-quality video clips. By carefully crafting your prompt and choosing the right parameters, you can generate smooth, engaging content for social media, marketing, education, and prototyping.
## 1. Prompt Best Practices
- Be specific: describe actions, environment, lighting, and camera movement.
- Use vivid verbs: “glide,” “pan,” “zoom out,” “ripple,” “sparkle.”
- Add temporal cues: “as the sun dips below the horizon,” “over three beats,” “slow reveal.”
- Include character details: expressions, attire, interactions.
- Leverage reference images: supply an `input_reference` URL to match existing assets or styles.
Example prompt:
“A young explorer in a brass diving suit ascends from turquoise waters, light shafts rippling across the ocean floor as schools of fish scatter around her.”
## 2. Parameter Recommendations
| Parameter | Description | Suggested Value | Use Case |
|------------------|--------------------------------------------|-------------------------|-----------------------------------------------|
| prompt | Detailed scene description | Custom 2–3 sentences | Always required |
| input_reference | URL for style/content matching (optional) | `https://…/style.jpg` | Branding videos, character consistency |
| duration | Animation length in seconds | 4, 8, or 12 | Short teasers (4 s), social media (8 s), tutorials (12 s) |
| size (aspect) | Video resolution (portrait or landscape) | 720×1280 or 1280×720 | Stories/Reels (720×1280), YouTube/Ads (1280×720) |
## 3. Use Case Scenarios
1. Social Media Stories
- duration: 4 s or 8 s
- size: 720×1280
- prompt: Focus on a single highlight or moment.
- input_reference: Optional brand logo background.
2. Promotional/Marketing Videos
- duration: 8 s or 12 s
- size: 1280×720
- prompt: Showcase product interaction, key benefits, movement.
- input_reference: Product renders for style matching.
3. Educational Shorts
- duration: 12 s
- size: 1280×720
- prompt: Narrate complex topics with clear visuals and on-screen text cues.
- input_reference: Diagram images to maintain consistency.
4. Rapid Prototyping
- duration: 4 s
- size: Either aspect
- prompt: Abstract concept visuals for quick client feedback.
- input_reference: Sketches or wireframes.
## 4. Optimization Tips
- Preview with 4 s clips before committing to longer renders.
- Use an input reference to enforce brand colors, character designs, or textures.
- Adjust prompt length: 2–3 sentences balance detail and creativity.
- Monitor content safety: Sora 2’s safeguards block harmful or misleading outputs.
- Combine portrait and landscape outputs for multi-platform campaigns.
By following these guidelines, you’ll harness Sora 2’s full potential—generating consistent, visually rich videos that capture attention and tell your story.
Other Popular Models
Discover other models you might be interested in.
sdxl-img2img
SDXL Img2Img is used for text-guided image-to-image translation. This model uses the weights from Stable Diffusion to generate new images from an input image using StableDiffusionImg2ImgPipeline from diffusers

faceswap-v2
Take a picture/gif and replace the face in it with a face of your choice. You only need one image of the desired face. No dataset, no training

sdxl-inpaint
This model is capable of generating photo-realistic images given any text input, with the extra capability of inpainting the pictures by using a mask

sdxl1.0-txt2img
The SDXL model is the official upgrade to the v1.5 model. The model is released as open-source software
