Skip to main content

Talksign Python SDK

The official Python library for the Talksign API: turn speech or text into sign language video with Echo 2.0, in a few lines.

pip install talksign            # REST client + live stream
pip install "talksign[video]"   # + RGB frame decoder for video pipelines (PyAV, numpy)

Python 3.10+. Get an API key (sk-live-…) in the Developer Console and set it as TALKSIGN_API_KEY.

REST quickstart

from talksign import Talksign

client = Talksign()  # reads TALKSIGN_API_KEY

res = client.speech_to_sign.realtime("Hello, how are you?", avatar="arthur", language="asl")
for clip in res["data"]["playlist"]:
    print(clip["gloss"], clip["url"])
print("cost:", res["usage"]["costUsd"], "USD")

# One rendered MP4 instead of a clip playlist
video = client.speech_to_sign.studio("Welcome to our store", avatar="amara")
print(video["data"]["download_url"])

print(client.balance.retrieve()["available_usd"])

Async: use AsyncTalksign — same resources, await every call.

Resource Methods
speech_to_sign realtime, create, studio, gloss, video
avatars list, get, create, delete, validate
jobs create, get, list, cancel, wait
speech_to_speech create
voice create (MP3 bytes), create_json, voices
sign_to_speech create (not available in the API yet: raises APIError 501)
uploads, meetings create / create, get, stop
models list, warmup
usage, balance list, retrieve
client openapi()

Responses are plain dicts typed with TypedDicts from talksign.types.

Live signing from streamed text

client.echo.stream() turns text as it arrives (LLM tokens, TTS text) into an ordered stream of sign clips. It cuts sentences, makes one realtime call per sentence with the next one prefetched, and can be interrupted.

import asyncio
from talksign import AsyncTalksign


async def main():
    async with AsyncTalksign() as client:
        stream = client.echo.stream(avatar="arthur", language="asl")

        async def feed():
            for chunk in ["Hi there! ", "How can I ", "help you today?"]:
                stream.push_text(chunk)
            await stream.aclose()  # flush the rest, then "done"

        asyncio.create_task(feed())
        async for event in stream:
            if event.type == "sentence":
                print("signing:", event.text, event.glosses)
            elif event.type == "clip":
                print("  play", event.clip["gloss"], event.clip["url"])
            elif event.type == "idle":
                print("idle loop:", event.idle and event.idle["url"])


asyncio.run(main())

Events: sentence (has glosses, usage, has_missing), clip (in order; clips without a URL are skipped), interrupted, idle (reason: ready = the avatar's idle loop fetched at start with one free GET /v1/avatars/{id}, so you can show the avatar before the first sentence; drained; interrupt), error (a sentence failed and was skipped), done. Call stream.interrupt() when the user barges in: in-flight calls are aborted and the queue is dropped.

Each word's clip plays in_url → url from active_start_s to active_end_s → out_url; loop the idle clip in between.

Options of echo.stream(...):

  • chunking="sentence" (default) signs each sentence as soon as it is complete. chunking="full" buffers everything until flush() / close and signs it in one call (fewer calls, later start).
  • first_chunk_chars=40 (default): the first piece of each reply may be cut at a comma or clause once it has 40 characters, so the avatar starts sooner. 0 turns it off.
  • fetch_idle=True (default): fetch the avatar's idle loop at start (free). False skips it.

Avatars and their idle loop

avatar = client.avatars.get("arthur")       # free
idle = avatar["data"]["idle"]               # {"url": ..., "expires_at": ...} or None

Every avatar from avatars.list() / avatars.get() carries idle, a short-lived signed URL of its idle loop.

Browser apps: short-lived tokens

Never put your secret key in a web page. Mint a short-lived token on your server and hand it to the page:

token = client.tokens.create(expires_in=600, allowed_origins=["https://app.example.com"])
# -> {"token": "tst_…", "expires_at": "…", "scopes": ["sign:realtime", "avatars:read"], ...}

The token can only call POST /v1/speech-to-sign/realtime and GET /v1/avatars[/{id}], bills your wallet like the key, and ends when the key is revoked. Set allowed_origins in production. In the page, use the JavaScript SDK (new Talksign({ token })).

Video frames (for video pipelines and agent plugins)

from talksign import AsyncTalksign
from talksign.video import EchoFrameSource

source = EchoFrameSource.from_client(AsyncTalksign(), avatar="arthur", width=1280, height=720, fps=30)
source.push_text("Nice to meet you.")
async for frame in source:  # numpy uint8 array (720, 1280, 3), RGB, at 30 FPS
    publish(frame)

It loops the idle clip while nothing is signing, crossfades between clips (150 ms), downloads clips with bounded concurrency and an LRU cache, and decodes in a worker thread. source.interrupt() returns to idle at once. Call source.start() at session start (iterating also starts it): the idle loop is looked up and downloaded at once, and its first frame is shown as a still while the rest arrives (about 0.25 s instead of ~2.9 s in offline tests). Pass poster= (image/clip bytes, an RGB array or a URL) to show the avatar from the very first frame. With realtime=False (offline rendering) frames are produced as fast as possible and never padded with idle/background frames while a sentence is still being fetched or downloaded.

Errors and retries

All errors derive from talksign.TalksignError and carry status_code, code, param and request_id: APIError (any HTTP error; base of) AuthenticationError (401), InsufficientBalanceError (402), PermissionDeniedError (403), NotFoundError (404), BadRequestError (400/409/413/422), RateLimitError (429, retry_after), plus APIConnectionError / APITimeoutError. status is an alias of status_code.

429, 5xx and network errors are retried max_retries times (default 2) with exponential backoff, honouring Retry-After. Every POST carries an Idempotency-Key (reused across retries), so a retried call is never charged twice. Pass your own with idempotency_key=.

client = Talksign(api_key="sk-live-…", base_url="https://api.talksign.co", timeout=30, max_retries=3)

Licence

Apache-2.0. See LICENSE.

Metadata

Release files for talksign 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for talksign 0.2.1
File Size Uploaded Provenance Actions
talksign-0.2.1.tar.gz 46.7 kB Without provenance Details for talksign-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for talksign 0.2.1
File Interpreter ABI Platform Actions
talksign-0.2.1-py3-none-any.whl Python 3 none any Details for talksign-0.2.1-py3-none-any.whl

Total release size: 85.2 kB

Release files / talksign-0.2.1.tar.gz

Download URL talksign-0.2.1.tar.gz
Size 46.7 kB
Tags Source
SHA-256 checksum
How to use checksums
96041f9c9ecd0ac165e91077cf88ade606493ab8a0403cbf6b0dab9c00315e13
BLAKE2b-256 checksum
How to use checksums
94a38569a8a6af710c515667247ae9cf56ab7f81d238c3818b54f64f9e8adbce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / talksign-0.2.1-py3-none-any.whl

Download URL talksign-0.2.1-py3-none-any.whl
Size 38.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8d022cc98089cad9fdb2d0bc36c2139c3d90d8bd5d2899325aa4832e94c7098
BLAKE2b-256 checksum
How to use checksums
dd7039ea4fc61d091cf42c8916a7d53bc526ef97080a7bbc5a41c343212bcb69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for talksign 0.2.1

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.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page