cURL
curl --request GET \ --url https://ai.kaiho.cc/v1/tasks/{task_id}
Query async task generation status and progress
Create Task
task_id
Queued
Processing
Completed / Failed
import requests task_id = "task_abc123" api_key = "YOUR_API_KEY" response = requests.get( f"https://ai.kaiho.cc/v1/tasks/{task_id}", headers={"Authorization": f"Bearer {api_key}"} ) status = response.json() print(f"Task status: {status['status']}") print(f"Progress: {status['progress']}%") if status['status'] == 'completed': print(f"Result: {status['result']}") elif status['status'] == 'failed': print(f"Error: {status['error']}")
{ "id": "task_abc123", "type": "video_generation", "status": "completed", "progress": 100, "result": { "video_url": "https://storage.kaiho.cc/videos/video-123.mp4", "thumbnail_url": "https://storage.kaiho.cc/videos/thumb-123.jpg", "duration": 10, "resolution": "1920x1080" }, "created_at": "2024-01-15T10:30:00Z", "completed_at": "2024-01-15T10:33:30Z" }
# Specify webhook when creating task response = requests.post( "https://ai.kaiho.cc/v1/videos/generations", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "sora-2", "prompt": "Video description...", "webhook_url": "https://your-server.com/webhook" } )