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"

Models

The SDK supports two Lightning models:

ModelPoolLanguagesVoicesVoice Cloning
lightning_v3.1Standard15217Yes (5–15s of audio)
lightning_v3.1_proPremiumen, hiCurated catalogNo

Pass the model id to the factory to select which model to use:

1const smallestAI = createSmallestAI({ apiKey: process.env.SMALLEST_API_KEY });
2
3smallestAI() // lightning_v3.1 (default)
4smallestAI("lightning_v3.1") // standard pool — 15 languages, 217 voices
5smallestAI("lightning_v3.1_pro") // premium pool — curated American, British, Indian voices

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, mr, kn, ta, bn, gu, te, ml, pa, or, es, auto (default: en)
9 output_format: "mp3", // pcm | wav | mp3 | ulaw | alaw (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

Standard Pool (lightning_v3.1)

217 voices across English, Hindi, Spanish, and 9 Indian languages. Default voice: magnus. 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"

Premium Pool (lightning_v3.1_pro)

Curated catalog with American, British, and Indian accents. Default voice: meher. Indian voices code-switch between English and Hindi; British and American voices are English-only.

1const result = await generateSpeech({
2 model: smallestAI("lightning_v3.1_pro"),
3 text: "Hello from Pro!",
4 voice: "meher",
5});
AccentGenderVoices
IndianFemalerhea, zariya, kareena, mishka, inaaya, saira, meher, aarini
IndianMaleaviraj, vyom, zoravar, reyansh, ahan
BritishFemalecressida, elowen, ottilie, seraphina, tabitha, arabella
BritishMalebenedict, cormac, everett, finley, rupert, winston, caspian
AmericanFemalewillow, autumn, skylar, savannah, kennedy, reagan, sierra
AmericanMalemaverick, brooks, hunter, colton, wesley, asher

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.