Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

getVideoJobStatus.md

73 lines1.6 KB

1---
2id: getVideoJobStatus
3title: getVideoJobStatus
4---
5​
6# Function: getVideoJobStatus()
7​
8```ts
9function getVideoJobStatus<TAdapter>(options): Promise<{
10 error?: string;
11 progress?: number;
12 status: "pending" | "processing" | "completed" | "failed";
13 url?: string;
14 usage?: TokenUsage<ProviderUsageDetails>;
15}>;
16```
17​
18Defined in: [packages/ai/src/activities/generateVideo/index.ts:598](https://github.com/TanStack/ai/blob/main/packages/ai/src/activities/generateVideo/index.ts#L598)
19​
20**`Experimental`**
21​
22Get video job status - returns the current status, progress, and URL if available.
23​
24This function combines status checking and URL retrieval. If the job is completed,
25it will automatically fetch and include the video URL.
26​
27 Video generation is an experimental feature and may change.
28​
29## Type Parameters
30​
31### TAdapter
32​
33`TAdapter` *extends* [`VideoAdapter`](../interfaces/VideoAdapter.md)\<`string`, `any`, `any`, `any`, `any`, `any`\>
34​
35## Parameters
36​
37### options
38​
39#### adapter
40​
41`TAdapter` & `object`
42​
43#### jobId
44​
45`string`
46​
47## Returns
48​
49`Promise`\<\{
50 `error?`: `string`;
51 `progress?`: `number`;
52 `status`: `"pending"` \| `"processing"` \| `"completed"` \| `"failed"`;
53 `url?`: `string`;
54 `usage?`: `TokenUsage`\<`ProviderUsageDetails`\>;
55\}\>
56​
57## Example
58​
59```ts
60import { getVideoJobStatus } from '@tanstack/ai'
61import { openaiVideo } from '@tanstack/ai-openai'
62​
63const result = await getVideoJobStatus({
64 adapter: openaiVideo('sora-2'),
65 jobId: 'job-123'
66})
67​
68console.log('Status:', result.status)
69console.log('Progress:', result.progress)
70if (result.url) {
71 console.log('Video URL:', result.url)
73```