AI Analysis
Generate video summaries, chapters, and content moderation using AI.
Supported Analysis Types
| Type | Output | Use Case |
|---|---|---|
| summary | Text summary of the video | SEO descriptions, search indexing |
| chapters | Timestamped chapter markers | Video navigation, table of contents |
| moderation | Content safety analysis | NSFW detection, compliance |
Trigger Analysis
bash
curl -X POST /api/ai/videos/1/analyse \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"type": "summary"}'Response
{
"data": {
"id": 1,
"asset_id": 1,
"analysis_type": "summary",
"status": "processing",
"model": "anthropic/claude-sonnet-4-6"
}
}Analysis runs asynchronously as a background job. Poll the results endpoint or use webhooks to be notified when complete.
Get Results
bash
curl /api/ai/videos/1/analysis \
-H "Authorization: Bearer TOKEN"Response (summary)
{
"data": [
{
"id": 1,
"analysis_type": "summary",
"status": "ready",
"result": "This video demonstrates how to set up a Node.js development environment...",
"total_tokens": 1250,
"model": "anthropic/claude-sonnet-4-6",
"created_at": "2026-03-29T12:00:00Z"
}
]
}Video Q&A (Streaming)
Ask questions about a video with streaming AI responses:
bash
curl -N /api/ai/videos/1/qa \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"question": "What are the main topics covered?"}'Response is Server-Sent Events (SSE):
text
data: {"token": "The"}
data: {"token": " video"}
data: {"token": " covers"}
data: {"token": " three"}
data: {"token": " main"}
data: {"token": " topics"}
...
data: [DONE]Configuration
AI features use the Vercel AI Gateway. Configure in your .env:
.env
AI_GATEWAY_URL=https://ai-gateway.vercel.sh/v1
AI_GATEWAY_API_KEY=vck_your_key_here
AI_GATEWAY_MODEL=anthropic/claude-sonnet-4-6The AI Gateway supports any LLM provider (Anthropic, OpenAI, etc.). Change the model string to switch providers.