> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.withpaygent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.withpaygent.com/_mcp/server.

# OpenAI Sora Integration

Track video generation usage for OpenAI's Sora model using the Paygent Python SDK.

**`sora_tracking.py`**

```python title="sora_tracking.py"
import paygent_sdk
from openai import OpenAI

# 1. Initialize Paygent
paygent_sdk.init(api_key="your-paygent-api-key")

client = OpenAI()

# 2. Generate video - usage is tracked automatically!
video = client.videos.create(
    model="sora-2",
    prompt="A cinematic drone shot of a futuristic city",
    size="1280x720",
    seconds="4",
    
    # Paygent tracking parameters
    paygent_agent_id="video-agent",
    paygent_customer_id="customer-123",
    paygent_indicator="video-created"
)
```

> **Tip**
>
> **Automatic Parameter Extraction.** Notice that you don't need to manually send the duration or size to Paygent. The SDK extracts `seconds` and `size` directly from the OpenAI call.