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.
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.
list_jobs(limit) Recent jobs, newest first.
list_models() The public model catalogue: pricing, accuracy, supported languages.

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 a non-2xx response. It carries status and, when the API sent one, code.
  • 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.3.0.tar.gz (19.2 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.3.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for opentranscription-0.3.0.tar.gz
Algorithm Hash digest
SHA256 349c360483b094387de0790ca13ff49f81a8498481df69df5aa45c9387f5b7b0
MD5 5a87c8750e307bfa8bfdbfde7a5149aa
BLAKE2b-256 2714c5f1bad871ae77f56b20cbb78c93f351d61ba9127e98295464c7e610b462

See more details on using hashes here.

Provenance

The following attestation bundles were made for opentranscription-0.3.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.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for opentranscription-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9d3a98ab6f2a9e1cf03891d3f77171e528721cf99fc49ed3b6683033153f303
MD5 fffd2ee8727ebc50c8c69aee39df8689
BLAKE2b-256 58f736f5b23401d55db4fbe77154af6f72573cb5f6890e3ab4d266ce5d78ee94

See more details on using hashes here.

Provenance

The following attestation bundles were made for opentranscription-0.3.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.3.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page