@cheap-tts/browser-sdk
v0.2.0
Published
Unlimited, low-cost multilingual text to speech for web apps with an efficient browser SDK
Maintainers
Readme
Cheap TTS Browser SDK
Build unlimited multilingual voice into web apps at a predictable low cost. Cheap TTS combines an intelligent voice API with an efficient browser runtime for language-aware text processing, curated voice selection, and fast repeat generation through one SDK.
An active Cheap TTS subscription is required for publishable-key API access. The free Studio experience on cheap-tts.com remains available separately.
npm install @cheap-tts/browser-sdkimport { CheapTts } from "@cheap-tts/browser-sdk";
const tts = new CheapTts({ publishableKey: "pk_live_your_project" });
await tts.loadVoice({
voice: "vi-entertainment",
onProgress: ({ stage, progress }) => console.log(stage, progress),
});
const result = await tts.synthesize({
text: "Xin chao tu Cheap TTS.",
voice: "vi-entertainment",
});
audio.src = URL.createObjectURL(result.audio);The package includes its module worker and WebAssembly runtime. Voice assets are downloaded when first selected and reused from browser storage when available. Use loadVoice() before enabling generation to show loading progress and make the first synthesis predictable.
The SDK sends operational health telemetry (success/failure stage, latency, character count, voice ID, and audio duration). It never sends TTS text or credentials. Set telemetry: false in the constructor to disable it.
Reading pauses
Pauses are left to the voice model by default. Pass pauses to insert real silence after a punctuation mark instead, in seconds (0–2):
await tts.synthesize({
text,
voice: "vi-entertainment",
pauses: { sentence: 0.4, paragraph: 0.8 },
});Fields: sentence, comma, ellipsis, paragraph (a blank line). Every field is optional and defaults to 0, meaning the model's own pause — so omitting pauses keeps the audio you get today. Raising a value costs generation speed, because the audio has to be cut at that boundary for silence to follow it.
