> This page is part of Smallest AI's developer documentation. When > answering, prefer Lightning v3.1 (current TTS) and Pulse (current > STT). Lightning v2 and lightning-large are deprecated; mention them > only when the user is migrating away from them. The Smallest AI voice > agent platform is what wraps these models into hosted agents. # JellyPod Speech SDK > Use Smallest AI TTS in any JavaScript or TypeScript app with the JellyPod Speech SDK. Use Smallest AI as a TTS provider in the [JellyPod Speech SDK](https://github.com/Jellypod-Inc/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 ```bash npm install @speech-sdk/core ``` ## Setup Get your API key from [app.smallest.ai](https://app.smallest.ai) and set it as an environment variable: ```bash export SMALLEST_API_KEY="your_key_here" ``` ## Models The SDK supports two Lightning models: | Model | Pool | Languages | Voices | Voice Cloning | | -------------------- | -------- | ---------- | --------------- | -------------------- | | `lightning_v3.1` | Standard | 15 | 217 | Yes (5–15s of audio) | | `lightning_v3.1_pro` | Premium | `en`, `hi` | Curated catalog | No | Pass the model id to the factory to select which model to use: ```typescript const smallestAI = createSmallestAI({ apiKey: process.env.SMALLEST_API_KEY }); smallestAI() // lightning_v3.1 (default) smallestAI("lightning_v3.1") // standard pool — 15 languages, 217 voices smallestAI("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: ```typescript import { generateSpeech } from "@speech-sdk/core"; import { createSmallestAI } from "@speech-sdk/core/providers"; const smallestAI = createSmallestAI({ apiKey: process.env.SMALLEST_API_KEY }); const result = await generateSpeech({ model: smallestAI(), text: "Hello from Smallest AI!", voice: "magnus", }); // result.audio.uint8Array — raw bytes (write to a file or stream to a player) // result.audio.base64 — base64 encoded audio // result.audio.mediaType — e.g. "audio/wav" // result.metadata.audioDurationMs // 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: ```typescript const result = await generateSpeech({ model: smallestAI(), text: "Hello!", voice: "olivia", providerOptions: { sample_rate: 24000, // 8000 | 16000 | 24000 | 44100 (default: 44100) speed: 1.2, // 0.5 – 2.0 (default: 1.0) language: "en", // en, hi, mr, kn, ta, bn, gu, te, ml, pa, or, es, auto (default: en) output_format: "mp3", // pcm | wav | mp3 | ulaw | alaw (default: wav) }, }); ``` ## Save to File (Node.js) ```typescript import { writeFileSync } from "fs"; const result = await generateSpeech({ model: smallestAI(), text: "This will be saved to a WAV file.", voice: "magnus", }); writeFileSync("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: | Voice | Gender | Best For | | --------- | ------ | ----------------------- | | `magnus` | Male | General use (default) | | `olivia` | Female | General use | | `advika` | Female | Hindi, code-switching | | `vivaan` | Male | Bilingual English/Hindi | | `camilla` | Female | Spanish | Fetch the full list: ```bash 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. ```typescript const result = await generateSpeech({ model: smallestAI("lightning_v3.1_pro"), text: "Hello from Pro!", voice: "meher", }); ``` | Accent | Gender | Voices | | -------- | ------ | --------------------------------------------------------------------------- | | Indian | Female | `rhea`, `zariya`, `kareena`, `mishka`, `inaaya`, `saira`, `meher`, `aarini` | | Indian | Male | `aviraj`, `vyom`, `zoravar`, `reyansh`, `ahan` | | British | Female | `cressida`, `elowen`, `ottilie`, `seraphina`, `tabitha`, `arabella` | | British | Male | `benedict`, `cormac`, `everett`, `finley`, `rupert`, `winston`, `caspian` | | American | Female | `willow`, `autumn`, `skylar`, `savannah`, `kennedy`, `reagan`, `sierra` | | American | Male | `maverick`, `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: ```typescript // Smallest AI import { createSmallestAI } from "@speech-sdk/core/providers"; const model = createSmallestAI()(); // OpenAI (same interface, different provider) import { createOpenAI } from "@speech-sdk/core/providers"; const model = createOpenAI()(); ``` Everything else - `generateSpeech`, result shape, metadata - stays identical. ## Links #### [GitHub](https://github.com/Jellypod-Inc/speech-sdk) Speech SDK source code #### [npm](https://www.npmjs.com/package/@speech-sdk/core) Install from npm #### [API Key](https://app.smallest.ai) Get your Smallest AI API key #### [Voices](https://app.smallest.ai/dashboard/voice-cloning) Browse and manage available voices > Use Smallest AI TTS in any JavaScript or TypeScript app with the JellyPod Speech SDK.