TalkPix Python client
Official Python client for the TalkPix API. Send one portrait photo plus a script (or an audio file) and get back a lip-synced talking video as an MP4.
- Zero dependencies, Python 3.8+ (standard library only)
- Webhook signature verification built in
- Same API as the Node.js client
Full API reference: talkpix.ai/developers
Install
pip install talkpix
Quick start
Create an API key in your account at talkpix.ai/account/api and keep it on your server.
from talkpix import TalkPix
talkpix = TalkPix() # reads TALKPIX_API_KEY
video = talkpix.videos.create(
image_url="https://example.com/portrait.jpg",
script="Hi! This video was made with one API call.",
voice="zephyr",
language="en-US",
)
done = talkpix.videos.wait_for_completion(video["id"])
print(done["status"], done.get("video_url"))
Check the cost first
estimate is free and tells you how many credits a script will reserve before anything renders:
estimate = talkpix.estimate(script="Happy birthday, Sam!", resolution="720p")
# {"estimated_seconds": ..., "credits": ..., "max_seconds": ..., "words": ...}
account = talkpix.me()
print(account["credits"]["balance"])
Credits are reserved when a render starts and reconciled to the rendered length when it finishes. A failed render returns its credits automatically.
Use your own audio
video = talkpix.videos.create(
image_url="https://example.com/portrait.jpg",
audio_url="https://example.com/message.mp3",
)
Upload local files
with open("portrait.jpg", "rb") as f:
photo = talkpix.upload_file(f.read(), content_type="image/jpeg")
video = talkpix.videos.create(
image_key=photo["key"],
script="This photo was uploaded straight from my server.",
voice="zephyr",
language="en-US",
)
Voices and languages
info = talkpix.voices()
print(info["voices"], info["languages"])
Webhooks
Pass webhook_url to get a signed video.completed or video.failed event instead of polling. Verify it against the raw body:
from talkpix import verify_webhook_signature
@app.post("/hooks/talkpix") # Flask
def talkpix_hook():
ok = verify_webhook_signature(
os.environ["TALKPIX_WEBHOOK_SECRET"],
request.headers.get("TalkPix-Signature"),
request.get_data(),
)
if not ok:
return "", 400
event = request.get_json()
# event["type"] == "video.completed" -> event["data"]["video_url"]
return "", 200
List renders
page = talkpix.videos.list(limit=20, status="completed")
if page["has_more"]:
nxt = talkpix.videos.list(starting_after=page["next_starting_after"])
Errors
Every API error is raised as TalkPixError with status, type and, for validation errors, the param that failed:
from talkpix import TalkPixError
try:
talkpix.videos.create(image_url="https://example.com/portrait.jpg")
except TalkPixError as error:
print(error.status, error.type, error.param, error.message)
If a render is refused because the balance can't cover it, add credits at talkpix.ai/pricing.
Pricing
API renders use the same credit wallet and rates as the web app. Credits come in one-time packs from $5, never expire, and no subscription is required.
License
MIT
Metadata
Release files for talkpix 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| talkpix-0.1.0.tar.gz | 7.7 kB | Without provenance | Details for talkpix-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| talkpix-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for talkpix-0.1.0-py3-none-any.whl |
Total release size: 14.1 kB
Release files / talkpix-0.1.0.tar.gz
| Download URL | talkpix-0.1.0.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eacf82c7a5733c6a25e22039b284e968f45d2f4a3db3e0587b1d362b1205b8c6
|
|
BLAKE2b-256 checksum How to use checksums |
a69edc0c19c37392a2edcfddc5f9341c2a29e63f66a7af92c14cf20bf3ad5324
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.5
|
Release files / talkpix-0.1.0-py3-none-any.whl
| Download URL | talkpix-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d35c847a4e34cf9b627781ea0bf4dbe320549210eae997c3f96ce921be206b45
|
|
BLAKE2b-256 checksum How to use checksums |
31af2420c8d65026cf34200b1f114323f422d54ff6196e76341af5ab11bd5ec0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.5
|
Security for talkpix 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.