Instructions to use stabilityai/stable-video-diffusion-img2vid-xt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use stabilityai/stable-video-diffusion-img2vid-xt with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image, export_to_video # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-video-diffusion-img2vid-xt", dtype=torch.bfloat16, device_map="cuda") pipe.to("cuda") prompt = "A man with short gray hair plays a red electric guitar." image = load_image( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/guitar-man.png" ) output = pipe(image=image, prompt=prompt).frames[0] export_to_video(output, "output.mp4") - Notebooks
- Google Colab
- Kaggle
Kling 3.0 API Tutorial: 4K AI Video Generation via NexaAPI (Pay-as-you-go)
#131
by nickyni - opened
Kling 3.0 API Tutorial: Generate 4K AI Videos via NexaAPI (Pay-as-you-go)
Hey everyone! π
I just published a comprehensive tutorial on using Kling 3.0 via NexaAPI β the most cost-effective way to access Kling 3.0 without a $1,400+/month subscription.
What is Kling 3.0?
- π¬ 2K/4K Ultra-HD video generation
- π Lip-sync & advanced motion control
- π Native audio generation
- πΉ Text-to-video, image-to-video, video extension
Quick Python Example
# pip install nexaapi
from nexaapi import NexaAPI
client = NexaAPI(api_key='YOUR_API_KEY')
response = client.video.generate(
model='kling-3.0',
prompt='A cinematic drone shot over a misty mountain range at golden hour, 4K quality',
duration=5,
aspect_ratio='16:9',
motion_control='smooth',
quality='cinematic'
)
print(f'Video URL: {response.video_url}')
print(f'Generation time: {response.generation_time}s')
JavaScript Example
// npm install nexaapi
import NexaAPI from 'nexaapi';
const client = new NexaAPI({ apiKey: 'YOUR_API_KEY' });
const response = await client.video.generate({
model: 'kling-3.0',
prompt: 'A cinematic drone shot over a misty mountain range at golden hour, 4K quality',
duration: 5,
aspectRatio: '16:9',
motionControl: 'smooth',
quality: 'cinematic'
});
console.log('Video URL:', response.videoUrl);
Pricing Comparison
| Provider | Cost |
|---|---|
| Official Kling | $1,400+/month |
| NexaAPI | ~$0.05β$0.20/video |
99%+ cheaper for most use cases.
Resources
- π nexa-api.com β Get your API key
- π RapidAPI β Alternative access
- π¦ PyPI: nexaapi β
pip install nexaapi - π¦ npm: nexaapi β
npm install nexaapi - π Full Tutorial on Dev.to
Would love to hear if anyone has tried Kling 3.0 via API! What prompts are working best for you?