Runway Gen-4.5 API Tutorial: Generate AI Videos in 3 Lines of Code (Python & JavaScript)
Runway Gen-4.5 is making waves in the AI video generation space. Developers who've seen the outputs are impressed — cinematic quality, smooth motion, excellent prompt adherence. If you're building video generation into your app, you need to know how to access it via API.
This tutorial shows you how to use the Runway Gen-4.5 API through NexaAPI — the cheapest and fastest way to access 56+ AI models including Runway's latest.
What is Runway Gen-4.5?
Runway Gen-4.5 is the latest iteration of Runway ML's text-to-video model, offering:
- Cinematic quality video generation from text prompts
- Smooth motion with improved temporal consistency
- Better prompt adherence compared to Gen-3/Gen-4
- Support for various resolutions (720p, 1080p)
- 4-16 second video clips
The model is available on Replicate as runwayml/gen-4.5, but accessing it through NexaAPI gives you better pricing and no cold start delays.
Why Use NexaAPI for Runway Gen-4.5?
| Feature | Replicate | NexaAPI |
|---|---|---|
| Cold starts | 10-60 seconds | None |
| Billing | Per-second compute | Fixed per generation |
| API consistency | Model-specific | Unified OpenAI-style |
| Models available | 1000s (fragmented) | 56+ (curated, unified) |
| Free tier | Limited | Yes, no credit card |
Quick Start: Python
# Install: pip install nexaapi
from nexaapi import NexaAPI
client = NexaAPI(api_key='YOUR_API_KEY')
# Generate a video with Runway Gen-4.5
result = client.video.generate(
model='runwayml/gen-4.5',
prompt='A cinematic aerial shot of a futuristic city at sunset, smooth camera movement',
duration=4, # seconds
width=1280,
height=720
)
print(result.video_url)
# Download or embed the video URL directly
Advanced Example: Product Demo Video
from nexaapi import NexaAPI
client = NexaAPI(api_key='YOUR_API_KEY')
# Generate a product showcase video
result = client.video.generate(
model='runwayml/gen-4.5',
prompt='A sleek smartphone rotating 360 degrees on a white pedestal, studio lighting, product photography style',
duration=6,
width=1280,
height=720
)
print(f'Video ready: {result.video_url}')
Quick Start: JavaScript
// Install: npm install nexaapi
import NexaAPI from 'nexaapi';
const client = new NexaAPI({ apiKey: 'YOUR_API_KEY' });
async function generateVideo() {
const result = await client.video.generate({
model: 'runwayml/gen-4.5',
prompt: 'A cinematic aerial shot of a futuristic city at sunset, smooth camera movement',
duration: 4,
width: 1280,
height: 720
});
console.log('Video URL:', result.videoUrl);
}
generateVideo();
Node.js with Error Handling
import NexaAPI from 'nexaapi';
const client = new NexaAPI({ apiKey: process.env.NEXA_API_KEY });
async function generateProductVideo(productDescription) {
try {
const result = await client.video.generate({
model: 'runwayml/gen-4.5',
prompt: `Professional product showcase video: ${productDescription}`,
duration: 5,
width: 1280,
height: 720
});
return result.videoUrl;
} catch (error) {
console.error('Video generation failed:', error.message);
throw error;
}
}
// Usage
generateProductVideo('A luxury watch with gold accents on a dark background')
.then(url => console.log('Video ready:', url));
Prompt Engineering Tips for Gen-4.5
Based on community testing, these prompt patterns work best:
- Camera movement: Specify it explicitly — "slow zoom in", "aerial shot", "tracking shot"
- Lighting: "studio lighting", "golden hour", "cinematic lighting"
- Style: "cinematic", "photorealistic", "4K quality"
- Motion: Describe what moves and how — "gentle waves", "smooth rotation"
Example prompts that work well:
"A drone flying over a misty mountain range at dawn, cinematic 4K, smooth motion""A chef preparing pasta in a professional kitchen, close-up shots, warm lighting""Abstract geometric shapes morphing and flowing, neon colors on black background"
Pricing Comparison
Runway Gen-4.5 on Replicate is billed by compute time on high-end GPUs (H100/A100). A typical 4-second video generation can cost $0.50-$2.00 on Replicate depending on queue times and hardware.
With NexaAPI, you get transparent, fixed pricing — check nexa-api.com for current rates.
Get Started Free
- 🚀 Get your free API key: nexa-api.com
- 🆓 Try on RapidAPI (free tier): rapidapi.com/user/nexaquency
- 🐍 Python SDK:
pip install nexaapi| PyPI - 📦 Node.js SDK:
npm install nexaapi| npm
Conclusion
Runway Gen-4.5 represents a significant leap in AI video quality. Whether you're building a content creation tool, a marketing platform, or experimenting with generative video, accessing it through NexaAPI gives you the simplest, most cost-effective path.
Sign up at nexa-api.com and generate your first video in under 5 minutes.
Reference: runwayml/gen-4.5 on Replicate
Top comments (0)