AI Script Writing
POST /v1/ai/script
Generate video scripts using Claude. Specify the topic, tone, format, audience, and duration to get a ready-to-use script.
Request
| Field | Type | Required | Description |
|---|---|---|---|
topic | string | Yes | The subject of the script |
tone | string | No | professional, casual, energetic, serious, friendly (default: professional) |
format | string | No | narration, dialogue, tutorial, ad, explainer (default: narration) |
audience | string | No | Target audience description (default: general) |
duration | number | No | Target duration in seconds (default: 60) |
language | string | No | Output language (default: en) |
instructions | string | No | Additional instructions or context |
Example
curl
curl -X POST https://api.vidiking.com/v1/ai/script \
-H "Authorization: Bearer $VIDIKING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"topic": "Benefits of using AI for video editing",
"tone": "energetic",
"format": "ad",
"audience": "marketing teams at SaaS companies",
"duration": 30,
"instructions": "Include a strong call-to-action at the end. Mention time savings and cost reduction."
}'
Node.js
const script = await client.ai.generateScript({
topic: 'Benefits of using AI for video editing',
tone: 'energetic',
format: 'ad',
audience: 'marketing teams at SaaS companies',
duration: 30,
instructions: 'Include a strong call-to-action at the end.',
});
console.log('Script:', script.text);
console.log('Estimated duration:', script.estimated_duration, 'seconds');
Python
script = client.ai.generate_script(
topic="Benefits of using AI for video editing",
tone="energetic",
format="ad",
audience="marketing teams at SaaS companies",
duration=30,
instructions="Include a strong call-to-action at the end.",
)
print("Script:", script.text)
print("Estimated duration:", script.estimated_duration, "seconds")
Response
{
"id": "script_abc123",
"text": "What if you could create 100 videos in the time it takes to make one? [PAUSE] With AI-powered video editing, your marketing team can generate personalized product demos, social clips, and ad variations -- automatically. No more waiting days for a single edit. No more blown budgets on production. Just type your message, pick a template, and hit render. [PAUSE] Try Vidiking free today and see the difference AI makes.",
"estimated_duration": 28,
"word_count": 65,
"sections": [
{ "type": "hook", "text": "What if you could create 100 videos in the time it takes to make one?" },
{ "type": "body", "text": "With AI-powered video editing, your marketing team can generate personalized product demos, social clips, and ad variations -- automatically. No more waiting days for a single edit. No more blown budgets on production." },
{ "type": "cta", "text": "Try Vidiking free today and see the difference AI makes." }
],
"credits_used": 3,
"created_at": "2025-01-15T10:30:00Z"
}
Full Workflow: Script to Video
Generate a script, create a voiceover, and render a video -- all through the API.
// Step 1: Generate script
const script = await client.ai.generateScript({
topic: 'Product launch announcement',
tone: 'friendly',
format: 'narration',
duration: 15,
});
// Step 2: Generate voiceover from script
const voiceover = await client.ai.generateVoiceover({
text: script.text,
voice: 'rachel',
model: 'elevenlabs-flash',
});
// Step 3: Generate background image
const bg = await client.ai.generateImage({
prompt: 'Elegant product launch background, gradient, modern',
width: 1920,
height: 1080,
});
// Step 4: Render video
const { jobId } = await client.render({
timeline: {
soundtrack: { src: voiceover.url, volume: 1.0 },
tracks: [
{
clips: [
{
asset: { type: 'title', text: 'Now Available', style: 'future', size: 'large' },
start: 1,
length: voiceover.duration - 2,
transition: { in: 'fade', out: 'fade' },
},
],
},
{
clips: [
{
asset: { type: 'image', src: bg.url },
start: 0,
length: voiceover.duration,
effect: 'zoomIn',
},
],
},
],
},
output: { format: 'mp4', resolution: 'hd' },
});
const job = await client.pollJob(jobId);
console.log('Final video:', job.url);
Tone Options
| Tone | Best For |
|---|---|
professional | Corporate presentations, B2B content |
casual | Social media, vlogs, behind-the-scenes |
energetic | Ads, product launches, event promos |
serious | News, documentaries, PSAs |
friendly | Tutorials, explainers, welcome videos |
Format Options
| Format | Structure |
|---|---|
narration | Continuous voiceover script |
dialogue | Two-person conversation |
tutorial | Step-by-step instructions |
ad | Hook, benefit, CTA structure |
explainer | Problem, solution, how-it-works |
Cost
Script generation costs $0.20 per request.