Install & Compatibility
Where this runs
tested against v1.5.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 2.156s · 50MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 5.2s · import 1.977s · 50MB
49MB installed
● package 49MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Vonage
✓ from vonage import Vonage, Auth
The recommended way to access Video API functionality is through the main `vonage` client.
SessionOptions
✓ from vonage_video import SessionOptions
✗ from vonage.video import SessionOptions
Data models for Video API methods are imported directly from `vonage_video`, not nested under `vonage.video`.
MediaMode
✓ from vonage_video.constants import MediaMode
Constants like MediaMode are found within the `vonage_video.constants` submodule.
This quickstart demonstrates how to initialize the Vonage client, create a video session, and generate a client token. It uses environment variables for authentication credentials, which is recommended for security. Ensure you have a Vonage Application with Video capabilities enabled and the corresponding Application ID and Private Key file.
import os
from vonage import Vonage, Auth
from vonage_video.constants import MediaMode
from vonage_video import SessionOptions
# Replace with your actual Vonage Application ID and Private Key path
# Obtain these from your Vonage Dashboard after creating a Video-enabled application.
VONAGE_APPLICATION_ID = os.environ.get('VONAGE_APPLICATION_ID', 'YOUR_APPLICATION_ID')
VONAGE_PRIVATE_KEY_PATH = os.environ.get('VONAGE_PRIVATE_KEY_PATH', 'path/to/your/private.key')
if VONAGE_APPLICATION_ID == 'YOUR_APPLICATION_ID' or not os.path.exists(VONAGE_PRIVATE_KEY_PATH):
print("Please set VONAGE_APPLICATION_ID environment variable and VONAGE_PRIVATE_KEY_PATH, and ensure the private key file exists.")
print("Refer to https://developer.vonage.com/en/messages/application/create for creating an application.")
else:
try:
auth = Auth(
application_id=VONAGE_APPLICATION_ID,
private_key=VONAGE_PRIVATE_KEY_PATH,
)
client = Vonage(auth=auth)
# Create a session
session_options = SessionOptions(media_mode=MediaMode.ROUTED)
session = client.video.create_session(session_options)
session_id = session.session_id
print(f"Created Session ID: {session_id}")
# Generate a token for a client to connect to the session
token = client.video.generate_client_token(session_id)
print(f"Generated Client Token: {token}")
except Exception as e:
print(f"An error occurred: {e}")
Debug
Known issues
breakingMigration from OpenTok Python SDK to Vonage Python SDK requires significant changes. Positional parameters are replaced with data models, methods return Pydantic data models, and some method names have changed. Authentication now primarily uses Application ID and Private Key (for JWTs) instead of API Key and Secret for Video API operations.fixRefer to the official 'OpenTok to Vonage Video Server SDK Transition Guide (Python)' for detailed migration steps. Update method calls, parameter structures, and authentication mechanisms.
affects: All versions when migrating from 'opentok' SDK
gotchaWhile `vonage-video` exists on PyPI, it's typically installed as a dependency of the main `vonage` SDK. Directly installing `vonage-video` and trying to use its classes might lead to missing broader SDK context or unexpected behavior, especially for API client instantiation.fixAlways install `pip install vonage` to get the full Vonage Python SDK. Access Video API functionality via `client = Vonage(auth=...); client.video.create_session(...)`.
affects: All versions
gotchaAuthentication for the Vonage Video API uses an Application ID and a Private Key (for JWT generation). The traditional API Key and Secret are generally used for other Vonage APIs (like SMS, Voice) but not directly for Video API calls through the `vonage` client.fixEnsure you have created a Vonage Application with the 'Video' capability enabled in your Vonage Dashboard. Download the private key file and use its path along with the Application ID for `Auth` initialization.
affects: All versions of `vonage` SDK accessing Video API
Errors
Common errors & fixes
AttributeError: 'Vonage' object has no attribute 'video'
The installed `vonage` SDK version might be too old or `vonage-video` (as a dependency) might not be correctly installed/available, preventing the `video` module from being attached to the client.
fixEnsure you have the latest `vonage` SDK installed: `pip install --upgrade vonage`. If the issue persists, check Python environment and dependencies.
ModuleNotFoundError: No module named 'opentok'
This error occurs when trying to run code written for the legacy `opentok` SDK after migrating to the `vonage` SDK or when `opentok` was never installed.
fixIf migrating, update your code to use the `vonage` SDK and its `client.video` methods and `vonage_video` data models. If it's a new project, ensure you are not importing `opentok` and are using `vonage` instead.
from vonage.video import SessionOptions # ModuleNotFoundError: No module named 'vonage.video'
While `client.video` provides access to methods, data models like `SessionOptions` are imported directly from the top-level `vonage_video` package, not a nested submodule of `vonage`.
fixChange the import statement to `from vonage_video import SessionOptions` (and similar for other models).
Upgrade
Version history
1.5.1latest on PyPI · released Sep 26, 2025
Audit
Dependencies
pydanticrequiredUsed extensively for data models and type enforcement within the Vonage Python SDK, including video API components.