Skip to main content

Python package for AssemblyAI

Project description


Transcribe audio into text. Recognize made-up words and boost accuracy using custom language models.

Getting started

Run pip install and get an API token from

pip install -U assemblyai


Start transcribing:

import assemblyai

aai = assemblyai.Client(token='your-secret-api-token')

transcript = aai.transcribe('')

Get the completed transcript. Transcripts take about half the duration of the audio to complete.

while transcript.status != 'completed':
    transcript = transcript.get()

text = transcript.text

Custom models

The quickstart example transcribes audio using a generic English model.

In order to retain accuracy with unique word sets, create a custom model.

For this example, we create a model using a list of words/sentences found on a wikipedia page.

Create the custom model.

import assemblyai
import wikipedia

aai = assemblyai.Client(token='your-secret-api-token')

phrases ="List of Pokemon characters").content.split('. ')

model = aai.train(phrases)

Check to see that the model has finished training -- models take about six minutes to complete.

while model.status != 'trained':
    model = model.get()

Reference the model when creating a transcript.

transcript = aai.transcribe('', model=model)

Model and Transcript attributes

Prior models and transcripts can by called by ID.

model = aai.model.get(id=<id>)
transcript = aai.transcript.get(id=<id>)

To inspect additional attributes, use props():


>>> ['headers',
>>>  'id',
>>>  'status',
>>>  'name',
>>>  'phrases',
>>>  'closed_domain',
>>>  'warning',
>>>  'dict']


>>> ['headers',
>>>  'id',
>>>  'audio_url',
>>>  'model',
>>>  'status',
>>>  'warning',
>>>  'text',
>>>  'text_raw',
>>>  'confidence',
>>>  'segments',
>>>  'speaker_count',
>>>  'dict']

The dict attribute contains the raw API response:


For additional background see:

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
assemblyai-0.1.10-py2.py3-none-any.whl (5.6 kB) Copy SHA256 hash SHA256 Wheel py2.py3
assemblyai-0.1.10.tar.gz (13.1 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page