SDKs / PythonSign inRequest access

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(), result(id, format="txt"), and webhook management — create_webhook_endpoint, list_webhook_endpoints, verify_webhook_endpoint, rotate_webhook_secret, disable_webhook_endpoint, list_webhook_deliveries, replay_webhook_delivery.

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_…

Retries are automatic and never charge twice:

  • 429 and 503 are retried, honouring Retry-After.
  • A dropped connection or timeout is retried with the same idempotency key (so you get the original transcription, not a second one). Requests that are not safe to repeat, such as registering a webhook endpoint, are not retried.
  • transcribe() (short audio) accepts idempotency_key=. Without one, the client creates a key and, after a 503, retries with a new key. With your own key, a 503 is raised to you — resend later with a new key. A 504 is never retried; use transcribe_file() for recordings that need longer.
  • Large uploads resume from the server's offset after a dropped connection.

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