Text-to-Speech API for JavaScript Developers

By Spindragons editorial team · Updated 2026-11-19

This page shows you how to add realistic voice audio to your JavaScript applications without managing infrastructure. You will find clear examples of simple JSON requests, a list of available voices and languages, and a ready-to-use code snippet. Everything is designed for indie developers who need a reliable TTS solution that integrates smoothly with their existing stack.

You will also learn about the pricing structure, technical limits, and data privacy practices. This guide covers the essential details for freelancers building web apps, from signing up with Google to making your first API call. Use this resource to understand the capabilities and constraints before integrating Spindragons into your next project.

Text-to-Speech API for JavaScript Developers

Frequently asked questions

What is a TTS API?

A cloud text-to-speech API where you send text and receive an audio file. You POST JSON to the endpoint, specifying model, voice, and format. It returns synthesized speech instantly, allowing you to integrate audio generation directly into your application logic without managing voice synthesis infrastructure or servers.

Is this TTS API good for JavaScript?

Yes, it is designed for indie developers building web apps with JavaScript. You can use the OpenAI SDKs by changing the base URL to our API endpoint. This allows you to generate audio files with simple JSON requests, fitting seamlessly into standard JavaScript workflows without extra infrastructure management.

Does the TTS API support OpenAI SDKs?

Yes, the request shape matches the OpenAI speech endpoint. You can use the OpenAI SDKs by changing the base URL to https://api.spindragons.info/v1 and using your Spindragons API key. This compatibility allows you to leverage existing SDK tools and libraries for seamless integration into your JavaScript projects.

How much does the TTS API cost?

Pricing is $10 per 1 million characters, or $0.01 per 1,000 characters. Spaces and punctuation count as characters. Failed requests are free, with charges returned in full. There are no monthly plans, seats, or minimum spends, allowing you to pay only for the exact volume of audio you generate.

Can I use the TTS API for commercial projects?

Yes, the API is suitable for commercial use. Generated audio files carry an inaudible watermark marking them as synthetic speech. Input text is used only to produce audio and is not used for training. You can integrate the generated audio directly into your commercial web applications or products without additional licensing fees.

What languages does the TTS API support?

We support 23 languages: Arabic, Chinese, Danish, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese, Russian, Spanish, Swahili, Swedish, and Turkish. Any voice can speak any of these languages. If the language is not specified, it is guessed from the script.

Are there any voice cloning features?

No, custom voice cloning is not offered. You choose from eight preset voices based on licensed recordings. These voices include specific tones like warm, upbeat, or deep, but you cannot upload your own voice or design custom ones. The system uses fixed presets to generate realistic synthetic speech for your text.

How long are my texts stored?

Input text is used only to produce the audio and is not stored for training. Generated audio is returned in the response and not stored. We keep request metadata, such as time, characters, and status, specifically for billing purposes. Your actual text content is not retained after synthesis is complete.

Does the TTS API have an SLA?

No, there is no Service Level Agreement (SLA) or uptime guarantee. We do not offer enterprise contracts or on-premise installations. The service is provided as-is, meaning you should account for potential variability in processing times, especially during high load, without relying on guaranteed availability metrics or compensation for downtime.

Can I stream audio from the TTS API?

No, streaming, WebSocket, or real-time partial audio is not supported. You send a POST request with text and receive the complete audio file in the response. For longer texts, you must split them into parts, generate each file, and join them in your application logic to play continuous audio.

Is SSML supported in the TTS API?

No, SSML (Speech Synthesis Markup Language) is not supported. You send plain text up to 4096 characters. There are no phoneme dictionaries or custom pronunciation lexicons available. You control pacing and tone primarily by selecting different preset voices and adjusting the speed parameter between 0.25 and 4.0.

How do I handle rate limits?

The limit is 60 requests per minute per key, or 10 per minute before your first top-up. Requests are processed sequentially, so under load, a request may wait in a queue. For texts longer than 4096 characters, split them into parts and manage the queue of synthesis jobs in your code.

What happens if a request fails?

If synthesis fails, the charge is returned in full. You are not billed for unsuccessful requests. You can retry the request or split your text into smaller parts if the failure was due to length. Check the response status to determine if you need to adjust your input or retry.

Do I need a credit card to start?

No, you do not need a credit card. Sign up with Google to receive $0.50 of free trial credit valid for 7 days. For top-ups, we accept USDT on the TRON network (TRC-20) with a minimum of $5. There are no subscriptions, invoices, or minimum spend requirements to begin using the API.

First request

curl

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

Why use a TTS API in your JS app?

Sound wave illustration for: Why use a TTS API in your JS app?

Integrating speech synthesis into your web app doesn't require managing audio servers or complex codecs. Spindragons provides a straightforward API that returns audio files directly from simple JSON requests. You send text, you receive an audio file, and your application handles the playback.

This approach keeps your frontend lightweight. By offloading voice generation to our cloud API, you avoid the computational overhead of client-side synthesis. Your JavaScript code remains clean, focusing on user interaction while the API handles the audio production.

Simple JSON integration

Simple JSON integration

Sending text to generate speech is as simple as a standard HTTP POST request. You provide the input text and desired voice in a JSON body, and the API returns the audio file immediately. This simplicity reduces boilerplate code and speeds up development cycles for indie projects.

The endpoint accepts standard parameters like voice selection and speed, allowing you to customize audio output without parsing complex response structures. You can integrate this into any JavaScript framework, from vanilla ES6 modules to React or Vue applications.

  • Direct JSON request/response cycle
  • No complex parsing required
  • Immediate audio file delivery

Works with OpenAI SDKs

Since our API mimics the OpenAI speech endpoint structure, you can leverage existing OpenAI SDKs with minimal configuration. By simply updating the base_url to https://api.spindragons.info/v1, you can reuse familiar code patterns and authentication methods.

This compatibility means you don't need to learn a new library from scratch. If you already have code that calls OpenAI's TTS endpoint, it likely works with Spindragons after changing the base URL and API key.

No heavy dependencies

You don't need to bundle large voice synthesis libraries or manage multiple audio formats in your client-side code. The API handles all format conversions, returning mp3, wav, opus, flac, or pcm as requested.

This reduces your bundle size and improves load times. Your JavaScript app remains lightweight, relying on standard fetch or axios calls rather than heavy native audio engines or third-party synthesis packages.

Voices and Languages

Sound wave illustration for: Voices and Languages

Choose from eight distinct voice presets, ranging from warm narrators to energetic promos. Each voice is derived from licensed recordings, ensuring a consistent and professional tone for your JavaScript application. You can select the perfect voice to match your app’s personality without extra configuration.

The API supports 23 languages, including English, Spanish, German, Japanese, and Hindi. Any voice can speak any supported language, giving you flexibility for international projects. If the language isn’t specified, the system guesses it from the script, though setting it explicitly is recommended for non-English Latin text.

8 distinct voice presets

Select from four female and four male voices designed for specific tones. Options include aria for clear narration, nova for upbeat content, luna for storytelling, and sage for instructional audio. Male voices include felix for energetic promos, milo for conversational tones, atlas for neutral news, and orion for deep documentary styles.

  • aria: warm, clear narrator
  • nova: bright, upbeat
  • luna: soft, storytelling
  • sage: calm, instructional
  • felix: energetic, promo
  • milo: friendly, conversational
  • atlas: neutral, news
  • orion: deep, documentary

23 supported languages

The API handles Arabic, Chinese, Danish, Dutch, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese, Russian, Spanish, Swahili, Swedish, and Turkish. It does not support Vietnamese, Indonesian, Thai, Ukrainian, Romanian, Czech, Bengali, or other languages outside this list.

Natural-sounding output

Generated audio carries an inaudible watermark marking it as synthetic speech. The voices are based on licensed recordings from LibriTTS-R (CC BY 4.0) and public-domain LibriVox readings, providing realistic quality without the need for complex infrastructure management.

Developer-Friendly Features

Sound wave illustration for: Developer-Friendly Features

Spindragons provides flexible audio outputs to match your frontend needs. Choose from MP3, WAV, Opus, FLAC, or PCM formats. This lets you balance file size and quality without extra conversion steps.

Multiple audio formats

Select the format that best fits your player. MP3 and Opus are efficient for web delivery, while WAV and FLAC offer lossless quality for archival needs. PCM is available for raw audio processing.

  • MP3, WAV, Opus, FLAC, PCM

Speed control

Adjust speech pace with a single parameter. Set speed between 0.25 and 4.0 to fit your content’s rhythm. This works across all 8 voice presets without re-rendering.

Automatic language detection

The API guesses the language from the text script if you do not specify it. Latin script defaults to English. For non-English Latin text, explicitly set the language code to ensure accuracy.

Pricing for Freelancers

Sound wave illustration for: Pricing for Freelancers

Spindragons charges $0.01 per 1,000 characters, making it predictable for small projects. Failed requests are free, so you only pay for successful audio generation. The standard $0.50 Google Sign-In trial covers about 50,000 characters for 7 days.

Top-ups use USDT (TRC-20) with a $5 minimum. Balances never expire, and there are no hidden fees or invoices with VAT. This structure suits freelancers who prefer simple, usage-based costs over recurring commitments.

Pay per character

You are charged based on the exact character count of your input text, including spaces and punctuation. Long texts are split into 4,096-character chunks, and you pay for each successfully generated segment.

If a synthesis request fails, the charge is returned in full. This ensures you only pay for usable audio files delivered to your application.

  • $0.01 per 1,000 characters
  • Spaces and punctuation count
  • Failed requests are free

No monthly subscriptions

There are no seats, minimum spends, or recurring billing cycles. You simply top up your balance when needed and use it at your own pace.

This model eliminates waste for intermittent usage, allowing you to scale costs directly with your app’s demand without committing to a fixed monthly fee.

Transparent billing

All charges are clearly logged in your account dashboard. You can track characters used, request status, and remaining balance in real time.

Support is available via email. No complex contracts or VAT invoices are involved.

Technical Limits

Sound wave illustration for: Technical Limits

Understanding the technical constraints ensures your JavaScript integration remains stable and predictable. This section details the hard limits on input size, request frequency, and processing order so you can design your app accordingly without unexpected errors or delays.

4096 character limit

Each API request accepts a maximum of 4096 characters. If your input exceeds this, you must split the text into chunks, synthesize each part, and join the resulting audio files client-side or in your backend.

  • Input limit: 4096 characters per request
  • Spaces and punctuation count toward the limit
  • Split logic required for longer texts

Rate limits explained

Your API key allows 60 requests per minute once funded. New accounts start with a limit of 10 requests per minute until the first top-up is processed.

Requests are processed sequentially, not in parallel. Under heavy load, requests may wait in a queue, increasing total latency for long texts.

  • Standard limit: 60 requests/minute
  • Initial limit: 10 requests/minute
  • Sequential processing may cause queuing

Queue processing

Requests are handled one after another. Short phrases typically take a few seconds to generate, while longer texts process at roughly real-time speed (25 characters per second).

High concurrency may increase wait times. Plan your polling or async handling to accommodate variable generation times based on text length and current queue depth.

Technical Limits

Data Privacy

Sound wave illustration for: Data Privacy

Your input text is used solely to generate the audio file and is never added to training datasets. This ensures that the specific phrases you send for synthesis remain private and are not used to improve the underlying model.

Generated audio files are returned in the response and are not stored on our servers after delivery. Only request metadata—such as timestamp, character count, and status—is retained, and this is kept strictly for billing purposes.

Input text not trained

The text you submit is processed to create the audio response but is not used for training the TTS models.

This distinction means your unique content remains yours and does not influence future model generations.

No audio storage

We do not store the resulting audio files after they are returned to your application.

This minimizes data retention risks and ensures your generated voice assets are ephemeral unless you save them yourself.

Metadata for billing

Request metadata including time, character count, and status is kept to calculate your usage accurately.

This data is used exclusively for billing and is not used for marketing or model training.

Getting Started

Sound wave illustration for: Getting Started

Start by signing up on the /get-api-key/ page using your Google account. This grants you an instant $0.50 trial credit, valid for seven days, allowing you to test the API without immediate payment setup. Alternatively, you can create an account with an email and password, though this method does not include the trial credit.

Sign up with Google

Google sign-up provides immediate access to a $0.50 credit (approx. 50,000 characters). This trial is valid for 7 days, letting you verify voice quality and integration speed before committing funds. Accounts created via email/password start with zero balance.

  • Instant access to trial credit
  • 7-day validity period
  • No credit card required

Get your API key

Once registered, your dashboard displays a unique API key starting with 'tts-'. This key authenticates your requests to the API base URL. You can issue a new key at any time, which immediately invalidates the previous one, ensuring secure access control for your freelance projects.

  • Key format: 'tts-...'
  • Instant invalidation on rotation
  • Single active key per account

First request example

Use the OpenAI SDK or plain HTTP to send a POST request to https://api.spindragons.info/v1/audio/speech. Configure the base URL, include your Bearer token, and specify the model, voice, and input text. The API returns the audio file directly, ready for playback in your web app.

  • Endpoint: POST /v1/audio/speech
  • Supports OpenAI SDKs
  • Returns audio file directly

Common Use Cases

Sound wave illustration for: Common Use Cases

Spindragons helps indie developers add synthetic voice to static content without building complex audio pipelines. By sending simple JSON requests, you can generate realistic audio files directly in your JavaScript app, making it easy to integrate narration into existing projects.

The API supports 8 distinct voice presets and 23 languages, allowing you to tailor the audio to your project's tone. Whether you need a calm narrator or an energetic promo voice, the output fits naturally into web workflows.

Audiobook snippets

Generate short chapters or excerpts from public domain books using voices based on LibriTTS-R recordings. Since the API handles up to 4096 characters per request, you can split longer texts and join the resulting audio files seamlessly.

This approach works well for podcast intros or sample chapters, giving listeners a taste of the full story without requiring heavy media servers.

  • Supports 23 languages including English, Spanish, and German
  • Voices based on licensed recordings from LibriVox

Game dialogue

Add voice to character interactions in web-based games or interactive fiction. With speed control ranging from 0.25x to 4.0x, you can adjust the delivery to match the mood of the scene.

Since each request returns an audio file, you can cache the results to reduce latency during gameplay while keeping the infrastructure simple.

  • 8 distinct voice presets for different character types
  • Supports multiple audio formats like MP3 and WAV

Accessibility tools

Help users with visual impairments by converting text content into spoken word. The API’s output ensures a better user experience compared to robotic TTS systems.

Integrate the API into your web app to provide audio versions of blog posts, documentation, or articles, ensuring your content is accessible to a wider audience.

  • Input text is not used for training
  • No audio storage keeps data private

Support and Contact

Sound wave illustration for: Support and Contact

We do not offer phone lines or live chat, keeping overhead low for indie developers. All support is handled via email, ensuring your queries are documented and searchable.

Email support

Send your questions to [email protected]. We aim to respond within one business day. This direct line is the only way to reach our team.

Documentation

The /docs/ page contains the full API reference, including the curl example and parameter details. It is updated whenever endpoints or limits change.

Community feedback

We read every email to shape future updates. If you encounter a bug or have a feature request, let us know directly.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Requests are processed sequentially, returning audio files directly in the response.

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. Python documentation
  3. openai-python on GitHub
  4. MDN: Web Speech API
  5. IETF RFC 7845: Ogg Opus
  6. LibriVox public-domain audiobooks
  7. Node.js documentation
  8. Tether (USDT)
  9. TRON developer hub: TRC-20
  10. ISO 639 language codes
  11. LibriTTS-R paper (arXiv 2305.18802)
  12. curl documentation

More on this site