Skip to navigation

SDK: New Typescript SDK

We’ve published a new Typescript SDK. Try it out:

npm install @speechify/api

Together with the release, the old @speechify/api-sdk package is now deprecated.

Migrating from @speechify/api-sdk

The JWT-based authentication endpoint has been deprecated. This means that the auto-refresh token feature has also been removed in the new SDK.

  • How to call individual endpoints is available in the API Explorer. Switch to the Typescript SDK tab to see the snippet.
  • The full implementation of the new SDK is available in the GitHub repository.

Quick Start Guide

1

Install the SDK

Install the package using npm:

npm install @speechify/api
2

Initialize the Client

Import the SDK and create a new client instance:

import { SpeechifyClient } from "@speechify/api";
// API Key can also be set as an environment variable SPEECHIFY_API_KEY
const client = new SpeechifyClient({ token: "your-api-key" });
3

Fetch Available Voices

Get a list of all available voices:

const voices = await client.tts.voices.list();
4

Generate Speech

Create a new speech synthesis request using a voice:

const result = await client.tts.audio.speech({
voiceId: voices[0].id,
input: "Hello, world!",
});
5

Save the Audio

This is now an additional required step since the SDK only returns the raw audio data i.e. a string representing the base64 encoded bytes. Convert the audio data and save it to a file:

const audioData = result.audioData;
const audioBuffer = Buffer.from(audioData, "base64");
// Write the binary data to a file
fs.writeFileSync("speech.mp3", audioBuffer);

API: Deprecated POST /v1/auth/token endpoint

The POST /v1/auth/token endpoint is now deprecated. We will only support API Key authentication moving forward.


2026-08-14: SDK repo moved to speechify-ai/sdk-typescript