Installation
npm install videodb
# or
yarn add videodb
GitHub
Source code and issues
Quick Start
import { connect } from 'videodb';
// Connect using environment variable
const conn = connect();
// Or pass API key directly
const conn = connect({ apiKey: "your-api-key" });
Environment Variables
| Variable | Description |
|---|
VIDEODB_API_KEY | Your API key from console.videodb.io |
export VIDEODB_API_KEY="your-api-key"
TypeScript Support
Full TypeScript definitions are included. No additional packages needed.
import { connect, Video, SearchResult } from 'videodb';
const conn = connect();
const video: Video = await conn.uploadURL("default", { url: "..." });
const results: SearchResult = await video.search("query");
Both ESM and CommonJS are supported:
// ESM
import { connect } from 'videodb';
// CommonJS
const { connect } = require('videodb');
Basic Usage
import { connect } from 'videodb';
const conn = connect();
// Upload a video
const video = await conn.uploadURL("default", {
url: "https://www.youtube.com/watch?v=example"
});
// Index for search
await video.indexSpokenWords();
// Search with natural language
const results = await video.search("key moments");
for (const shot of results.shots) {
console.log(`${shot.start}s: ${shot.text}`);
}
Server Side
Use the full SDK on your backend to manage sessions, run AI pipelines, and handle webhooks. Your API key should never be exposed to the browser.
// Create a capture session and generate a client token
const cap = await conn.createCaptureSession({ endUserId: "user_123" });
const token = await conn.generateClientToken(600);
Client Side
For real-time desktop capture, install the Capture SDK on your client application. It uses short-lived tokens instead of your API key.
Desktop capture currently supports macOS only. Windows support is coming soon.
Capture SDK Overview
Learn how to integrate real-time screen, audio, and camera capture into your application
Next Steps
Quickstart
Build your first perception-enabled agent
API Reference
Complete REST API documentation