TypeScript SDK
Generate UGC video ads from TypeScript.
Last updated: May 2026
Typed Node.js client. One import, one method call, one finished MP4. Polling helpers for show-your-app, laptop-ugc, and product-acting flows. Webhook delivery for the rest. Full TypeScript types on every method.
Install
npm install @agentmedia/sdk # or pnpm add @agentmedia/sdk yarn add @agentmedia/sdk
Generate a UGC ad
One method call, fully typed, polls to completion automatically.
import { AgentMedia } from '@agentmedia/sdk';
const client = new AgentMedia({
apiKey: process.env.AGENT_MEDIA_API_KEY!,
});
// Submit a UGC video job
const job = await client.submitVideo({
actor_slug: 'sofia',
script: 'Try this AI tool that builds your UGC ads in seconds.',
target_duration: 10,
subtitle_style: 'hormozi',
});
// Poll for completion
let status = await client.getVideoStatus(job.job_id);
while (status.status !== 'completed' && status.status !== 'failed') {
await new Promise(r => setTimeout(r, 5000));
status = await client.getVideoStatus(job.job_id);
}
console.log(status.video_url); // → https://r2.../video.mp4
// Or async with webhook — pass webhook_url and skip polling
await client.submitVideo({
actor_slug: 'sofia',
script: '...',
webhook_url: 'https://yourapp.com/hooks/agent-media',
});What you get
Full TypeScript types
Typed inputs and responses for every method. IntelliSense for every parameter and response field.
Polling helpers
createShowYourApp() and createLaptopUgc() block until the job finishes. For plain ugc_video, use submitVideo() + getVideoStatus().
Typed errors
ApiError class with status code and structured error payload.
Webhook delivery
Pass webhook_url in any submit call. We POST job-completion events to your HTTPS endpoint.
Tree-shakeable
ESM + CJS. Bundle only the methods you use.
Works in Node 18+
Native fetch. No node-fetch or axios dependencies.
Frequently Asked Questions
Is there a TypeScript SDK for AI UGC video generation?
Yes. agent-media ships @agentmedia/sdk on npm — a fully typed Node.js client with polling helpers for ShowYourApp, LaptopUgc, and ProductActing flows. None of the major UGC video competitors (Arcads, MakeUGC, Creatify) ship a native TypeScript SDK.
Does the SDK work in Next.js, Remix, or Bun?
Yes. The SDK uses native fetch and ships ESM + CJS. Works in Next.js 14/15 server actions, Remix loaders, Bun, and Deno.
Can I use the SDK from a serverless function?
Yes. Call submitVideo() with a webhook_url — the function returns immediately with a job ID and your webhook receives the finished MP4.
Is the SDK open source?
Yes. Apache-2.0. Source on GitHub. PRs welcome.
How does this compare to other AI video SDKs?
HeyGen has a TypeScript SDK for corporate avatars. RunwayML has an API but no native TS SDK. agent-media is the only UGC-focused tool with a typed Node.js SDK at the time of writing.