Skip to main content
OpenTranscription. Every speech-to-text model worth using. One command.

opentranscription

PyPI Python License

Python client for the OpenTranscription API. Upload a file, transcribe it against any model in the catalogue, and wait for the result.

pip install opentranscription

Usage

from opentranscription import OpenTranscription

ot = OpenTranscription(api_key=os.environ["OT_API_KEY"])

job = ot.transcribe(
    "earnings-call.mp3",
    # Primary plus backups, tried in order when a provider fails. Use `model`
    # instead for a single id, or for auto/best, auto/cheapest, auto/fastest.
    models=["assemblyai/best", "deepgram/nova-3"],
    language="en",
    diarization=True,
    # Names and jargon the model has the weakest prior for, which are usually
    # the reason you wanted the transcript.
    custom_words=["EBITDA", "Sanjay Bhattacharya", "Nasdaq", "ARR"],
)

done = ot.wait_for_job(job["id"])
print(done["transcript"]["text"])

transcribe does three things: requests a signed upload URL, PUTs the bytes straight to storage, and creates the job. The API key never travels to the storage host.

The first argument is a path, an open binary file, or raw bytes with file_name= alongside it.

async

The same surface, awaited. Both classes come from one package and share their implementation.

from opentranscription import AsyncOpenTranscription

async with AsyncOpenTranscription(api_key=os.environ["OT_API_KEY"]) as ot:
    job = await ot.transcribe("earnings-call.mp3", model="auto/best")
    done = await ot.wait_for_job(job["id"])

Use the context manager, on either class, or the connection pool outlives the work. The sync client also has close(), the async one aclose().

Request fields

The audio is required. Everything else is optional, and leaving a field out is not the same as passing False or None: left out means the server's own default applies.

Field Notes
model One id, or auto/best, auto/cheapest, auto/fastest. Use this or models, not both.
models Two to five ids: primary first, backups tried in order when one fails.
language ISO 639-1, two letters. Omit to let the model detect it.
diarization True forces speaker labels on, False forces them off, omitted follows the model's own default.
word_timestamps False declines word timing: the transcript comes back word_timestamps="disabled" with a null words. Omitted leaves the server default, which is on.
custom_words Up to 1000 terms, 100 characters each. Only models whose capabilities.features list custom_vocabulary read them; the rest ignore them instead of failing.
vocabulary_list_id A list saved in the web app, under Settings then Vocabulary. Merged with custom_words when both are given.
code_switching Audio that changes language mid-sentence.
code_switching_confidence_threshold 0 to 1. AssemblyAI only; ignored elsewhere.
webhook_url Public HTTPS URL for a signed transcription.completed event, so a long job needs no wait_for_job.
metadata Returned untouched on the job. Yours to correlate with.
title Display name in the web app. Falls back to the file name.
use_own_key Bill the provider directly against your own key instead of platform credits.
audio_retention_days Whole days, 0 to delete on completion, or None to keep indefinitely. Omitting it leaves the organization default in force, which is why None is a real value here.
custom_model_id A fine-tuned model you uploaded, by id.

That last row is why the defaults are NOT_GIVEN rather than None. None already means something to the API on two of these fields, so it cannot also mean "the caller said nothing".

The field list is checked against the published OpenAPI document on every test run. A field the API adds that this client does not offer fails the build by name, and so does one this client offers that the API no longer accepts.

API

Method Purpose
transcribe(file, **fields) Upload and create a job. Returns immediately, before transcription finishes.
wait_for_job(job_id, poll_interval) Poll until the job completes. Raises JobFailedError if it fails. poll_interval is seconds, default 2. No timeout.
get_job(job_id) Read one job, including its transcript once ready. job["metadata"]["quality_warning"] is set when the platform's quality gate flagged the result.
list_jobs(limit) Recent jobs, newest first.
list_models() The public model catalogue: pricing, accuracy, supported languages, lifecycle (active/deprecated) and successor_model_id.

OpenTranscription(api_key, base_url=..., timeout=..., http_client=..., sleep=...) accepts your own httpx.Client when you need custom transport, proxies, or retries, and an injectable sleep so tests need no real waiting. base_url defaults to https://opentranscription.io.

Passing your own client means your settings, not ours: the follow_redirects default this sets is yours to decide. The audio upload opts out of redirects per request either way, so that one is not yours to get wrong.

Rate limits (429) are retried automatically, up to four waits. The API sends X-RateLimit-Reset (an epoch second) and that is what paces the retry; Retry-After is honoured first if a response ever carries one. A single transcribe can trip a ten-per-minute limit on its own, since it is an upload, a create, and then a poll every couple of seconds.

Errors

  • ApiError is any request the API did not answer properly: a non-2xx response, or a 2xx whose body is not JSON (a base_url pointing at a locale-prefixed page such as https://opentranscription.io/en gets the website's HTML with a 200). It carries status and, when the API sent one, code. A 402 also carries payment, a dict with balance_credits and required_credits (1 credit = $0.01), checkout_url (a billing page that needs a signed-in browser, not a payment link) and, when free minutes ran out, reset_at; hand the user that URL, since only they can add credits. payment is None on every other error.
  • JobFailedError means the job ran and failed, so retrying the request is pointless. It carries code (also on job["error_code"]), which is what tells you whether to re-encode the audio, pick another model, or give up.
  • Both subclass OpenTranscriptionError.

Branch on code, not on the message, which is prose and may be reworded.

Getting a key

Create one in your dashboard, or run npx @opentranscription/cli login to mint one through the browser.

Requires Python 3.10 or newer, and httpx.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opentranscription-0.7.0.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opentranscription-0.7.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file opentranscription-0.7.0.tar.gz.

File metadata

  • Download URL: opentranscription-0.7.0.tar.gz
  • Upload date:
  • Size: 21.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for opentranscription-0.7.0.tar.gz
Algorithm Hash digest
SHA256 23a483c60eef013fb02a69e24206125e12fade1c9d70285011703609076206be
MD5 29b1d5fc004e4aad87ab3470c1ac1622
BLAKE2b-256 c314eb515e5356973e176d136a12a8332d337d52306f2ea1843e5f8baec1fc76

See more details on using hashes here.

Provenance

The following attestation bundles were made for opentranscription-0.7.0.tar.gz:

Publisher: release.yml on OpenTranscription/skills

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file opentranscription-0.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for opentranscription-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da049fe666a7380ec830d7a726a037f87890d739e5a4ae55bfc8d892bd36ca4b
MD5 e97664b680f2df99c793c75111851d6f
BLAKE2b-256 955bff52b459d58532e3359b0ef54afa93e6b746163035349a549119c54aea68

See more details on using hashes here.

Provenance

The following attestation bundles were made for opentranscription-0.7.0-py3-none-any.whl:

Publisher: release.yml on OpenTranscription/skills

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

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