Quickstart Guide for JavaScript Developers

By FlowSpeak editorial team · Updated 2026-11-19

This guide shows indie developers how to integrate FlowSpeak’s text-to-speech API into web applications using JavaScript. You will learn to generate audio from text with clear, license-safe voices, supporting accessibility workflows and dyslexia-friendly tools.

Start by obtaining your API key, then make your first request using curl or the OpenAI SDK. We cover essential parameters like voice selection, speed control, and response formats, along with error handling and rate limits to ensure reliable integration.

Quickstart Guide for JavaScript Developers

Frequently asked questions

How do I get an API key?

Sign up on the /get-api-key/ page using Google or email. Your key appears immediately. It starts with 'tts-'. You can issue a new key anytime, which instantly invalidates the old one. One active key per account ensures secure access to the API endpoints for your applications.

What is the base_url for the SDK?

Use https://api.hd44live.cc/v1 as your base URL. This matches the OpenAI SDK structure. Change the base_url in your OpenAI SDK configuration to this address. The official OpenAI SDKs work seamlessly by pointing to this endpoint, allowing you to use standard methods for text-to-speech requests.

Does the SDK support Node.js?

Yes, since it uses the OpenAI SDK structure, any OpenAI-compatible client works. The official OpenAI SDKs support Node.js. You can configure the base_url to https://api.hd44live.cc/v1. This allows you to send POST requests to /v1/audio/speech using standard JavaScript libraries in your Node environment.

What are the rate limits?

You are limited to 60 requests per minute per key. Before your first top-up, the limit is 10 requests per minute. Requests are processed sequentially, so high load may cause queuing. Failed requests are free. Monitor your usage via the dashboard.

How do I handle errors?

Errors return standard HTTP status codes. If synthesis fails, the charge is returned in full. Check the response body for details. Ensure your input text is under 4096 characters and your key is valid. Failed requests incur no cost, so you can retry safely without worrying about billing.

Can I use the same key for multiple apps?

Yes, one active key per account can be used across multiple applications. The key authenticates all requests from your account. If you need separate access, issue a new key. The old key stops working immediately when the new one is issued, ensuring clear separation if needed.

What models are available?

Two models are available: 'tts-1' and 'tts-1-hd'. Both use the same engine and pricing. Choose based on your quality needs. The API endpoint is /v1/audio/speech. You can list available models via the GET /v1/models endpoint. Both models support the same voices and response formats.

Is the API RESTful?

Yes, it is a standard REST API. Use POST for speech generation and GET for listing voices or models. Requests use JSON bodies. Authentication is via Bearer token in the Authorization header. Responses return audio files or JSON metadata. It follows standard HTTP conventions for easy integration.

How do I rotate keys?

Issue a new key from your account dashboard. The new key becomes active immediately. The old key stops working at once. This ensures seamless transition. You can generate new keys anytime without downtime. Use the new key in your applications to maintain continuous service access.

What happens if I exceed limits?

Requests may queue if you exceed 60 per minute. Processing is sequential, so delays may occur. If you exceed limits significantly, requests might fail temporarily. Failed requests are free. Monitor your rate limit status in the dashboard. Top-ups increase the rate limit from 10 to 60 requests per minute.

Does the SDK support streaming?

No, the API does not support streaming or WebSocket connections. Audio is returned as a complete file in the response. You cannot receive partial audio chunks. For real-time needs, manage client-side buffering. The API returns the full audio file once synthesis completes, ensuring consistent delivery.

Can I send multiple voices?

No, each request supports only one voice. You must send separate requests for different voices. Combine audio files client-side if needed. The API processes one voice per request. Use the /v1/voices endpoint to list available options. Each voice has a unique preset name for selection.

How do I decode the audio?

The API returns raw audio data in the specified format. Use response_format to choose mp3, wav, opus, flac, or pcm. No decoding is needed for these standard formats. The response body contains the audio bytes directly. Save the response to a file or play it using standard media players.

Is there a Python SDK?

Yes, use the official OpenAI Python SDK. Configure the base_url to https://api.hd44live.cc/v1. The SDK structure is identical to OpenAI's. Install the openai package and set the API key. This allows Python developers to use familiar methods for text-to-speech generation without learning a new library.

First request

curl

curl https://api.hd44live.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.hd44live.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.hd44live.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

Get Your API Key

Sound wave illustration for: Get Your API Key

Create an account at https://hd44live.cc/get-api-key/ using Google or an email/password. Your dashboard displays your API key, current balance, and a ready-to-use cURL example to verify connectivity immediately.

Sign up page

Sign up page

Visit the /get-api-key/ page to register. Google sign-up includes a $0.50 free trial valid for seven days. Email registrations start with zero credit, requiring a manual top-up before use.

  • Google or email/password authentication
  • Immediate dashboard access
  • Trial credit details visible instantly

Bearer token

Bearer token

Include your key in the HTTP header as Authorization: Bearer tts-.... The API uses standard Bearer authentication, compatible with any HTTP client or SDK that supports custom headers.

Single key per account

Each account maintains one active key. Issuing a new key immediately invalidates the previous one, ensuring only one active credential exists at any time.

First Request (Curl)

Sound wave illustration for: First Request (Curl)

Start by sending a POST request to the speech endpoint. You can test connectivity immediately using a simple curl command, which returns an audio file directly in the response body.

This approach works without any SDK installation, making it ideal for quick validation of your API key and account balance before integrating into your web app.

Basic curl command

Use the following command to generate speech. Replace YOUR_API_KEY with your key from /get-api-key/ and Your text here with your input.

`curl -X POST https://api.hd44live.cc/v1/audio/speech -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"model": "tts-1", "input": "Hello world", "voice": "nova"}' -o output.mp3`

JSON body structure

The request body is standard JSON. Required fields are model ("tts-1" or "tts-1-hd"), input (max 4096 characters), and voice (e.g., "aria").

Optional fields include response_format (default mp3), speed (0.25–4.0), and language (ISO code). Spaces and punctuation count toward the character limit.

  • model: tts-1 or tts-1-hd
  • input: string, max 4096 chars
  • voice: one of 8 presets
  • response_format: mp3, wav, opus, flac, pcm

Audio response

On success, the API returns the audio file in the specified format. For curl, you can save it directly to a file using the -o flag.

If synthesis fails, you receive an error JSON object with a message field describing the issue, such as invalid voice or rate limits.

OpenAI SDK Integration

Sound wave illustration for: OpenAI SDK Integration

Leverage the official OpenAI JavaScript SDK by overriding the base URL. This allows you to use your existing integration patterns while directing requests to FlowSpeak’s engine. Configure the client to point at https://api.hd44live.cc/v1 and inject your Bearer token for authentication.

Change base_url

Initialize the OpenAI client with your API key and set the base_url to https://api.hd44live.cc/v1. This redirects all standard speech requests to our infrastructure while maintaining compatibility with the existing SDK methods.

Use tts-1 model

Select tts-1 for standard quality generation. This model processes text efficiently, making it suitable for most web app use cases. It supports all eight voice presets and offers balanced performance for typical character volumes.

Use tts-1-hd model

Choose tts-1-hd for higher fidelity audio output. While the engine is the same, this model provides higher fidelity audio output. The pricing remains identical to the standard model, so you can upgrade quality without increasing costs.

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts plain text as the input field, with a strict limit of 4096 characters per request. This limit includes spaces and punctuation. For longer content, split your text into chunks and join the resulting audio files sequentially.

Select one of eight voice presets using the voice parameter. Each voice has a distinct tone, from warm narrators to energetic promo speakers. The speed parameter adjusts playback rate between 0.25 and 4.0, allowing precise control over the final audio duration.

Input text limit

Send up to 4096 characters per request. Spaces and punctuation count toward this limit. For texts exceeding this length, split the input into multiple requests and concatenate the returned audio files.

The API processes requests sequentially. Under load, longer texts may queue, but synthesis typically runs at roughly real-time speed (25 characters per second).

  • Max length: 4096 characters
  • Includes spaces and punctuation
  • Split and join for longer content

Voice selection

Choose from eight preset voices identified by unique IDs. Options include female voices like Aria and Nova, or male voices like Felix and Milo. All voices support 23 languages, though setting the language field ensures correct pronunciation for non-English text.

Voices are licensed from LibriTTS-R and LibriVox, providing clear, license-safe audio for web applications.

  • Aria (warm narrator)
  • Nova (upbeat)
  • Felix (energetic)
  • Atlas (neutral)

Speed control

Adjust the speed parameter to modify playback rate. Valid values range from 0.25 (slow) to 4.0 (fast). This allows you to match the audio pace to your application’s user experience needs without re-generating the audio.

Changing speed does not affect character counting or billing, which is based on the original input length.

  • Range: 0.25 to 4.0
  • Adjusts playback rate
  • No extra cost for speed changes

Response Formats

Sound wave illustration for: Response Formats

The API returns synthesized audio in the format you specify via the response_format parameter. Supported formats include MP3, WAV, OPUS, FLAC, and PCM. Choose MP3 for efficient storage or WAV for lossless quality. PCM provides raw uncompressed audio data for direct processing in media pipelines.

MP3 output

MP3 is the default format, offering a good balance between file size and audio quality. It is ideal for web applications where bandwidth efficiency matters. The generated file is ready to play in standard HTML5 audio players without additional decoding.

WAV output

WAV provides uncompressed, lossless audio suitable for high-fidelity applications or further editing. Use this format when you need to preserve every detail of the synthesis, such as in professional accessibility tools or archival purposes.

PCM raw

PCM returns raw audio data. This format contains no headers, making it suitable for low-level audio processing or integration with systems that handle raw byte streams directly.

Response Formats

Error Handling

Sound wave illustration for: Error Handling

Handling errors correctly ensures your application remains stable when the API encounters issues. The FlowSpeak TTS API returns standard HTTP status codes to indicate the result of your synthesis request, allowing your code to react appropriately to failures or limitations.

400 Bad Request

This error occurs when the request body is malformed or contains invalid data. Common causes include missing required fields like input or voice, or providing a voice ID that does not exist. Ensure your JSON structure matches the expected schema and that text length stays within the 4096-character limit.

401 Unauthorized

A 401 response indicates that the Authorization header is missing or contains an invalid API key. Verify that you are using the correct Bearer token from your account dashboard. Note that if you issue a new key, the old one becomes invalid immediately.

429 Rate Limit

You receive this error when exceeding the rate limit. New accounts start with a lower limit of 10 requests per minute until the first top-up is processed. Requests are processed sequentially, so under heavy load, you may also experience delays before the queue processes your job.

  • Implement exponential backoff to retry requests after a short delay.
  • Monitor your usage dashboard to anticipate limit thresholds.
  • Top up your balance to increase the rate limit from 10 to 60 requests per minute.

Rate Limits

Sound wave illustration for: Rate Limits

FlowSpeak enforces a limit of 60 requests per minute per API key.

60 requests per minute

Your single API key allows up to 60 synthesis requests each minute. This cap ensures fair usage and maintains consistent audio generation quality for all users.

10 before top-up

New accounts or those without a USDT top-up are limited to 10 requests per minute.

Queue behavior

Requests are processed sequentially. If you exceed the limit, subsequent requests may wait in a queue. Longer texts take more time, so batch splitting helps avoid delays.

Voice Selection

Sound wave illustration for: Voice Selection

Access your available voices directly via the API. The endpoint returns a list of all supported voices, languages, and formats, allowing your application to dynamically populate dropdown menus or configuration panels without hardcoding values.

List voices endpoint

Send a GET request to /v1/voices to retrieve the full catalog. The response includes every voice ID, associated language codes, and supported audio formats, ensuring your UI stays synchronized with the API's current capabilities.

Voice IDs

Each voice is identified by a simple lowercase string (e.g., aria, nova, atlas). Pass this ID directly into the voice field of your speech request. You can mix voices across requests to vary tone without changing your integration logic.

Gender options

Voices are categorized as female (aria, nova, luna, sage) or male (felix, milo, atlas, orion). Select based on your app's accessibility needs; for example, atlas provides a neutral news tone, while luna offers a soft storytelling style suitable for audiobooks.

  • Female: aria, nova, luna, sage
  • Male: felix, milo, atlas, orion
  • All voices support 23 languages

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Failed requests are free, ensuring you only pay for successful synthesis.

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. LibriTTS-R paper (arXiv 2305.18802)
  3. MDN: Web Speech API
  4. openai-node on GitHub
  5. LibriVox public-domain audiobooks
  6. Creative Commons Attribution 4.0
  7. TRON developer hub: TRC-20
  8. Node.js documentation
  9. openai-python on GitHub
  10. IETF RFC 7845: Ogg Opus
  11. LibriTTS-R corpus (OpenSLR 141)
  12. FFmpeg documentation

More on this site