Python SDK
Build video on FastPix from Python: a python video SDK
The official FastPix SDK for Python. Typed end-to-end, async-aware, retry-safe. Encodes a source URL into a playback ID in one call, provisions LL-HLS live streams, verifies webhooks with one helper, and ships with a migration path from the closest API peer (see comparison).
Trusted by product teams shipping video at scale







Install
One install, one client, one call
Add the package, point the client at your API key, and you're talking to FastPix — strongly-typed, no scaffolding.
Install the package
bash · terminal
pip install fastpixRuntime
Python 3.9+.
Type safety
Full Pydantic v2 models for every request and response.
IDE support
PyCharm, VS Code with Pylance, full type completion.
Initialize the client
Python · app.py
import os
from fastpix import FastPix
fp = FastPix(api_key=os.environ["FASTPIX_API_KEY"])
# Async client also available: from fastpix import AsyncFastPixCommon operations
From upload to playback in 4 calls
Encode, wait, stream, upload. The four most common flows, typed end-to-end.
1. Encode a source URL into a playback ID
asset = fp.assets.create(
inputs=[{"url": "https://your-cdn.com/source.mp4"}],
playback_policy="public",
)
print(asset.playback_id) # "abc123"2. Wait until the asset is ready
# Poll until the asset is ready, or listen for the asset.ready webhook.
ready = fp.assets.wait_until_ready(
asset.id,
poll_interval_seconds=2,
timeout_seconds=300,
)3. Provision a low-latency live stream
stream = fp.live.create(
latency_mode="low", # LL-HLS
reconnect_window_seconds=60,
playback_policy="public",
)
# stream.stream_key -> push to rtmp://global-live.fastpix.com/live4. Resumable chunked upload
# Resumable chunked upload from a Python worker
from fastpix.upload import upload_file
upload_file(
endpoint=asset_upload_url, # returned by fp.assets.create_upload()
path="./source.mp4",
chunk_size_mb=8,
on_progress=lambda pct: print(f"{pct}%"),
)Security, compliance, and partnerships
Webhook signature verification
One helper, every event typed
Every webhook FastPix sends is signed. The SDK verifies the signature and returns a fully-typed event payload. Switch on event.type and reach the typed payload directly.
from fastpix.webhooks import verify_webhook
from flask import request
@app.post("/webhooks/fastpix")
def fastpix_webhook():
event = verify_webhook(
payload=request.data,
signature=request.headers["FastPix-Signature"],
secret=os.environ["FASTPIX_WEBHOOK_SECRET"],
)
if event.type == "asset.ready":
... # event.data is a fully-typed Pydantic model
return "", 200Concurrency model
Built for the Python runtime
Both sync and async clients ship in the same package. The async client uses httpx under the hood with HTTP/2 and connection pooling (default pool size 16). Use `async with AsyncFastPix(...) as fp:` for proper connection cleanup. Long-running operations support asyncio cancellation.
Type safety + IDE support
Every API method returns a Pydantic v2 model. Request bodies are validated client-side before the network call, so a missing required field raises ValidationError before round-trip. Use `from fastpix.types import Asset, LiveStream` to share request and response types across modules.
Migration
Swap the client, keep the shape
FastPix exposes primitives that mirror the closest API peer. The Python SDK keeps the call shapes recognizable so the migration is a one-file swap, not a rewrite. FastPix vs Mux side-by-side.
# Before: from mux_python import Configuration, AssetsApi
# FastPix:
from fastpix import FastPix
fp = FastPix(api_key=os.environ["FASTPIX_API_KEY"])
# Before: response = assets_api.create_asset(create_asset_request)
# FastPix:
asset = fp.assets.create(
inputs=[{"url": url}],
playback_policy="public",
)
# Before: response.data.playback_ids[0].id
# FastPix:
asset.playback_idBulk migration tooling at /compare/mux and the docs migration guide handles asset re-ingest and playback-ID remap.
FAQ
Python SDK FAQ
What does the Python SDK ship with out of the box?
All API surfaces (assets, live streams, playback policies, webhooks, simulcast, analytics query) plus the resumable chunked upload helper, webhook signature verification, automatic retries with exponential backoff, and configurable timeout / base URL / HTTP client. Type definitions are bundled.Is the Python SDK production-ready?
Yes. The client is used in production by FastPix customers shipping video on the Python runtime. The retry policy, connection pool defaults, and timeout shape are tuned against the same workload patterns that produce the numbers on the /performance page.How do I authenticate against the FastPix API from Python?
Set the FASTPIX_API_KEY environment variable and pass it to the client constructor. The SDK adds the Bearer header on every request. For server-side runtimes, fetching the API key from your secret store at startup and constructing the client once at module load is the recommended pattern.Where do I get an API key?
Sign up at the FastPix dashboard. The free trial provisions a key with no credit card; the trial plan covers 10 videos plus 100K streaming minutes plus AI samples. See /pricing for the full plan structure.
Read it, run it, ship it.
Every SDK, player, and integration lives on GitHub. Star the repos, file an issue, or open a PR — we build alongside the developers who use us.
Continue exploring
Where the Python SDK plugs in
Video on Demand
Encode + store + deliver via this SDK.
Video on DemandLive Streaming
Provision LL-HLS streams from Python.
Live StreamingIn-Video AI
Captions, NER, summary, moderation API surfaces.
In-Video AIVideo Data
56-dim per-session QoE query API.
Video DataAll developer docs
Other SDKs + API reference + webhooks.
Developer docsPricing
SKU-by-SKU rates.
Pricing