The Gladia SDK for Python provides a robust interface to Gladia's Speech-to-Text (STT) API, enabling both real-time and pre-recorded audio transcription. It simplifies complex tasks such as audio file uploading, job creation, and result retrieval. The SDK integrates features like speaker diarization, language translation, PII redaction, and custom vocabulary to enhance transcription accuracy and utility. Currently at version 1.0.1, Gladia maintains an active development cycle for its SDKs and underlying API, with a focus on continuous improvement.
Install & Compatibility
Where this runs
tested against v1.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.9
✕ build_error
✕ build_error
23MB installed
● package 23MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
from gladiaio_sdk import GladiaClient
This quickstart demonstrates how to transcribe a pre-recorded audio file or URL using the Gladia Python SDK. It initializes the client with an API key from environment variables and then calls the `transcribe` method, including examples of language configuration and custom vocabulary for enhanced accuracy.
import os
from gladia import GladiaClient
# Ensure GLADIA_API_KEY is set in your environment variables
gladia_api_key = os.environ.get("GLADIA_API_KEY")
if not gladia_api_key:
raise ValueError("GLADIA_API_KEY environment variable not set. Please set your Gladia API key.")
gladia_client = GladiaClient(api_key=gladia_api_key)
# Replace with your audio file path or a publicly accessible URL
# Example: audio_source = "./path/to/your/audio.wav"
audio_source = "https://gladia.io/sample-audio/podcast_excerpt.mp3"
try:
print(f"Transcribing audio from: {audio_source}")
transcription = gladia_client.preRecorded().transcribe(
audio_source,
language_config={
"languages": ["en", "fr"],
"code_switching": True,
},
# Enable custom vocabulary for better accuracy on specific terms
custom_vocabulary=True,
custom_vocabulary_config={
"vocabulary": ["Gladia", "Solaria", "Salesforce"],
},
)
print("Transcription successful!")
print(f"Full Transcript: {transcription.result.transcription.full_transcript}")
except Exception as e:
print(f"An error occurred during transcription: {e}")
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.