https://github.com/transitive-bullshit/unrealspeech-api
TypeScript client for the Unreal Speech TTS API.
https://github.com/transitive-bullshit/unrealspeech-api
text-to-speech tts tts-api
Last synced: 4 months ago
JSON representation
TypeScript client for the Unreal Speech TTS API.
- Host: GitHub
- URL: https://github.com/transitive-bullshit/unrealspeech-api
- Owner: transitive-bullshit
- License: mit
- Created: 2024-10-07T20:46:59.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-08T04:44:44.000Z (over 1 year ago)
- Last Synced: 2025-10-03T09:23:09.518Z (9 months ago)
- Topics: text-to-speech, tts, tts-api
- Language: TypeScript
- Homepage: https://docs.unrealspeech.com/reference/getting-started-with-our-api
- Size: 64.5 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license
Awesome Lists containing this project
README
# unrealspeech-api
> TypeScript client for the [Unreal Speech](https://unrealspeech.com/) [TTS API](https://docs.unrealspeech.com/reference/getting-started-with-our-api).
- [Intro](#intro)
- [Why?](#why)
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Intro
This package is a rewrite of https://github.com/unrealspeech/unrealspeech-js to expose a more standards-based TS package for the [Unreal Speech](https://unrealspeech.com/) [TTS API](https://docs.unrealspeech.com/reference/getting-started-with-our-api).
## Why?
Their first-party JS package has several issues:
- it has a bogus dependency on `fs` which doesn't inspire confidence
- it uses `node-fetch` instead of universal `fetch`
- it includes additional Node.js-specific functionality related to playing media via ffmpeg, which doesn't belong in this type of NPM package
- some of the types are also incorrect
- [ky](https://github.com/sindresorhus/ky) handles automatic retries, is very customizable, and is built on top of `fetch`
## Install
```sh
npm install unrealspeech-api
```
This package is [ESM-only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). If your project uses CommonJS, consider switching to ESM or use [dynamic `import()`](https://v8.dev/features/dynamic-import).
## Usage
```ts
import { UnrealSpeechClient } from 'unrealspeech-api'
const unrealSpeech = new UnrealSpeechClient({
apiKey: process.env.UNREAL_SPEECH_API_KEY
})
const shortResult = await unrealSpeech.stream({
text: 'Hello, World!',
voiceId: 'Scarlett'
})
console.log(shortResult)
const mediumResult = await unrealSpeech.speech({
text: 'Hello, World! ...',
voiceId: 'Scarlett'
})
console.log(mediumResult)
const synthesisTask = await unrealSpeech.createSynthesisTask({
text: 'Hello, World! ...',
voiceId: 'Scarlett'
})
console.log(synthesisTask)
const updatedSynthesisTask = await unrealSpeech.getSynthesisTask(
synthesisTask.TaskId
)
consolelog(updatedSynthesisTask)
```
## License
MIT © [Travis Fischer](https://x.com/transitive_bs)
If you found this project interesting, [consider following me on Twitter](https://x.com/transitive_bs).