Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Google TTS (Text-To-Speech) for node.js
| Date | Stars |
|---|---|
| 2026-07-24 | 287 |
| 2026-07-25 | 286 |
| 2026-07-28 | 286 |
| 2026-07-30 | 286 |
| 2026-07-31 | 286 |
| 2026-08-07 | 286 |
| 2026-09-10 | 287 |
| 2026-09-20 | 287 |
Today
— stars today
This week
— stars this week
This month
+1 stars this month
Momentum
0.0
growth rate 0.00%/day
# google-tts
Google TTS (Text-To-Speech) for node.js
[![][npm-img]][npm-url]
[![][dependency-img]][dependency-url]
[![][dependency-dev-img]][dependency-dev-url]
[![][install-size-img]][install-size-result]
[![][gh-action-img]][gh-action-url]
[![][coverage-img]][coverage-url]
## Installation
```bash
$ npm install --save google-tts-api
$ npm install -D typescript @types/node # Only for TypeScript
```
## Change Log
Please see [CHANGELOG](https://github.com/zlargon/google-tts/blob/master/CHANGELOG.md).
## Usage
| Method | Options (all optional) | Return Type | Handle Long Text |
| ------------------- | ----------------------------------------------- | --------------------------------------------------- | :--------------: |
| `getAudioUrl` | `lang`, `slow`, `host` | `string` | |
| `getAudioBase64` | `lang`, `slow`, `host`, `timeout` | `Promise<string>` | |
| `getAllAudioUrls` | `lang`, `slow`, `host`, `splitPunct` | `{ shortText: string; url: string; }[]` | ✅ |
| `getAllAudioBase64` | `lang`, `slow`, `host`, `timeout`, `splitPunct` | `Promise<{ shortText: string; base64: string; }[]>` | ✅ |
### Options (all optional)
| Option | Type | Default | Description |
| ------------ | --------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `lang` | `string` | en | See all avaiable language code at https://cloud.google.com/speech/docs/languages |
| `slow` | `boolean` | false | Use the slow audio speed if set `slow` to `true` |
| `host` | `string` | https://translate.google.com | You can change the `host` if the default host could not work in your region (e.g. https://translate.google.com.cn). |
| `timeout` | `number` | 10000 (ms) | (Only for `getAudioBase64` and `getAllAudioBase64`) Set timeout for the HTTP request. |
| `splitPunct` | `string` | | (Only for `getAllAudioUrls` and `getAllAudioBase64`) Set the punctuation to split the long text to short text. (e.g. ",、。") |
## Examples
### 1. `getAudioUrl(text, [option])`
```js
import * as googleTTS from 'google-tts-api'; // ES6 or TypeScript
const googleTTS = require('google-tts-api'); // CommonJS
// get audio URL
const url = googleTTS.getAudioUrl('Hello World', {
lang: 'en',
slow: false,
host: 'https://translate.google.com',
});
console.log(url); // https://translate.google.com/translate_tts?...
```
### 2. `getAudioBase64(text, [option])`
```js
import * as googleTTS from 'google-tts-api'; // ES6 or TypeScript
const googleTTS = require('google-tts-api'); // CommonJS
// get base64 text
googleTTS
.getAudioBase64('Hello World', {
lang: 'en',
slow: false,
host: 'https://translate.google.com',
timeout: 10000,
})
.then(console.log) // base64 text
.catch(console.error);
```
### 3. `getAllAudioUrls(text, [option])` (For text longer than 200 characters)
```js
import * as googleTTS from 'google-tts-api'; // ES6 or TypeScript
const googleTTS = require('google-tts-api'); // CommonJS
const results = googleTTS.getAllAudioUrls('LONG_TEXT_...', {
lang: 'en',
slow: false,
host: 'https://translate.google.com',
splitPunct: ',.?',
});
console.log(results);
// [
// { shortText: '...', url: '...' },
// { shortText: '.Excerpt of 5,505 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:c2eea7d65e4e69c2, topic:text-to-speech, topic:tts, desc:text-to-speech