JellyPod Speech SDK

View as Markdown

Use Smallest AI as a TTS provider in the JellyPod Speech SDK — a universal, cross-platform TypeScript SDK that works in Node.js, edge runtimes, and the browser. Switch between providers without changing your application code.

Installation

$npm install @speech-sdk/core

Setup

Get your API key from app.smallest.ai and set it as an environment variable:

$export SMALLEST_API_KEY="your_key_here"

Generate Speech

Add this inside any TypeScript/JavaScript file in your project — an API route, a server action, a backend script, or a CLI tool:

1import { generateSpeech } from "@speech-sdk/core";
2import { createSmallestAI } from "@speech-sdk/core/providers";
3
4const smallestAI = createSmallestAI({ apiKey: process.env.SMALLEST_API_KEY });
5
6const result = await generateSpeech({
7 model: smallestAI(),
8 text: "Hello from Smallest AI!",
9 voice: "magnus",
10});
11
12// result.audio.uint8Array — raw bytes (write to a file or stream to a player)
13// result.audio.base64 — base64 encoded audio
14// result.audio.mediaType — e.g. "audio/wav"
15// result.metadata.audioDurationMs
16// result.metadata.latencyMs

The createSmallestAI() factory reads SMALLEST_API_KEY from the environment automatically if no apiKey is passed.

Provider Options

All parameters are optional. Pass them via providerOptions to override defaults:

1const result = await generateSpeech({
2 model: smallestAI(),
3 text: "Hello!",
4 voice: "olivia",
5 providerOptions: {
6 sample_rate: 24000, // 8000 | 16000 | 24000 | 44100 (default: 44100)
7 speed: 1.2, // 0.5 – 2.0 (default: 1.0)
8 language: "en", // en | hi | es | ta | auto (default: auto)
9 output_format: "mp3", // pcm | wav | mp3 | mulaw (default: wav)
10 },
11});

Save to File (Node.js)

1import { writeFileSync } from "fs";
2
3const result = await generateSpeech({
4 model: smallestAI(),
5 text: "This will be saved to a WAV file.",
6 voice: "magnus",
7});
8
9writeFileSync("output.wav", result.audio.uint8Array);

Available Voices

80+ voices across English, Hindi, Spanish, and Tamil. A few popular ones:

VoiceGenderBest For
magnusMaleGeneral use (default)
oliviaFemaleGeneral use
advikaFemaleHindi, code-switching
vivaanMaleBilingual English/Hindi
camillaFemaleSpanish

Fetch the full list:

$curl "https://api.smallest.ai/waves/v1/lightning-v3.1/get_voices" \
> -H "Authorization: Bearer $SMALLEST_API_KEY"

Switching Providers

One of the main benefits of the Speech SDK is swapping providers without changing application logic. To switch away from Smallest AI, replace the factory import:

1// Smallest AI
2import { createSmallestAI } from "@speech-sdk/core/providers";
3const model = createSmallestAI()();
4
5// OpenAI (same interface, different provider)
6import { createOpenAI } from "@speech-sdk/core/providers";
7const model = createOpenAI()();

Everything else — generateSpeech, result shape, metadata — stays identical.