# @gladiaio/sdk

> Gladia JavaScript/TypeScript SDK

Latest version **2.2.1** (published 2026-10-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gladiaio/sdk
pnpm add @gladiaio/sdk
yarn add @gladiaio/sdk
bun add @gladiaio/sdk
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2026-10-23 |
| First published | 2025-09-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20 |
| Dependencies | 0 |
| Unpacked size | 868.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 4 |
| Author | Gladia |
| Maintainers | clement-gladia, gladia-admin, commarla, hugo_gladia, tnesztler, amorin_gladia, thibautlb, remigladia, acorbeau-gladia, jqueguiner, hpapier.ext.gladia, bhays, glacoste, clafaye, opopops, bot-npmjs-gladiaio, rpiotaix, yoannkygladia, cpire |
| Keywords | gladia, sdk, typescript, javascript |

## Links

- npm: https://www.npmjs.com/package/@gladiaio/sdk
- Repository: https://github.com/gladiaio/sdk
- Homepage: https://github.com/gladiaio/sdk#readme
- Issues: https://github.com/gladiaio/sdk/issues
- npm.io page: https://npm.io/package/@gladiaio/sdk

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 2.2.1 (latest) — 2026-10-23
- 2.2.0 — 2026-10-13
- 2.1.0 — 2026-09-21
- 2.0.0 — 2026-09-09
- 1.1.0 — 2026-07-23
- 1.0.7 — 2026-06-29
- 1.0.5 — 2026-06-17
- 1.0.4 — 2026-04-17
- 1.0.0 — 2026-03-26
- 0.6.1 — 2025-11-28
- 0.6.0 — 2025-10-28
- 0.5.3 — 2025-10-24
- 0.5.2 — 2025-10-08
- 0.5.1 — 2025-09-30
- 0.5.0 — 2025-09-25
- … 11 more at https://npm.io/package/@gladiaio/sdk/versions

## README

# Gladia JavaScript SDK

A TypeScript/JavaScript SDK for the [Gladia](https://www.gladia.io/) API.

## Requirements

For non-browser environment, you need either **Node.js 20+** or **Bun** .

## Installation

```bash
npm install @gladiaio/sdk
```

If you are using Node.js < 22, you also need to install the `ws` package:

```bash
npm install ws
```

## Usage

Import **`GladiaClient`** and create an instance.

Provide an API key with **`apiKey`** or the **`GLADIA_API_KEY`** environment variable. [Get your API key here](https://docs.gladia.io/chapters/introduction/getting-started) in under a minute.

You can also set **`GLADIA_API_URL`**. For live sessions, **`GLADIA_REGION`** (`eu-west` / `us-west`) is passed only on session creation (`POST /v2/live`).

### Node.js / Browser (ESM)

```typescript
import { GladiaClient } from '@gladiaio/sdk'

const gladiaClient = new GladiaClient({
  apiKey: 'your-api-key',
})
```

### Node.js (CommonJS)

```javascript
const { GladiaClient } = require('@gladiaio/sdk')

const gladiaClient = new GladiaClient({
  apiKey: 'your-api-key',
})
```

### Browser (script tag)

```html
<script src="https://unpkg.com/@gladiaio/sdk"></script>

<script>
  const gladiaClient = new Gladia.GladiaClient({
    apiKey: 'your-api-key',
  })
</script>
```

## Pre-recorded transcription

**`transcribe()`** accepts a file path (Node), **`http(s)` URL**, **`File`**, or **`Blob`**. It uploads when needed, then polls until the job completes.

```typescript
import { GladiaClient } from '@gladiaio/sdk'
import 'dotenv/config'

const gladiaClient = new GladiaClient()
const audioPath = '../data/online-meeting-example.mp4'

const result = await gladiaClient.preRecorded().transcribe(audioPath, {
  language_config: { languages: ['en'] },
})

console.log(result.result?.transcription?.full_transcript ?? '')
```

See all [supported languages here](https://docs.gladia.io/chapters/language/supported-languages) !

Pass the **options** argument to enable features from **[Audio intelligence](https://docs.gladia.io/chapters/pre-recorded-stt/audio-intelligence)** such as diarization, translation, PII redaction, and much more.

### Async pre-recorded

If your runtime has no top-level `await`, wrap calls in an **`async`** function:

```typescript
async function main() {
  const gladiaClient = new GladiaClient()
  const result = await gladiaClient.preRecorded().transcribe('./audio.mp3')
  console.log(result.result?.transcription?.full_transcript ?? '')
}

main().catch(console.error)
```

## Live transcription

```javascript
const liveSession = gladiaClient.liveV2().startSession({
  model: 'solaria-1',
  encoding: 'wav/pcm',
  sample_rate: 16000,
  bit_depth: 16,
  channels: 1,
  language_config: {
    languages: ['en'],
  },
  messages_config: {
    receive_partial_transcripts: true,
  },
})

liveSession.on('message', (message) => {
  if (message.type === 'transcript') {
    console.log(`${message.data.is_final ? 'F' : 'P'} | ${message.data.utterance.text.trim()}`)
  }
})

liveSession.once('started', () => {
  console.log(`Session ${liveSession.sessionId} started`)
})

liveSession.on('error', (err) => {
  console.error('An error occurred during live session:', err)
})

liveSession.once('ended', () => {
  console.log(`Session ${liveSession.sessionId} ended`)
})

liveSession.sendAudio(/* <audio_chunk> */)
liveSession.stopRecording()
```

See all the [supported languages here](https://docs.gladia.io/chapters/language/supported-languages) !

Pass the **options** argument to enable features from **[Audio intelligence](https://docs.gladia.io/chapters/live-stt/audio-intelligence)** such as diarization, translation, PII redaction, and much more.

### Waiting for the session to finish

To **`await`** shutdown after **`stopRecording()`**, wait on the **`ended`** event:

```typescript
import { GladiaClient } from '@gladiaio/sdk'

async function runLive() {
  const gladiaClient = new GladiaClient({ apiKey: 'your-api-key' })
  const liveSession = gladiaClient.liveV2().startSession({
    language_config: { languages: ['en'] },
  })

  const ended = new Promise<void>((resolve) => {
    liveSession.once('ended', () => resolve())
  })

  liveSession.stopRecording()
  await ended
}

runLive().catch(console.error)
```

When you need the session id as soon as the backend has created the session:

```typescript
const sessionId = await liveSession.getSessionId()
```

## Documentation

- [Pre-recorded quickstart](https://docs.gladia.io/chapters/pre-recorded-stt/quickstart)
- [Live quickstart](https://docs.gladia.io/chapters/live-stt/quickstart)

## License

MIT

---
_Source: https://npm.io/package/@gladiaio/sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
