Skip to main content
The SDK simplifies pre-recorded speech-to-text by abstracting upload, job creation, and result retrieval. Designed for developers, it offers:
  • A transcribe() for an end-to-end flow
  • Individual steps when you need control over each step.

Install the SDK

npm install @gladiaio/sdk

Transcribe in one call

End-to-end transcription — from upload to result in one call.
Pass in a local file, binary data, or a remote URL — and let the method handle the rest.
from gladiaio_sdk import GladiaClient

gladia_client = GladiaClient(api_key="YOUR_GLADIA_API_KEY").prerecorded()

transcription = gladia_client.transcribe("YOUR_AUDIO_URL_OR_LOCAL_PATH")
With customizable features:
from gladiaio_sdk import GladiaClient

gladia_client = GladiaClient(api_key="YOUR_GLADIA_API_KEY").prerecorded()

transcription = gladia_client.transcribe(
    "YOUR_AUDIO_URL_OR_LOCAL_PATH",
    {
        "language_config": {
            "languages": ["en", "fr"],
            "code_switching": True,
        },
        "custom_vocabulary": True,
        "custom_vocabulary_config": {
            "vocabulary": ["Gladia", "Solaria", "Salesforce"],
        },
    },
)
Want to go further? See Audio Intelligence for add-ons like:

Individual steps

The building blocks behind transcribe() — upload audio, create a job, then retrieve the result when you need finer control over the flow.

Upload your audio

Upload a local file and pass the returned audio_url to the next step.
from gladiaio_sdk import GladiaClient

gladia_client = GladiaClient(api_key="YOUR_GLADIA_API_KEY").prerecorded()

upload_response = gladia_client.upload_file("YOUR_LOCAL_PATH")
Example response:
{
  "audio_url": "https://api.gladia.io/file/636c70f6-92c1-4026-a8b6-0dfe3ecf826f",
  "audio_metadata": {
    "id": "636c70f6-92c1-4026-a8b6-0dfe3ecf826f",
    "filename": "your_audio_file.mp3",
    "extension": "mp3",
    "size": 99515383,
    "audio_duration": 4146.468542,
    "number_of_channels": 2
  }
}

Create a transcription job

Pass the audio_url from the previous step along with your transcription options.
from gladiaio_sdk import GladiaClient

gladia_client = GladiaClient(api_key="YOUR_GLADIA_API_KEY").prerecorded()

job = gladia_client.create(
    {
    "audio_url": "YOUR_AUDIO_URL",
    "language_config": {
    "languages": ["en", "fr"],
    "code_switching": True,
  },
  "custom_vocabulary": True,
  "custom_vocabulary_config": {
    "vocabulary": ["Gladia", "Solaria", "Salesforce"],
      },
    }
)

Get the transcription result

You can get your transcription results in 3 different ways:
from gladiaio_sdk import GladiaClient

gladia_client = GladiaClient(api_key="YOUR_GLADIA_API_KEY").prerecorded()

# Use job.id from gladia_client.create(...)
result = gladia_client.poll("YOUR_TRANSCRIPTION_JOB_ID")

print(result.result.transcription.full_transcript)
You can use create_and_poll() in Python or createAndPollUntyped() in JavaScript to create and poll in one call with the same job payload.
The methods implemented in the sdk are automatically polling until success or errors. To get the result with the cURL, you’ll just have to GET continuously on the given result_url until the status of your transcription is done.You can get more information on the different transcriptions status by checking directly the API Reference.
You can configure webhooks at https://app.gladia.io/webhooks to be notified when your transcriptions are done.Once a transcription is done, a POST request will be made to the endpoint you configured. The request body is a JSON object containing the transcription id that you can use to retrieve your result with our API.
For the full body definition, check our API definition.
Callback are HTTP calls that you can use to get notified when your transcripts are ready.Instead of polling and keeping your server busy and maintaining work, you can use the callback feature to receive the result to a specified endpoint:
{
  "audio_url": "YOUR_AUDIO_URL",
  "callback": true,
  "callback_config": {
    "url": "https://yourserverurl.com/your/callback/endpoint/",
    "method": "POST"
  }
}
Once the transcription is done, a request will be made to the url you provided in callback_config.url using the HTTP method you provided in callback_config.method. Allowed methods are POST and PUT with the default being POST.The request body is a JSON object containing the transcription id and an event property that tells you if it’s a success or an error.
For file size, duration, and concurrency limits, see Supported files & duration and Concurrency and rate limits.
Want to know more about a specific feature? Check out our Features chapter for more details.

Full code sample

You can find complete code samples in our Github repository: