← all repositories
pndurette/gTTS

Google Translate's voice, smuggled out as a Python library

A decade-old wrapper that turns Google's undocumented speech endpoint into MP3s, for when you need TTS without the cloud bill.

2.6k stars Python Image · Video · Audio
gTTS
Velocity · 7d
+0.6
★ / day
Trend
steady
star history

What it does

gTTS is a Python library and CLI that hits the undocumented speech endpoint inside Google Translate and writes the resulting MP3 to a file, a bytestream, or stdout. It handles the tokenization and text chunking so you can feed it arbitrarily long text without losing intonation on abbreviations or decimals.

The interesting bit

The project survives by reverse-engineering a consumer web feature, not by using Google’s official Cloud Text-to-Speech API. That means no API keys, no billing, and no SLA — just the quiet hope that Google doesn’t shuffle its internal endpoints again.

Key highlights

  • CLI and module interfaces; gtts-cli 'hello' --output hello.mp3 is the whole incantation
  • Customizable sentence tokenizer for long-text handling without robotic pauses
  • Text pre-processor hooks for pronunciation tweaks (e.g., forcing how acronyms sound)
  • Outputs to files, file-like objects, or stdout for piping into other tools
  • MIT licensed, actively maintained since 2014

Caveats

  • Explicitly not affiliated with Google; upstream breaking changes “can occur without notice”
  • Uses an undocumented endpoint, so reliability is best-effort
  • Different feature set and voice quality from the official Google Cloud Text-to-Speech product

Verdict

Worth a look if you need quick, free TTS for a side project, accessibility script, or audio pipeline prototype. Skip it if you need guaranteed uptime, voice customization, or anything that might end up in production without a fallback plan.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.