> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ai-stats.phaseo.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Video generation

> Create and manage async video jobs with the Java SDK.

**Methods**:

* `client.createVideo(...)`
* `client.listVideos(...)`
* `client.getVideo(...)`
* `client.retrieveVideoContent(...)`
* `client.getVideoDownloadUrl(...)`
* `client.cancelVideo(...)`
* `client.deleteVideo(...)`
* `client.listVideoModels(...)`
* `client.getAsyncJobWebSocketUrl(...)`
* `client.getVideoWebSocketUrl(...)`
* `client.asyncJobs.websocketUrl(...)`

```java theme={null}
import ai.stats.sdk.AIStats;
import java.util.Map;

AIStats client = new AIStats(System.getenv("AI_STATS_API_KEY"));

Object response = client.createVideo("""
{
  "model": "openai/sora-2",
  "prompt": "A serene mountain lake at sunrise"
}
""");

Object jobs = client.listVideos(Map.of(
  "status", "queued,completed",
  "limit", "2"
));

String websocketUrl = client.getVideoWebSocketUrl("video_123", 1500, null);

System.out.println(String.valueOf(response));
System.out.println(websocketUrl);
```

The create response is an async job record. Poll the status endpoint before attempting content or signed download retrieval.

Use `client.getVideoWebSocketUrl(...)` when you want to subscribe to the documented `/v1/async/video/{id}/ws` lifecycle stream instead of polling only.
Use `client.asyncJobs.websocketUrl("video", videoId, ...)` when you want the generic async-jobs resource helper.
Use `client.getAsyncJobWebSocketUrl("video", videoId, ...)` when you want the same generic helper without going through the resource object.

`cancelVideo(...)` is exposed, but the public video cancel route currently returns a structured `501 not_implemented_yet` error while provider-level cancellation is standardized.
