0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
mastra/voice/gladia
History 2026-10-28 13:15:52 +00:00
..
__fixtures__ feat(voice) : Add Gladia speech to text service (#4459) 2025-06-16 09:45:03 -07:00
src Extract voice internals from core (#16725) 2026-05-27 16:37:08 +02:00
CHANGELOG.md chore: version - exit prerelease mode 2026-10-28 13:15:52 +00:00
lint-staged.config.js refactor(lint): replace ESLint with type-aware oxlint (#27476) 2026-10-18 10:38:35 -07:00
package.json chore: version - exit prerelease mode 2026-10-28 13:15:52 +00:00
README.md docs: add MySQL, Gladia, and ModelsLab integrations (#22965) 2026-09-03 11:44:42 +02:00
tsconfig.build.json chore: fix go-to-definition using tsc declaration maps (#6089) 2025-07-30 15:41:00 -07:00
tsconfig.json chore: migrate package builds to tsdown (#19829) 2026-07-28 12:32:21 +02:00
tsdown.config.ts chore: migrate package builds to tsdown (#19829) 2026-07-28 12:32:21 +02:00
vitest.config.ts refactor: reorganize core tests and namespace vitest projects across monorepo (#12662) 2026-02-09 10:24:48 +01:00

@mastra/voice-gladia

Gladia speech-to-text integration for Mastra. Use it to transcribe prerecorded audio streams with optional speaker diarization, translation, language detection, and code-switching support.

Installation

npm install @mastra/voice-gladia

Usage

Set GLADIA_API_KEY, then pass a readable audio stream with its file name and MIME type.

import { createReadStream } from 'node:fs';
import { GladiaVoice } from '@mastra/voice-gladia';

const voice = new GladiaVoice();
const audio = createReadStream('./audio.m4a');

const transcript = await voice.listen(audio, {
  fileName: 'audio.m4a',
  mimeType: 'audio/mp4',
  options: {
    diarization: true,
    detect_language: true,
  },
});

console.log(transcript);

Documentation

See the Gladia voice integration guide and the Mastra Voice overview.

GladiaVoice is a listening-only MastraVoice provider. listen() buffers and uploads the supplied audio stream, starts a Gladia prerecorded-transcription job, polls until processing finishes, and returns the full transcript. Both fileName and mimeType are required.

Diarization is enabled by default. Use diarization_config to set an exact, minimum, or maximum number of speakers. Translation can be enabled with the base or enhanced model and one or more target languages. The provider also supports automatic language detection and code switching for recordings that contain multiple languages.

The API key can be supplied as listeningModel.apiKey or through GLADIA_API_KEY. Gladia does not provide text-to-speech through this package; calling speak() throws an error.

Changelog

See the package changelog for version history and release notes.

Support

We have an open community Discord. Come and say hello and let us know if you have any questions or need any help getting things running.