Documentation for Node.js Text-to-Speech Integration

By VerboLink editorial team · Updated 2026-11-19

This guide helps teachers and methodologists integrate VerboLink’s text-to-speech API into their Node.js workflows. You will learn how to convert lesson texts into audio files for LMS platforms using clear, natural voices in 23 languages. The documentation covers everything from obtaining your API key to handling responses in Node.js.

We focus on practical, lightweight integration without complex dependencies. You will find ready-to-use code examples, parameter explanations, and best practices for handling long texts or rate limits. Whether you are building a simple script or a full LMS plugin, this page gives you the specific details needed to get started quickly.

Documentation for Node.js Text-to-Speech Integration

Frequently asked questions

How do I get an API key?

Sign up on /get-api-key/ using Google or email. You receive one active key per account, visible on the dashboard. You can issue a new key anytime; the old one stops immediately. Failed requests are free, and a $0.50 trial credit is available for Google sign-ups (email accounts start without trial credit).

Can I use the OpenAI SDK with this API?

Yes. The endpoint matches the OpenAI speech endpoint shape. Update the SDK’s base_url to https://api.alanodt2.info/v1 and use your VerboLink key. This allows you to use official OpenAI SDKs directly without writing custom HTTP clients for your Node.js application.

What is the base URL for the API?

The base URL is https://api.alanodt2.info/v1. Use POST https://api.alanodt2.info/v1/audio/speech for synthesis. You can also query GET /v1/voices for available options or GET /v1/models for model details. All requests require your Bearer token in the Authorization header.

Which models are available for text-to-speech?

Two models are available: tts-1 and tts-1-hd. Both use the same engine and have identical pricing. You can choose either depending on your quality preference. The API returns audio files based on the selected model and voice parameters in your request.

How do I set the speed of the speech?

Include the speed field in your JSON body with a value between 0.25 and 4.0. This adjusts the playback rate of the generated audio. The default speed is typically 1.0. Adjust this value to make narration faster or slower for your lesson content.

What audio formats can I receive?

You can request mp3, wav, opus, flac, or pcm formats via the response_format field. Choose mp3 for smaller file sizes or wav for high quality. The API returns the audio file directly in the response, ready for download or immediate playback in your LMS.

How do I handle rate limits in Node.js?

You are limited to 60 requests per minute per key (10 before top-up). Process requests sequentially or implement a queue. Under load, requests may wait in a queue. Monitor your usage on the dashboard to avoid hitting limits during bulk lesson generation.

What happens if I exceed the character limit?

Each request accepts up to 4096 characters. For longer texts, split your input into parts of this size and join the resulting audio files. Spaces and punctuation count toward the limit. This ensures consistent processing and prevents errors from oversized payloads.

Can I send multiple voices in one request?

No, each request accepts only one voice preset. To use different voices, send separate requests for each segment. You can manage this in your Node.js code by iterating through your text segments and compiling the final audio file from the responses.

How do I authenticate my requests?

Include your API key in the Authorization header as a Bearer token: Authorization: Bearer tts-... . One key is active per account. If you issue a new key, the old one stops immediately. Ensure your key is valid to avoid 401 errors.

Is there a limit on the number of voices?

There are eight preset voices available: aria, nova, luna, sage, felix, milo, atlas, and orion. Each voice can speak any of the 23 supported languages. You can switch voices freely between requests without any additional restrictions or limits on usage.

How do I handle errors in the API response?

Failed requests are free, with charges returned in full. Check the HTTP status code and response body for error details. Common issues include invalid keys or rate limits. Implement retry logic for transient errors and verify your input text length and format.

Can I use the API with Express.js?

Yes, use the OpenAI SDK or plain HTTP. Set the base_url to https://api.alanodt2.info/v1. Create an Express route that accepts text input, calls the speech endpoint, and returns the audio file. This integrates easily into your existing Node.js server architecture.

How do I test the API before going live?

Use the $0.50 free trial credit if you sign in with Google. This covers about 50,000 characters for seven days. Test with the provided curl example on the dashboard. Verify voice selection, speed, and format settings before integrating into your production LMS workflow.

First request

curl

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

Getting Your API Key

Sound wave illustration for: Getting Your API Key

To start generating audio, create an account on the site using Google or email. This grants access to your unique API credentials and initial balance.

Your key authorizes requests to the API. Keep it secure, as it links directly to your usage and billing.

Sign Up on the Site

Sign Up on the Site

Visit the /get-api-key/ page to register. You can sign in with Google for immediate access to a free trial credit of $0.50. Email-based accounts start with zero balance.

The registration process is straightforward, requiring only an email address or Google account to establish your identity on this specific site.

Locate Your Key

Locate Your Key

Once logged in, your dashboard displays your active API key starting with 'tts-'. You will also see your current balance and character usage.

Use this key in the Authorization header of your requests. It is the only credential needed for authentication.

  • Starts with 'tts-'

Key Management

You can issue a new key at any time. When you do, the previous key stops working immediately.

This allows you to rotate keys quickly if you suspect exposure without losing your account history or balance.

First Request with cURL

Sound wave illustration for: First Request with cURL

To verify your integration quickly, you can use cURL to send a direct HTTP request to the VerboLink API. This method requires no external libraries, making it ideal for simple scripts or initial testing before building a full Node.js application.

The request sends your text payload to the speech endpoint, authenticating with your API key. The API processes the input and returns the audio file directly, allowing you to save it to disk.

Basic Request Structure

Send a POST request to https://api.alanodt2.info/v1/audio/speech. The body must be formatted as JSON, containing the text to be spoken and the desired voice model. This structure mirrors the standard OpenAI speech endpoint, ensuring compatibility with common HTTP clients.

Required Fields

You must include the model, input, and voice fields in your JSON body. The model can be "tts-1" or "tts-1-hd". The input is your text, limited to 4096 characters. The voice must be one of the eight available presets, such as "aria" or "nova".

  • model: "tts-1" or "tts-1-hd"
  • input: the text string (max 4096 chars)
  • voice: one of the 8 available voices

Response Format

A successful request returns the audio file directly in the response body. The content type will match your specified response_format (e.g., audio/mpeg for MP3). If the synthesis fails, you will receive a JSON error object with details about the issue, such as an invalid voice or character limit exceeded.

Using the OpenAI SDK

Sound wave illustration for: Using the OpenAI SDK

Using the OpenAI SDK simplifies integration by reusing familiar code structures. You only need to adjust the base URL to point to our API endpoint. This approach lets teachers and methodologists leverage existing Node.js patterns without learning a new library.

Install the SDK

Install the official OpenAI Node.js package via npm. This provides the core functionality needed to send requests and handle responses efficiently in your LMS workflow.

  • Run: npm install openai

Configure Base URL

Create an OpenAI client instance and override the base URL. Set it to https://api.alanodt2.info/v1. This directs all speech requests to our engine while keeping the standard request shape.

  • base_url: 'https://api.alanodt2.info/v1'
  • apiKey: 'tts-your-api-key-here'

Make a Request

Call the speech endpoint with your text, selected voice, and desired format. The SDK handles the JSON body and returns the audio file directly. You can then save the file.

  • Use model: 'tts-1'
  • Specify voice: 'aria' or others
  • Set response_format: 'mp3'

Request Parameters

Sound wave illustration for: Request Parameters

The API accepts two model variants, tts-1 and tts-1-hd, which use the same underlying engine and pricing. You choose the model by setting the model field in your request body. Both options deliver natural, clear speech suitable for educational content.

Model Selection

Both tts-1 and tts-1-hd utilize the same engine and incur identical charges of $10 per million characters. There is no performance difference between the two identifiers, so you can use either based on your code preference.

Voice Selection

Select from eight preset voices, such as aria for clear narration or atlas for neutral news-style delivery. Each voice supports all 23 available languages, allowing you to generate localized lesson audio without managing multiple voice profiles.

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

Speed Control

Adjust the speed parameter between 0.25 and 4.0 to match the pacing of your instructional material. Slower speeds aid comprehension for complex topics, while faster speeds help cover more content efficiently.

Response Formats

Sound wave illustration for: Response Formats

The API returns audio data directly, simplifying your Node.js integration. You do not need to parse complex metadata for successful generations; the response body contains the raw audio file itself, ready to be saved or streamed immediately.

Supported Audio Formats

You can specify the output format in your request using the response_format parameter. The API supports mp3, wav, opus, flac, and pcm. Choose the format that best fits your LMS requirements or student device capabilities.

  • mp3: Best for web streaming and small file sizes.
  • wav: Lossless quality, ideal for high-fidelity playback.
  • opus: Efficient compression for modern browsers.
  • flac: Lossless compressed audio for archival.
  • pcm: Raw uncompressed audio data.

JSON Response

A successful request returns the audio file directly in the response body, not as a JSON object. If the synthesis fails, you will receive a JSON error object with details about the issue, allowing you to log the failure accurately without parsing audio data.

Binary Audio Data

The actual audio file is returned as binary data in the response body. You can directly save this buffer to a file. This approach avoids extra conversion steps and ensures the audio file is written exactly as generated by the TTS engine.

Response Formats

Error Handling

Sound wave illustration for: Error Handling

When your request fails, the API returns a standard HTTP error code along with a JSON object describing the issue. This allows your Node.js script to catch specific failures and handle them gracefully without crashing. Always check the response status to determine if the synthesis failed due to network issues, invalid parameters, or quota limits.

Common Error Codes

The API uses standard HTTP status codes to indicate success or failure. A 200 OK means the audio was generated successfully. A 400 Bad Request indicates invalid parameters, such as an unknown voice name. A 401 Unauthorized means your API key is missing or incorrect. A 429 Too Many Requests signals that you have exceeded your rate limit.

  • 200 OK: Success
  • 400 Bad Request: Invalid input
  • 401 Unauthorized: Invalid key
  • 429 Too Many Requests: Rate limit exceeded

Rate Limit Errors

You are limited to 60 requests per minute per key. If you send requests faster than this limit, you will receive a 429 error. Before your first top-up, the limit is stricter at 10 requests per minute. Ensure your Node.js application respects these limits to avoid interruptions in your audio generation workflow.

Invalid Input Errors

If the input text exceeds 4096 characters, the request will fail. Ensure your text is within this limit or split it into smaller parts before sending. Also, verify that the voice name is one of the eight supported presets. Incorrect character counts or unknown voice names will result in a 400 error.

Rate Limits

Sound wave illustration for: Rate Limits

VerboLink enforces a limit of 60 requests per minute per API key. This ensures fair usage across all accounts and maintains consistent audio generation speeds. If you exceed this threshold, the API will return an error until the window resets.

Requests Per Minute

The standard rate limit is 60 requests per minute. Each request counts toward this total, regardless of text length. This limit applies per key, so ensure you are using the correct active key in your Node.js scripts.

Pre-Topup Limits

Before your first top-up, the limit is stricter: only 10 requests per minute. This allows you to test the integration without consuming too much of your trial credit. Once you add funds via USDT on the TRON network (TRC-20), the limit increases to the standard 60 requests per minute.

  • Trial accounts: 10 requests/minute
  • Top-up accounts: 60 requests/minute
  • Limit resets every 60 seconds

Handling Queues

Requests are processed sequentially. Under heavy load, your request may wait in a queue before synthesis begins. Short phrases take a few seconds, while longer texts process at roughly real-time speed (25 characters per second). Implement retry logic with exponential backoff to handle temporary 429 errors gracefully.

Best Practices for Node.js

Sound wave illustration for: Best Practices for Node.js

Node.js developers can integrate VerboLink’s TTS API efficiently by leveraging async/await patterns to handle synchronous text-to-speech conversion without blocking the event loop. This ensures smooth operation within Express routes or serverless functions, allowing your application to remain responsive while generating audio files for lesson materials.

Async/Await Usage

Use native fetch or axios with async/await to send POST requests to the speech endpoint. This approach keeps your code clean and manageable, especially when generating audio for multiple students or modules in an LMS.

  • Wrap API calls in try/catch blocks for reliable error handling.
  • Await the response before returning the audio buffer to the client.

Handling Long Texts

Since each request supports up to 4096 characters, split longer lesson texts into smaller chunks. Concatenate the resulting audio files to create a seamless audio file for your online course modules.

  • Split text by sentences or paragraphs to preserve natural pauses.
  • Use any library to merge individual audio segments.

Error Retry Logic

Implement exponential backoff for transient errors, especially given the processing queue during peak times. Since requests are processed sequentially, a brief retry ensures your lesson audio is generated without user interruption.

  • Retry on 429 (Rate Limit) and 500 (Server Error) responses.
  • Cap retries to avoid infinite loops during extended outages.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Each voice is derived from licensed recordings, ensuring clear and natural audio for your students.

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. OpenAI API reference: create speech
  3. openai-python on GitHub
  4. TRON developer hub: TRC-20
  5. IETF RFC 7845: Ogg Opus
  6. FFmpeg documentation
  7. Node.js documentation
  8. Python documentation
  9. openai-node on GitHub
  10. MDN: Web Speech API
  11. W3C WAI: making audio and video accessible
  12. LibriTTS-R corpus (OpenSLR 141)

More on this site