SDKs / PythonSign inGet an API key

Python SDK

A small, typed-error client for Python 3.9+, built on httpx.

Install

Shell
pip install twentysix

Configure

Python
from twentysix import Client

client = Client(api_key="sk_…", base_url="https://…")   # or set TWENTYSIX_API_KEY / TWENTYSIX_BASE_URL

Client is a context manager (with Client() as client:) and accepts timeout, max_retries and your own httpx.Client.

Transcribe

Python
# Short audio, one request
result = client.transcribe("note.ogg", "mr-IN", mode="codemix")

# Any length: upload → transcribe → wait → result
result = client.transcribe_file("meeting.m4a", "hi-IN", diarization=True)

print(result["text"])
for s in result["segments"]:
    print(s["start"], s.get("speaker"), s["text"])

Step by step

Python
upload = client.upload("call.wav")                     # verified upload with duration_seconds
job = client.create_transcription(upload["id"], "ta-IN", channel_mode="separate",
                                  webhook_endpoint_id="wh_…", idempotency_key="call-8812")
job = client.wait(job["id"])                           # polls until completed / partial / failed / cancelled
if job["state"] in ("completed", "partial"):
    result = client.result(job["id"])

Also: get(id), list(limit, after, state), cancel(id), delete(id), usage(), models() and create_webhook_endpoint(url).

Files above 50 MB are uploaded resumably in 6 MB chunks and resume after a dropped connection.

Errors

Python
from twentysix import APIError

try:
    client.create_transcription(upload["id"], "xx-XX")
except APIError as e:
    print(e.status, e.code, e.detail, e.request_id)   # 422 unsupported_language language req_…

429 and 503 are retried automatically, honouring Retry-After. Every create call sends an idempotency key.

Webhooks

Python
from twentysix import verify_webhook

ok = verify_webhook(secret, request.headers, raw_body)
Scriba is a product of 26AI Private Limited, Pune, India.© 2026 26AI Private Limited