For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
PlaygroundChangelogSign In
OverviewAPI ReferencePre-recorded STTStreaming STTVoice AgentsSpeech UnderstandingGuardrailsLLM GatewayFAQ
OverviewAPI ReferencePre-recorded STTStreaming STTVoice AgentsSpeech UnderstandingGuardrailsLLM GatewayFAQ
  • Getting started
    • Transcribe a pre-recorded audio file
    • Model selection
    • View model benchmarks
    • Evaluate model accuracy
    • Cloud endpoints & data residency
    • Manage concurrent requests
    • Webhooks
  • Models
    • Medical Mode
  • Features
    • Boost specific terms
    • Label speakers
    • Transcribe multiple audio channels
    • Transcribe audio with mixed languages
    • Correct spelling of terms
    • Include filler words
    • Search for words in transcript
    • Set the start and end of the transcript
  • Guides
      • Migration guide Deepgram to AssemblyAI
      • Migration guide OpenAI to AssemblyAI
      • Migration guide AWS Transcribe to AssemblyAI
      • Migration guide Google Speech-to-Text to AssemblyAI
      • Migration guide Gladia to AssemblyAI
LogoLogo
PlaygroundChangelogSign In
On this page
  • Get started
  • Side-by-side code comparison
  • Installation and authentication
  • Audio file sources
  • Basic transcription and polling the transcription status
  • Adding features
GuidesMigration guides

Migration guide: Gladia to AssemblyAI

Was this page helpful?
Previous

Get YouTube Video Transcripts with yt-dlp

Next
Built with

This guide walks through the process of migrating from Gladia to AssemblyAI for transcribing pre-recorded audio.

Get started

Before we begin, make sure you have an AssemblyAI account and an API key. You can sign up for a free account and get your API key from your dashboard. If you’d prefer to use one of our official SDKs, check our documentation for the full list of available SDKs.

The Gladia documentation uses cURL commands to demonstrate API usage. In this guide, we will use Python code snippets to illustrate the same functionality across both APIs. If you prefer to use cURL, you can find the equivalent commands in the AssemblyAI API Reference.

Side-by-side code comparison

Below is a side-by-side comparison of a basic snippet to transcribe pre-recorded audio with Gladia and AssemblyAI:

Gladia
AssemblyAI
1import requests
2import time
3
4base_url = "https://api.gladia.io"
5
6headers = {
7 "x-gladia-key": "<YOUR_API_KEY>"
8}
9
10with open("./my-audio.mp3", "rb") as f:
11 files = {"audio": ("my-audio.mp3", f, "audio/mp3")}
12 response = requests.post(base_url + "/v2/upload",
13 headers=headers,
14 files=files)
15
16upload_url = response.json()["audio_url"]
17
18data = {
19 "audio_url": upload_url # You can also use a URL to an audio or video file on the web.
20}
21
22url = base_url + "/v2/pre-recorded"
23response = requests.post(url, json=data, headers=headers)
24
25transcript_id = response.json()['id'] # You can also use response.json()['result_url'] to get the polling_endpoint directly.
26polling_endpoint = url + "/" + transcript_id
27
28while True:
29 transcript = requests.get(polling_endpoint, headers=headers).json()
30
31 if transcript['status'] == 'done':
32 print(f"Full Transcript: {transcript['result']['transcription']['full_transcript']}")
33 break
34
35 elif transcript['status'] == 'error':
36 raise RuntimeError(f"Transcription failed: {transcript['error_code']}")
37
38 else:
39 time.sleep(3)

Installation and authentication

Gladia
AssemblyAI
1import requests
2import time
3
4base_url = "https://api.gladia.io"
5
6headers = {
7 "x-gladia-key": "<YOUR_API_KEY>"
8}

When migrating from Gladia to AssemblyAI, you’ll first need to handle authentication:

Get your API key from your AssemblyAI dashboard.

Things to know:

  • Store your API key securely in an environment variable.
  • We support the ability to create multiple API keys and projects to help you track and manage seperate environments.

Gladia uses the x-gladia-key HTTP header for authentication, while AssemblyAI uses the authorization header.

Audio file sources

You can provide either a locally stored audio file or a publicly accessible URL.

Gladia
AssemblyAI
1# Local Files
2with open("./my-audio.mp3", "rb") as f:
3 files = {"audio": ("my-audio.mp3", f, "audio/mp3")}
4 response = requests.post(base_url + "/v2/upload",
5 headers=headers,
6 files=files)
7
8upload_url = response.json()["audio_url"]
9
10data = {
11 "audio_url": upload_url
12}
13
14#Public URLs
15audio_file = "https://assembly.ai/sports_injuries.mp3"
16
17data = {
18 "audio_url": audio_file
19}

Basic transcription and polling the transcription status

Gladia
AssemblyAI
1

Make a POST request to the /v2/pre-recorded endpoint.

1url = base_url + "/v2/pre-recorded"
2response = requests.post(url, json=data, headers=headers)
2

Every few seconds, make a GET request to the /v2/pre-recorded/:transcript_id endpoint until the transcription status is 'done'.

1transcript_id = response.json()['id'] # You can also use response.json()['result_url'] to get the polling_endpoint directly.
2polling_endpoint = url + "/" + transcript_id
3
4while True:
5 transcript = requests.get(polling_endpoint, headers=headers).json()
6
7 if transcript['status'] == 'done':
8 print(f"Full Transcript: {transcript['result']['transcription']['full_transcript']}")
9 break
10
11 elif transcript['status'] == 'error':
12 raise RuntimeError(f"Transcription failed: {transcript['error_code']}")
13
14 else:
15 time.sleep(3)
Transcription status

Note that our APIs possible values for transcription status are queued, processing, completed, and error. Check out the AssemblyAI API Reference for the full list of possible transcription status values. If you’d rather not poll the API, you can use our SDKs which handle polling internally. Alternatively, you can also use webhooks to get notified when your transcript is complete.

Here are helpful things to know when migrating your audio input handling:

  • Both AssemblyAI and Gladia allow you the option of uploading a local file or specifying a publicly accessible URL.
  • There’s no need to specify the audio format to AssemblyAI - it’s auto-detected. AssemblyAI accepts almost every audio/video file type: here is a full list of all our supported file types
  • For self-hosted or pre-signed URLs (i.e. S3), see our example in this cookbook.

Adding features

Gladia
AssemblyAI
1data = {
2 "audio_url": upload_url,
3 "diarization": True, # Speaker diarization
4 "chapterization": True, # Auto chapter detection
5 "named_entity_recognition": True # Named entity detection
6}
7
8# Access speaker labels
9for utterance in transcript['result']['transcription']['utterances']:
10 print(f"Speaker {utterance['speaker']}: {utterance['text']}")
11
12# Access auto chapters
13for chapter in transcript['result']['chapterization']['results']:
14 print(f"{chapter['start']} - {chapter['end']}: {chapter['headline']}")
15
16# Access named entities
17for entity in transcript['result']['named_entity_recognition']['results']:
18 print(entity['text'])
19 print(entity['entity_type'])
20 print(f"Timestamp: {entity['start']} - {entity['end']}\n")

Key differences:

  • Make sure to note any differences in parameters or response structure. If using Speaker Diarization, for example:
    • Parameters: AssemblyAI uses speaker_labels, while Gladia uses diarization.
    • Response: AssemblyAI uses transcript.utterances, while Gladia uses transcript.result.transcription.utterances.
  • Make sure to review each API reference for the full list of parameters and response objects.
    • AssemblyAI API Reference
    • Gladia API Reference