Skip to main content
Methods:
  • client.createVideo(...)
  • client.listVideos(...)
  • client.getVideo(...)
  • client.retrieveVideoContent(...)
  • client.getVideoDownloadUrl(...)
  • client.cancelVideo(...)
  • client.deleteVideo(...)
  • client.listVideoModels(...)
  • client.getAsyncJobWebSocketUrl(...)
  • client.getVideoWebSocketUrl(...)
  • client.asyncJobs.websocketUrl(...)
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.
Last modified on May 6, 2026