Skip to main content

Overview

The NanoGPT TTS API allows you to convert text into natural-sounding speech using various models from different providers. The API supports multiple languages, voices, and customization options including speed control, voice instructions, and audio format selection. For voice cloning (create a reusable custom voice from a reference clip), see api-reference/endpoint/voice-cloning.mdx.

Music generation

NanoGPT also supports text-to-music generation via the OpenAI-compatible POST /v1/audio/speech endpoint when you use a music model. See api-reference/music-generation.mdx.

Available Models

  • Kokoro-82m: High-quality multilingual model with 44 voices ($0.001/1k chars)
  • Elevenlabs-Turbo-V2.5: Premium quality with 46 voices and style controls ($0.06/1k chars)
  • Elevenlabs-V3: ElevenLabs expressive model family
  • tts-1: OpenAI’s standard quality model with low latency ($0.015/1k chars)
  • tts-1-hd: OpenAI’s high definition model ($0.030/1k chars)
  • gpt-4o-mini-tts: Ultra-low cost OpenAI model ($0.0006/1k chars)
  • MiniMax Speech models: Supports cloned voices via custom voice IDs
  • Qwen-3-TTS-1.7B: Supports cloned voices via speaker embeddings

Streaming support in POST /v1/audio/speech

Set stream: true to request chunked audio streaming. Default remains buffered (stream: false). Other TTS models (for example Kokoro, Gemini, Qwen, MiniMax, Inworld) ignore stream and return buffered audio.

Authentication

All requests require authentication via API key:

Synchronous vs Asynchronous

  • Synchronous: POST /v1/audio/speech returns audio bytes directly. Best for UI playback and short prompts. See api-reference/endpoint/speech.mdx.
  • Asynchronous: POST /tts returns a ticket; poll GET /tts/status for completion. Best for long audio, batch jobs, and webhook workflows.

Basic Text-to-Speech

Simple TTS Request

Async Status & Polling

Some TTS models (e.g., Elevenlabs family) run asynchronously. If POST /api/tts returns HTTP 202 with status: "pending", poll GET /api/tts/status?runId=...&model=... until you receive status: "completed" with an audioUrl. See endpoint details in GET /api/tts/status.

Model-Specific Examples

Kokoro-82m - Multilingual Voices

Kokoro supports 44 voices across 13 language groups:

Elevenlabs-Turbo-V2.5 - Premium Quality with Controls

Elevenlabs offers advanced voice control options:

OpenAI Models - Multiple Formats and Instructions

OpenAI models support various audio formats and voice instructions:

Complete TTS Class Implementation

Here’s a comprehensive TTS class with all model support:

Best Practices and Tips

Character Limits and Costs

Voice Selection Guide

Error Handling and Troubleshooting

Pricing Summary