Text-to-Speech API Quickstart Guide for Developers

By ReadRhythm editorial team · Updated 2026-11-19

This guide shows indie developers how to integrate ReadRhythm’s text-to-speech API using the OpenAI SDK or cURL. You will learn to authenticate, send requests, and handle responses with concrete examples. The API uses a standard endpoint shape, so you can switch providers without rewriting your client code.

We cover key details like character limits, voice presets, and rate limits. You will see how to configure languages, manage errors, and choose output formats. This page is designed for developers who need reliable audio generation for blogs or plugins without complex integrations or unnecessary features.

Text-to-Speech API Quickstart Guide for Developers

Frequently asked questions

What is the base URL?

The base URL for the API is https://api.4777bdt.cc/v1. You use this endpoint for speech synthesis requests. Ensure your requests target this specific domain to route correctly through the ReadRhythm infrastructure.

Which SDKs are supported?

We do not provide an official SDK. However, because our request shape matches the OpenAI speech endpoint, any official OpenAI SDK works by changing the base_url to https://api.4777bdt.cc/v1. You can use Python, Node.js, or other language bindings.

How do I set the voice?

Include the voice field in your JSON body with one of eight presets: aria, nova, luna, sage, felix, milo, atlas, or orion. You can retrieve the full list of available voices by sending a GET request to /v1/voices.

Can I use the OpenAI Python SDK?

Yes. Install the official OpenAI Python SDK and initialize the client with base_url set to https://api.4777bdt.cc/v1. Use your API key for authentication. The SDK handles the request format automatically, requiring only the model, input text, and voice parameters.

What happens if I exceed the rate limit?

The limit is 60 requests per minute per key (10 before the first top-up). If you exceed this, subsequent requests will be rejected until the window resets. Requests are processed sequentially, so high volume may also cause queuing delays during peak load.

How do I handle errors?

The API returns standard HTTP status codes indicating success or failure. If synthesis fails, the charge is returned in full. Check the response body for error details to debug issues like invalid parameters or network problems during the request lifecycle.

Is the API compatible with Node.js?

Yes. Use the official OpenAI Node.js SDK or plain HTTP requests. Set the base_url to https://api.4777bdt.cc/v1 and provide your Bearer token. The request body structure mirrors OpenAI’s, ensuring seamless integration into your Node.js applications without custom adapters.

Can I stream the audio?

No. The API returns the complete audio file in the response body. There is no WebSocket or streaming endpoint for partial audio. You must wait for the full synthesis to complete before receiving the audio data, which may take time for long texts.

What is the max character limit?

Each request supports up to 4096 characters of input text. For longer texts, split the content into chunks of this size, generate audio for each part, and join the resulting audio files. Spaces and punctuation count toward this limit.

How do I rotate my API key?

You can issue a new key at any time from your account dashboard. The new key becomes active immediately, and the old key stops working at once. This allows seamless rotation without downtime, ensuring your integrations continue to function without interruption.

Does the API support SSML?

No. The API accepts plain text input only. There is no support for SSML tags, phoneme dictionaries, or custom pronunciation lexicons. You must format your text as plain strings, relying on the engine’s natural language processing for pacing and intonation.

Can I send audio back as JSON?

No. The audio is returned as binary data in the response body, typically in formats like mp3, wav, opus, flac, or pcm. It is not encoded as base64 within a JSON object. You must handle the binary stream directly in your client.

How do I specify a language?

Include the optional language field with an ISO code (e.g., 'fr', 'de', 'ja'). If omitted, the system guesses the language from the script, defaulting to English for Latin text. Explicitly setting it ensures correct pronunciation for non-English languages.

What is the default voice?

You must explicitly provide a voice parameter. Choose from presets like aria, nova, luna, sage, felix, milo, atlas, or orion.

First request

curl

curl https://api.4777bdt.cc/v1/audio/speech \
  -H "Authorization: Bearer $TTS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"tts-1","voice":"aria","input":"Hello from the API.","response_format":"mp3"}' \
  --output hello.mp3

Python (openai)

from openai import OpenAI

client = OpenAI(base_url="https://api.4777bdt.cc/v1", api_key="tts-...")

with client.audio.speech.with_streaming_response.create(
    model="tts-1", voice="nova", input="Hello from Python.", response_format="mp3"
) as response:
    response.stream_to_file("hello.mp3")

Node.js (openai)

import OpenAI from "openai";
import fs from "node:fs";

const client = new OpenAI({ baseURL: "https://api.4777bdt.cc/v1", apiKey: process.env.TTS_API_KEY });
const res = await client.audio.speech.create({ model: "tts-1", voice: "milo", input: "Hello from Node.js." });
fs.writeFileSync("hello.mp3", Buffer.from(await res.arrayBuffer()));
voice
ariafemale
novafemale
lunafemale
sagefemale
felixmale
milomale
atlasmale
orionmale
language
arالعربية
zh中文
daDansk
nlNederlands
enEnglish
fiSuomi
frFrançais
deDeutsch
elΕλληνικά
heעברית
hiहिन्दी
itItaliano
ja日本語
ko한국어
msBahasa Melayu
noNorsk
plPolski
ptPortuguês
ruРусский
esEspañol
swKiswahili
svSvenska
trTürkçe

Authentication and Keys

Sound wave illustration for: Authentication and Keys

Create your API key by signing up on the /get-api-key/ page using either Google or an email password. The dashboard displays your active key, current balance, and usage statistics. This key authenticates all requests to the API base URL.

Generate Your API Key

Generate Your API Key

Sign up via the /get-api-key/ page to receive your unique credential. Google sign-ups include a $0.50 trial credit valid for seven days, while email-based accounts start with zero balance.

  • Sign up with Google or email/password
  • View key and balance on dashboard

Bearer Token Format

Bearer Token Format

Include your key in the HTTP header as Authorization: Bearer tts-.... This token authorizes your account for all subsequent requests to the API.

Key Rotation Policy

Generate a new key at any time from the dashboard. The previous key stops working immediately upon creation of the new one, ensuring secure access management.

First Request with cURL

Sound wave illustration for: First Request with cURL

Once you have your API key, you can immediately start generating audio. The simplest way to verify your setup is by sending a basic POST request using cURL. This method requires no additional libraries and works directly from your terminal or command line interface.

This approach confirms that your authentication is correct and helps you understand the raw request structure before moving to more complex integrations. It is a simple way to test voice selection and output formats without writing code.

Basic POST Request

Send a POST request to https://api.4777bdt.cc/v1/audio/speech with your JSON body. Include your Bearer token in the Authorization header. The API returns the audio file directly in the response body.

  • Endpoint: POST https://api.4777bdt.cc/v1/audio/speech
  • Header: Authorization: Bearer tts-...
  • Content-Type: application/json

Required Fields

Every request must include the model, input, and voice fields. The model accepts tts-1 or tts-1-hd. The input text cannot exceed 4096 characters. The voice parameter must match one of the eight available presets.

  • model: "tts-1" or "tts-1-hd" (same engine and price)
  • input: string, max 4096 characters
  • voice: one of 8 presets (e.g., "aria", "nova")
  • response_format: mp3, wav, opus, flac, or pcm

Response Format

On success, the API returns the audio file directly as the response body with the specified content type (e.g., audio/mpeg for MP3). If the request fails, you receive a JSON error object with a status code and a message explaining the issue, such as invalid input or rate limits.

  • Success: Raw audio binary data
  • Failure: JSON error object with code and message

Integration with OpenAI SDK

Sound wave illustration for: Integration with OpenAI SDK

Since the request structure mirrors the OpenAI speech endpoint, you can reuse existing client libraries by simply redirecting the base URL. This allows indie developers to swap providers without rewriting their integration logic, keeping the workflow straightforward for WordPress plugins or blog engines.

Base URL Configuration

Point your SDK client to our API base URL: https://api.4777bdt.cc/v1. This single change ensures all requests route through our service while maintaining compatibility with standard OpenAI SDK methods.

Client Initialization

Initialize the client using your API key as the authorization token. The key format is tts-..., and it must be passed in the Authorization header. Ensure your environment variable holds the correct key string to avoid authentication errors.

  • Use tts- prefix for the key
  • Set Authorization: Bearer <key> header

Code Example

Below is a minimal Python example using the OpenAI SDK. It sends a short text string and saves the resulting audio file. Adjust the voice parameter to one of the eight presets, such as 'nova' or 'aria', depending on your tone needs.

  • import openai
  • client = openai.OpenAI(base_url="https://api.4777bdt.cc/v1", api_key="tts-your-key")
  • audio = client.audio.speech.create(model="tts-1", voice="nova", input="Hello world")
  • with open("output.mp3", "wb") as f:
  • f.write(audio.content)

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts two model identifiers, "tts-1" and "tts-1-hd", which use the same underlying engine and pricing. You can select either without affecting cost or audio quality, allowing you to simplify your code by using a single model string if preferred.

Model Selection (tts-1, tts-1-hd)

Both models use the same engine and are priced at $0.01 per 1,000 characters. The choice is purely syntactic; the engine processes requests identically regardless of which identifier you send in the model field.

Voice Presets

Select from eight distinct presets ranging from warm narrators to deep documentary voices. Each voice is built from licensed recordings and supports all 23 available languages. You can switch voices instantly without re-uploading audio assets.

  • Aria: Warm, clear narrator
  • Nova: Bright, upbeat
  • Luna: Soft, storytelling
  • Sage: Calm, instructional
  • Felix: Energetic, promo
  • Milo: Friendly, conversational

Speed Control (0.25–4.0)

Adjust playback speed between 0.25 and 4.0 to fit your content’s pacing. Slower speeds improve clarity for instructional content, while faster rates suit quick updates. The API processes requests sequentially, so extreme speeds may slightly affect generation latency under load.

Output Formats

Sound wave illustration for: Output Formats

The API supports five audio formats: MP3, WAV, Opus, FLAC, and PCM. Each serves different use cases, from web compatibility to lossless archival. You specify your preferred format via the response_format parameter in the request body.

MP3, WAV, Opus, FLAC, PCM

MP3 offers broad compatibility with minimal file size. WAV and FLAC provide uncompressed or lossless quality, ideal for editing or high-fidelity playback. PCM delivers raw audio data, while Opus is a supported format.

Choosing the Right Format

Select MP3 for general web use or WordPress plugins where bandwidth matters. Choose WAV or FLAC if you need pristine audio for production workflows. Use PCM for low-level processing or Opus for efficient streaming-compatible delivery.

File Size Considerations

Compressed formats like MP3 and Opus significantly reduce storage and transfer costs. Uncompressed formats like WAV and PCM result in larger files, which may impact download times or storage limits for high-volume applications.

Output Formats

Handling Limits and Errors

Sound wave illustration for: Handling Limits and Errors

The API enforces a strict limit of 60 requests per minute per API key. If you are not using the free trial, this cap applies immediately; however, accounts created with email and password start with a lower limit of 10 requests per minute until their first top-up. This ensures fair usage across the network.

60 Requests per Minute

Requests are processed sequentially, meaning under heavy load, your synthesis job may wait in a queue before processing begins. If you exceed the 60 RPM threshold, subsequent requests will be rejected until the window resets. For bulk generation, consider splitting long texts into chunks of 4,096 characters and managing the queue manually to avoid timeouts.

Rate Limit Headers

The API may include rate-limit headers so you can monitor your usage. Use these values to implement exponential backoff in your application logic, preventing unnecessary retries when the limit is reached.

  • Monitor X-RateLimit-Remaining to anticipate the reset window.
  • Implement backoff logic if X-RateLimit-Remaining hits zero.

Common Error Codes

Most errors are immediate and self-explanatory. A 400 Bad Request usually indicates invalid JSON or a missing required field like input or voice. A 401 Unauthorized means your Bearer token is invalid or expired. A 429 Too Many Requests confirms you have hit the per-minute limit.

  • 400: Invalid request body or missing parameters.
  • 401: Invalid or expired API key.
  • 429: Rate limit exceeded (wait and retry).

Voice and Language Settings

Sound wave illustration for: Voice and Language Settings

Select one of eight voice presets via the voice parameter. Each voice has a distinct tone, from the warm narration of Aria to the deep documentary style of Orion. The engine supports all eight voices across any language, allowing you to match the audio character to your content without switching models.

Setting the Voice Parameter

Pass the voice name (e.g., nova, atlas) in the request body. This directly influences the prosody and timbre of the generated speech. You can switch voices between requests without changing the model or other settings, enabling easy A/B testing for different blog posts or WordPress plugins.

  • Female presets: aria, nova, luna, sage
  • Male presets: felix, milo, atlas, orion

Optional Language Code

While the API attempts to guess the language, you can explicitly set the language field using an ISO code (e.g., fr, de, ja). This ensures consistent output, especially when your text contains mixed scripts or ambiguous phrases that might otherwise be misinterpreted by the detection algorithm.

Script Detection Behavior

If language is omitted, the system infers the language from the text script. Latin script text defaults to English. For non-English text using Latin characters (such as German or Spanish), you must set the language parameter to prevent incorrect English synthesis. This applies to all 23 supported languages.

Testing and Debugging

Sound wave illustration for: Testing and Debugging

Before sending requests, ensure your input text is clean and within limits. The API accepts plain text up to 4,096 characters per request. Spaces and punctuation count toward this limit, so long articles must be split into smaller chunks.

Validating Input Text

Verify that your input contains only supported characters. The API does not handle SSML or custom pronunciation tags. Ensure the text is valid UTF-8 and does not exceed the character limit.

Checking Character Count

Count characters accurately before sending. Since spaces and punctuation count, use a standard character counter tool. For texts longer than 4,096 characters, split them into parts and join the resulting audio files later to avoid truncation errors.

Verifying Audio Output

After receiving the response, check the HTTP status code. A 200 OK means synthesis succeeded. Play the returned audio file to confirm voice, speed, and language settings are correct. If the file is empty or corrupted, retry the request.

  • Check for 200 OK status
  • Verify audio file integrity
  • Confirm voice and speed settings

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. His style reduces the robotic feel often associated with TTS, making the listening experience more engaging for your audience.

Avatar of the voice aria
ariafemale
Avatar of the voice nova
novafemale
Avatar of the voice luna
lunafemale
Avatar of the voice sage
sagefemale
Avatar of the voice felix
felixmale
Avatar of the voice milo
milomale
Avatar of the voice atlas
atlasmale
Avatar of the voice orion
orionmale

23 languages

Any voice speaks any of these languages.

Sources and further reading

  1. Wikipedia
  2. W3C WAI: making audio and video accessible
  3. MDN: Web Speech API
  4. OpenAI API reference: create speech
  5. curl documentation
  6. Creative Commons Attribution 4.0
  7. TRON developer hub: TRC-20
  8. IETF RFC 7845: Ogg Opus
  9. ISO 639 language codes
  10. Node.js documentation
  11. LibriVox public-domain audiobooks
  12. FFmpeg documentation

More on this site