Python SDK

The VCursor Python SDK offers a clean, idiomatic interface for integrating video generation capabilities into your Python applications.

Installation

bash
1pip install vcursor-cli

Quick Start

Synchronous usage for simple scripts and straightforward integrations.

main.py
1from vcursor import VCursor
2
3client = VCursor(api_key="your_api_key")
4
5# Submit a video generation task
6resp = client.submit("a cat playing piano in a jazz club")
7print(f"Task started: {resp.task_id}")
8
9# Wait for completion with progress callback
10result = client.wait_for_completion(
11 resp.task_id,
12 on_progress=lambda p: print(f"{p.data.progress}%")
13)
14
15print(f"Video URL: {result.data.products.url}")

Async Usage

Use VCursorAsync for high-performance asyncio applications such as FastAPI servers or Discord bots.

async_example.py
1import asyncio
2from vcursor import VCursorAsync
3
4async def main():
5 async with VCursorAsync(api_key="your_api_key") as client:
6 resp = await client.submit("sunset timelapse over mountains")
7 print(f"Task: {resp.task_id}")
8
9 result = await client.wait_for_completion(resp.task_id)
10 if result.data.status == "completed":
11 print(result.data.products.url)
12
13asyncio.run(main())

Agent Mode

Trigger complex workflows using the Agent API.

complex_task.py
1# Submit a complex request that requires planning and assets
2resp = client.submit_agent("Create a 15s social media ad for my sneakers")
3task_id = resp.get("task_id")
4
5# The agent takes care of the rest
6result = client.wait_for_agent_completion(task_id)
7print(f"Agent Output: {result.video_url}")

Concurrency Limiting

Check your current rate limits or throttle client-side requests.

python
1# Check current rate limit status
2status = client.check_concurrency("standard")
3print(f"Standard: {status.summary['standard'].used}/{status.summary['standard'].limit}")
4
5# Client-side limit (capped at server limit)
6client = VCursor(api_key="your_api_key", max_concurrency=10)