How to Generate Hindi Voiceovers Programmatically?

By SpinTopia editorial team · Updated 2026-11-19

This guide explains how to generate Hindi voiceovers programmatically using the SpinTopia REST API. It covers the complete workflow for indie developers building audio features for online stores and video content. You will learn to send text payloads, select appropriate voices like Aria or Atlas, and handle binary audio responses efficiently. The process is designed to be straightforward, requiring only standard HTTP requests and simple JSON bodies.

We focus on practical integration details, including specifying the Hindi language code, handling long scripts up to 4096 characters, and optimizing for fast response times. You will also find solutions for common errors, rate limit management, and security best practices. By the end, you will have a working curl example and understand how to scale your integration while keeping costs predictable and transparent.

How to Generate Hindi Voiceovers Programmatically?

Frequently asked questions

How do I specify Hindi as the language?

Include the "language" field in your JSON request body with the value "hi". This ensures the TTS engine uses the correct phonetic rules for Hindi, preventing mispronunciation that might occur if the language is guessed incorrectly from the script.

What is the ISO code for Hindi?

The ISO code for Hindi is "hi". Pass this value to the "language" parameter in your API request. This code is recognized by the engine to select the appropriate voice models for generating accurate Hindi speech audio.

Does the API auto-detect Hindi?

The API attempts to guess the language from the script if the "language" field is omitted. However, for Hindi, it is recommended to explicitly set "language": "hi" to ensure accuracy, as auto-detection may default to English for Latin-script text.

What happens if I don't set a language?

If you do not set the language, the API guesses it from the script. For non-English Latin-script text, this often defaults to English. For Hindi, explicitly setting the language parameter ensures the correct voice model and pronunciation are used.

How do I handle long Hindi scripts?

Split your script into parts of up to 4096 characters. Send each part as a separate POST request to the /v1/audio/speech endpoint. Then, join the resulting audio files programmatically to create the final continuous audio track.

Can I mix languages in one request?

No, each request supports a single language specified by the "language" field. To mix languages, split your text into language-specific segments, generate audio for each segment separately, and concatenate the resulting audio files in your application.

What voices work best for Hindi?

Any of the 8 available voices can speak Hindi. Choose based on tone: Aria for warm narration, Nova for upbeat content, Luna for storytelling, Sage for instructional, Felix for energetic promos, Milo for conversational, Atlas for neutral news, or Orion for deep documentary styles.

Is the API fast enough for real-time?

Generation is roughly real-time, processing about 25 characters per second. Short phrases take a few seconds. Requests are processed sequentially, so under load, a request may wait in a queue. It is not suitable for strict real-time streaming scenarios.

How do I split audio chunks?

Split your input text into chunks of maximum 4096 characters. Send each chunk as a separate POST request to the API. Receive the individual audio files for each chunk and concatenate them in your application to form the complete audio file.

What format is best for video ads?

MP3 is generally best for video ads due to its small file size and wide compatibility. You can also use WAV for uncompressed quality or Opus for efficient compression. Select the format via the "response_format" parameter in your request body.

Does the API support speed adjustment?

Yes, you can adjust the playback speed by including the "speed" parameter in your request. The value must be a float between 0.25 and 4.0. This allows you to speed up or slow down the generated audio to fit your video timeline.

What is the speed range?

The speed parameter accepts values from 0.25 to 4.0. A value of 1.0 is normal speed. Values below 1.0 slow down the speech, while values above 1.0 increase the pace. This range applies to all supported voices and languages.

Are there watermarking fees?

No, there are no additional fees for watermarking. Every generated audio file includes an inaudible watermark to mark it as synthetic speech. This feature is included in the standard per-character pricing without any extra cost or deduction from your balance.

Is the watermark audible?

No, the watermark is inaudible. It is embedded in the audio file to indicate that the speech is synthetic. You do not need to pay extra for it, and it does not affect the audio quality or listening experience for end-users.

Can I use the API for commercial videos?

Yes, the API is suitable for commercial use. The voices are based on licensed recordings from LibriTTS-R (CC BY 4.0) and public-domain audiobook readings. Generated audio is not stored, and input text is not used for training, ensuring clear usage rights for your content.

Do I need to credit the voices?

The voices are based on licensed recordings from LibriTTS-R (CC BY 4.0) and public-domain audiobook readings. Generated audio is not stored, and input text is not used for training.

What are the rate limits?

The rate limit is 60 requests per minute per API key. Before your first top-up, the limit is 10 requests per minute. If you exceed this limit, requests may be delayed or rejected. Monitor your usage via the dashboard to avoid interruptions.

How do I handle API errors?

Check the HTTP status code in the response. If synthesis fails, the charge is returned in full. Review the error message in the response body to identify issues like invalid parameters or rate limits. Implement retry logic with exponential backoff for transient errors.

Is there a dashboard for usage?

Yes, the /get-api-key/ page displays your current balance, trial status, characters used, and usage history. You can view your active API key directly from this page.

How do I top up my balance?

Top up your balance by sending USDT on the TRON network (TRC-20) with a minimum of $5. Transfers are credited automatically within minutes. There are no monthly plans or subscriptions. Send funds to the address provided in your account dashboard.

Understanding the API Workflow

Sound wave illustration for: Understanding the API Workflow

The core workflow begins with a POST request to https://api.spinstopia.cc/v1/audio/speech. You send a JSON body containing your Hindi text, the model identifier (tts-1 or tts-1-hd), and the chosen voice preset. Ensure the input field does not exceed 4096 characters.

Send Text Payload

Construct the JSON payload with required fields: model, input, voice, and response_format. Include the Authorization header with your Bearer token. For Hindi, explicitly set the language to 'hi' to ensure accurate pronunciation, though the API can sometimes guess from the script.

  • Include 'model': 'tts-1' or 'tts-1-hd'
  • Set 'input' with your Hindi text
  • Specify 'voice' (e.g., 'nova', 'atlas')
  • Add 'Authorization: Bearer your-api-key'

Receive Audio File

Upon success, the API returns the audio file directly in the response body. The content type will match your requested format (mp3, wav, opus, flac, or pcm). Failed requests return a JSON error object and incur no charge.

Handle Binary Data

Read the response body as binary data, not as a JSON string. Write this buffer directly to a file or pass it to your audio player. Avoid parsing it as text, as this will corrupt the audio data.

Selecting the Right Voice

Sound wave illustration for: Selecting the Right Voice

Choosing the right voice ensures your Hindi audio matches the content’s intent. Our eight presets cover narration, promos, news, and more, with every voice capable of fluent Hindi delivery.

Select based on your use case: warm narration for stories, upbeat tones for ads, or neutral clarity for updates. All voices support the full range of 23 languages, including Hindi.

Aria for Narration

Use Aria for storytelling or detailed product descriptions. Her warm, clear tone works well for e-commerce catalogs or educational content.

Aria’s natural flow keeps listeners engaged without sounding robotic, making it ideal for long-form content.

  • Warm, clear narrator style
  • Ideal for storytelling or catalogs
  • Supports full Hindi language range

Nova for Promos

Nova delivers a bright, upbeat energy perfect for promotional videos or social media ads. Her tone captures attention quickly.

Use Nova when you need high energy to drive conversions or highlight deals.

  • Bright, upbeat delivery
  • Great for promos and ads
  • High energy for conversions

Atlas for News

Atlas provides a neutral, clear voice suitable for news updates, store announcements, or factual content. His tone is professional and easy to understand.

Choose Atlas when clarity and neutrality are more important than emotional expression.

  • Neutral, clear delivery
  • Ideal for news or updates
  • Professional tone for factual content

Specifying Hindi Language

Sound wave illustration for: Specifying Hindi Language

To ensure accurate Hindi synthesis, you must explicitly specify the language using the ISO code hi in your API request body. While the system attempts to detect language from the script, relying on auto-detection can lead to mispronunciation for mixed-script texts or ambiguous inputs. Explicitly setting the language tag guarantees consistent output quality across all your automated voiceovers.

Using the language field removes ambiguity, especially when your input text contains mixed Latin characters or proper nouns that might confuse the default English fallback. This is critical for e-commerce product descriptions where clarity directly impacts user trust. Always include this parameter to avoid unexpected accents or pacing issues in the generated audio files.

ISO Code 'hi'

Include the field "language": "hi" in your JSON payload. This tells the TTS engine to apply Hindi phonetic rules regardless of the input script. It ensures that all eight voice presets render Hindi with the correct intonation and rhythm.

The ISO code is the most reliable way to lock in the language. Without it, the API guesses based on characters, which may default to English for Latin-script Hindi transliterations.

  • Field name: language
  • Value: "hi"
  • Applies to all 8 voices

Explicit Language Tag

Always send the language tag even if the text is purely Devanagari. This reduces processing variance and ensures deterministic results for your API integrations. It is a small addition that prevents edge-case failures in production.

Explicit tagging is required for non-English Latin script inputs. Without it, Latin text defaults to English, resulting in unnatural English-accented Hindi if the script is actually Hindi transliteration.

Auto-Detection Logic

If you omit the language field, the system guesses based on the script. Latin script defaults to English. Devanagari or Arabic scripts trigger their respective languages.

Auto-detection works for standard text but may fail on mixed-language inputs or code-switching common in e-commerce reviews. For critical voiceovers, explicit tagging is recommended over relying on detection.

The API does not support real-time language switching within a single request. Each 4096-character chunk is processed with one language setting.

  • Latin defaults to English
  • Devanagari triggers Hindi
  • Not supported: Vietnamese, Thai, etc.

Handling Long Scripts

Sound wave illustration for: Handling Long Scripts

Hindi scripts often exceed the single-request limit of 4096 characters. Developers must split input text into manageable chunks before sending them to the API endpoint. This ensures each request remains within the valid payload size while preserving the integrity of the audio output.

4096 Character Split

Break your Hindi text into segments, ensuring no single chunk exceeds 4096 characters. Spaces and punctuation count toward this limit. Accurate splitting prevents truncation errors and ensures every part of your script is processed correctly by the synthesis engine.

  • Limit each segment to 4096 characters including spaces.
  • Preserve sentence boundaries where possible to avoid awkward audio cuts.
  • Ensure the language field is set to 'hi' for each chunk.

Audio Joining Logic

Receive each generated audio file as a binary response. Your application must concatenate these files in the exact order of the original text chunks. This creates a seamless audio track from the individual segments without gaps or overlaps.

Chunk Processing

Process chunks sequentially or in parallel, respecting the rate limit of 60 requests per minute. Monitor your balance as each chunk consumes characters. Ensure your code handles the final combined file efficiently for immediate delivery to your e-commerce platform or video editor.

Optimizing for E-Commerce

Sound wave illustration for: Optimizing for E-Commerce

E-commerce audio needs must balance generation speed with audio clarity to maintain user engagement during product demos or navigation hints. By leveraging the API’s standard processing pipeline, you can deliver voiceovers that align with your site’s loading times without introducing perceptible latency for short phrases.

Fast Response Times

Short phrases typically generate within a few seconds, ensuring that interactive elements like button announcements or cart updates feel immediate. For longer product descriptions, the system processes requests sequentially, so batching independent descriptions can help maintain throughput without blocking the main thread.

Clear Pronunciation

Use the explicit language: hi parameter to ensure Hindi is correctly identified, avoiding fallback to English pronunciation rules for Latin-script inputs. This guarantees that product names, technical specs, and native terms are articulated with the intended phonetic accuracy, reducing customer confusion.

Consistent Tone

Selecting a single voice preset, such as Aria for narration or Felix for promos, ensures your entire catalog sounds unified. This consistency builds trust and brand recognition, as listeners hear the same character quality across all your audio assets, from help guides to sales videos.

Audio Format Selection

Choose MP3 for web playback to balance quality and file size, or WAV for high-fidelity requirements. The API supports multiple formats, allowing you to optimize delivery based on your specific e-commerce platform’s media handling capabilities.

Common Integration Errors

Sound wave illustration for: Common Integration Errors

Integration hiccups are common when first connecting to the TTS endpoint. The most frequent issues involve authentication headers, incorrect voice identifiers, or waiting for synthesis to complete on longer scripts.

Ensure your requests are properly formatted and your API key is active. Below are the specific errors to watch for during development.

Missing API Key

The API returns a 401 Unauthorized error if the Authorization: Bearer tts-... header is missing or malformed. Verify that your key is correctly appended to the request header without extra spaces or quotes.

Ensure you are using the key issued for spinstopia.cc. Keys are site-specific and do not work across other domains in the network.

  • Check header format: Authorization: Bearer tts-<your-key>
  • Verify key matches the current domain
  • Ensure no trailing whitespace in the token

Invalid Voice ID

Requests fail with a 400 Bad Request if the voice field does not match one of the eight presets (e.g., aria, nova, atlas). Use GET /v1/voices to retrieve the exact valid IDs before sending your payload.

Note that voice IDs are case-sensitive. Using Aria instead of aria will cause the synthesis to fail immediately.

  • Use aria, nova, luna, sage, felix, milo, atlas, or orion
  • Check exact casing in your code
  • Reference /v1/voices for the full list

Timeout Issues

Requests may time out if the server is under load or the script is long. Processing is sequential, so requests queue behind others. Short phrases take a few seconds; longer texts take longer.

Set your HTTP client timeout to at least 30 seconds. If the response is delayed, check the /v1/models endpoint status or your rate limit usage.

  • Set timeout to 30+ seconds
  • Check rate limits (60 req/min)
  • Retry with exponential backoff

Testing Your Setup

Sound wave illustration for: Testing Your Setup

Verify your integration works by consuming your free trial credit. New accounts receive $0.50 (approx. 50,000 characters) when signing in with Google, allowing immediate testing without payment setup. This credit is valid for 7 days.

Run a simple cURL command to send a Hindi script to the API. Ensure you specify the language parameter as 'hi' to prevent auto-detection from defaulting to English. Check that the response returns a binary audio file instead of JSON.

Use Free Trial Credit

Sign in via Google to activate the $0.50 trial credit. This provides roughly 50,000 characters of usage, sufficient for testing multiple voices and formats. Note that email/password accounts start with zero balance.

The trial expires in 7 days, so prioritize immediate validation of your endpoint connection and voice selection.

  • Google sign-in required for initial credit
  • Approximately 50,000 characters available
  • Expires after 7 days

Run Curl Test

Use the following cURL request to generate Hindi audio. Replace YOUR_API_KEY with your key from the dashboard.

curl -X POST "https://api.spinstopia.cc/v1/audio/speech" -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"model": "tts-1", "input": "नमस्ते, यह एक परीक्षा है।", "voice": "aria", "language": "hi", "response_format": "mp3"}' -o output.mp3

Verify Audio Output

Confirm the generated file plays correctly in a standard media player. The audio should contain clear Hindi pronunciation using the selected voice preset.

Check that the file size corresponds to the text length and duration. Failed requests return no charge, so verify status codes are 200.

  • Verify playback in standard players
  • Check file size vs text length
  • Confirm HTTP 200 status
Testing Your Setup

Scaling Your Integration

Sound wave illustration for: Scaling Your Integration

Scale your Hindi voiceover generation by processing multiple scripts concurrently while respecting the 60 requests per minute limit per key. Use batch processing to group independent requests, ensuring you stay within the 10 requests per minute baseline if no top-up is present.

Batch Processing

Group independent text inputs into parallel API calls. Since requests are processed sequentially under load, batching helps manage throughput without hitting the 60 RPM cap immediately.

  • Group independent text inputs into parallel API calls
  • Manage throughput without hitting the 60 RPM cap

Rate Limit Management

The API enforces a 60 requests per minute limit per key. Monitor your usage via the dashboard to avoid throttling. If you exceed the initial 10 RPM, ensure your USDT top-up is processed to increase limits.

  • Enforces a 60 requests per minute limit per key
  • Monitor usage via the dashboard to avoid throttling

Error Retry Logic

Implement exponential backoff for transient errors. Since short phrases take a few seconds and long texts take longer, wait before retrying failed requests to avoid overwhelming the queue.

  • Implement exponential backoff for transient errors
  • Wait before retrying failed requests to avoid queue overwhelm

Audio Format Selection

Sound wave illustration for: Audio Format Selection

Choosing the right audio format balances file size, compatibility, and quality for your specific use case. The API supports multiple formats to ensure your generated voiceovers integrate seamlessly into your e-commerce platform or video pipeline without unnecessary bloat or latency.

Selecting the optimal format depends on where the audio will be played. Web players often prefer compressed formats, while editing software requires lossless quality. Understanding these trade-offs helps you manage bandwidth and storage costs effectively while maintaining clear pronunciation.

MP3 for Web

MP3 is the standard for web delivery, offering a good balance between quality and file size. It is widely supported by all modern browsers and media players, making it ideal for product descriptions, navigation audio, or background voiceovers in online stores.

Use MP3 when you need broad compatibility and smaller file sizes for faster loading. It is suitable for most consumer-facing applications where minor compression artifacts are acceptable.

  • Ideal for HTML5 audio players
  • Small file size reduces bandwidth usage
  • Universal browser support

WAV for Quality

WAV provides uncompressed, lossless audio, preserving the full fidelity of the synthesized voice. This format is best for professional editing, where you might need to apply effects, adjust timing, or mix the voiceover with other audio tracks in post-production.

Choose WAV when audio quality is paramount and file size is less of a concern. It ensures that no detail is lost during the generation process, which is useful for high-end marketing videos or archival purposes.

  • Lossless quality
  • Best for editing and mixing
  • Larger file size

OPUS for Efficiency

OPUS offers superior compression efficiency compared to MP3, resulting in smaller file sizes with comparable or better perceived quality. It is particularly useful for mobile applications or low-bandwidth environments where minimizing data transfer is critical.

Use OPUS when you need to save bandwidth without sacrificing too much quality. It is an excellent choice for voice assistants or low-bandwidth scenarios where efficiency matters.

  • High compression efficiency
  • Good for mobile apps
  • Low bandwidth usage

Security Best Practices

Sound wave illustration for: Security Best Practices

Securing your API key is critical since it controls both access and billing. Store the key in environment variables or a secure vault, never hardcoding it in client-side code or public repositories. Use HTTPS for all requests to prevent interception.

Secure Key Storage

Keep your tts-... key in a secure environment variable. Avoid committing it to version control systems. Use infrastructure-level secrets management for production deployments.

  • Store keys in environment variables, not code.
  • Use infrastructure-level secrets management for production.

HTTPS Usage

Always use HTTPS when calling the API endpoint. This ensures your text payload and authentication header are encrypted in transit, protecting your data from eavesdropping.

Key Rotation Schedule

Rotate your API key anytime via the dashboard. Issuing a new key immediately invalidates the old one, ensuring that if a key is compromised, access stops instantly without waiting for a monthly cycle.

  • Issue a new key anytime via the dashboard.
  • The old key stops working immediately.

Monitoring Usage

Sound wave illustration for: Monitoring Usage

Monitoring your API usage ensures you stay within budget and understand your integration's performance. The dashboard provides real-time visibility into character consumption, account balance, and request history, allowing you to predict costs accurately before they exceed your limits.

Track Character Count

Each request charges based on the exact character count, including spaces and punctuation. The API returns the character count in the response headers, allowing you to verify billing accuracy immediately after each synthesis call.

  • Characters are counted exactly as sent in the input field.
  • Spaces and punctuation are included in the total count.
  • Failed requests do not consume credit, so track only successful outputs for cost analysis.

Monitor Balance

Your account balance reflects available credit for USDT top-ups and trial funds. The dashboard updates in real-time as requests are processed, ensuring you know your remaining limit before hitting a rate cap or insufficient funds.

  • Balance does not expire, even after the 7-day trial period ends.
  • Top-ups via TRON network (TRC-20) are credited automatically within minutes.
  • Minimum top-up amount is $5.

View Request Logs

Request metadata, including timestamp, character count, and status, is retained for billing verification. You can review these logs to debug issues or audit usage patterns without storing the generated audio files, which are returned in the response and not stored by default.

  • Logs include request time, model used, and character count.
  • Status codes indicate success, failure, or rate limit hits.
  • Audio files are not stored; only metadata is retained.

Support and Resources

Sound wave illustration for: Support and Resources

When your integration hits an edge case, support is available via email. We do not offer phone lines or live chat, so expect a written response to your ticket. This keeps communication clear and auditable for your engineering team.

For standard integration questions, refer to the official documentation.

Email Support Channel

Contact us at [email protected] for issues that require human review. Since we do not maintain a phone number or live chat, all support is asynchronous. Include your API key ID and request logs in your email to speed up diagnosis.

Documentation Links

The primary reference is /docs/, which covers the API schema, voice lists, and error codes. Use /get-api-key/ to generate keys and view your current usage balance. The /pricing/ page details the character-based costs.

  • API Reference: /docs/
  • Key Management: /get-api-key/
  • Pricing Details: /pricing/

Community Examples

Check the repository for community-submitted scripts. These examples demonstrate common patterns for handling the 4096-character limit and joining audio chunks. Use them as a baseline for your own e-commerce or video content workflows.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. The engine does not support SSML tags for fine-grained control over pauses, pitch, or emphasis.

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-node on GitHub
  3. FFmpeg documentation
  4. LibriVox public-domain audiobooks
  5. Tether (USDT)
  6. Python documentation
  7. openai-python on GitHub
  8. ISO 639 language codes
  9. MDN: Web Speech API
  10. Creative Commons Attribution 4.0
  11. OpenAI API reference: create speech
  12. LibriTTS-R paper (arXiv 2305.18802)

More on this site