OpenAI Sora Integration

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

sora_tracking.py
1import paygent_sdk
2from openai import OpenAI
3
4# 1. Initialize Paygent
5paygent_sdk.init(api_key="your-paygent-api-key")
6
7client = OpenAI()
8
9# 2. Generate video - usage is tracked automatically!
10video = client.videos.create(
11    model="sora-2",
12    prompt="A cinematic drone shot of a futuristic city",
13    size="1280x720",
14    seconds="4",
15    
16    # Paygent tracking parameters
17    paygent_agent_id="video-agent",
18    paygent_customer_id="customer-123",
19    paygent_indicator="video-created"
20)

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.

Was this page helpful?

Need help? Contact us at support@withpaygent.com