Complete integration guide for Shopify app developers. Add AI video generation to your app with webhooks, multi-model failover, and usage-based billing.
6+ video models including Kling O3 Pro, Veo 3.1, and Seedance. Auto-failover ensures your app never goes down when a provider has issues.
Video generation takes 30-300s. Our webhook system delivers results to your Shopify app when ready — no long-polling required.
Multi-model failover means your Shopify app stays online even when upstream providers have outages. Built for merchant reliability.
Pay per generation. No monthly minimums. Perfect for Shopify apps scaling from 10 to 10,000 merchants.
// Generate product video from text
const response = await fetch('https://api.creativeai.run/v1/video/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'kling-o3-pro',
prompt: 'Elegant product showcase, slow rotation, studio lighting',
aspect_ratio: '1:1',
duration: 5,
webhook_url: 'https://your-app.shopify.com/webhooks/video-complete'
})
});
const { id } = await response.json();
// Webhook delivers result when video is ready// Shopify app webhook handler
app.post('/webhooks/video-complete', async (req, res) => {
const { id, status, output_url, error_message } = req.body;
if (status === 'completed') {
// Update Shopify product with video
await shopifyClient.put({
path: 'products/{product_id}/videos',
data: {
src: output_url,
position: 1
}
});
}
res.status(200).send('OK');
});// Automatic failover to backup models
const response = await fetch('https://api.creativeai.run/v1/video/generations', {
method: 'POST',
headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({
model: 'auto', // Let CreativeAI choose best available
prompt: 'Product demo video',
aspect_ratio: '9:16',
duration: 8,
webhook_url: 'https://your-app.shopify.com/webhooks/video'
})
});
// Response includes which model was actually used
// {"model_actual": "veo-3.1-lite", "failover_used": true}// Track usage per merchant for billing
app.post('/webhooks/video-complete', async (req, res) => {
const { id, credits, model_actual } = req.body;
// Log usage for Shopify merchant
await db.usageLogs.create({
shop_id: req.headers['x-shopify-shop-domain'],
generation_id: id,
credits_used: credits,
model: model_actual,
timestamp: new Date()
});
// Bill merchant via Shopify Billing API
await shopify.billing.request({
charge: {
name: 'AI Video Generation',
price: credits * 0.10, // $0.10 per credit
quantity: 1
}
});
});* Pricing estimates based on average video generation costs. Actual costs vary by model and duration. View full pricing
Register and get 50 free credits with code SHOPIFYDEV
Use our async webhook delivery for video results
Add billing via Shopify Billing API and submit