Python Library to Convert Text to Speech Audio

By LinguaRiff editorial team · Updated 2026-11-19

This page provides a technical overview of the LinguaRiff text-to-speech API, designed for agencies managing high-volume YouTube content pipelines. You will find the exact JSON request structure, compatible with the OpenAI SDK, and the deterministic pricing model required for transparent character billing across multiple creator accounts.

Learn how to select from eight licensed voice presets, configure audio formats like MP3 and FLAC, and handle long scripts with client-side splitting. The guide covers the 4096-character limit, 23-language support, and the $0.01 per 1,000 characters pricing structure, ensuring you can integrate reliable synthetic speech into your production environment without monthly subscriptions.

Python Library to Convert Text to Speech Audio

Frequently asked questions

What is the character limit per request?

Each API request supports a maximum of 4096 characters. If your script exceeds this limit, you must split the text into smaller chunks and process them individually. The API does not automatically handle long-form content in a single call, so your implementation should manage the splitting logic before sending the request to the endpoint. Failed requests for invalid chunks are free.

Do spaces count towards the character limit?

Yes, spaces and punctuation are counted as characters. The billing rate of $0.01 per 1,000 characters applies to the total length of the input string, including all whitespace. Ensure your character counting logic accounts for every space and punctuation mark to accurately estimate costs and stay within the 4096-character per request limit.

Which voices are available for English narration?

Eight voices support English narration: Aria, Nova, Luna, and Sage for female tones, and Felix, Milo, Atlas, and Orion for male tones. Each voice offers a distinct style, from warm narration to energetic promo. All voices can speak any of the 23 supported languages, allowing you to maintain consistent audio quality across different content types.

How does the trial credit work?

New accounts created via Google sign-in receive $0.50 in trial credit, valid for seven days. This covers approximately 50,000 characters. Email-based accounts do not receive trial credit. The credit deducts from your balance as you generate audio, allowing you to test the API’s quality and performance before committing to a paid top-up.

Is the API compatible with the official OpenAI Python SDK?

Yes, the API uses the same request shape as the OpenAI speech endpoint. You can use the official OpenAI Python SDK by changing the base URL to https://api.99grill.cc/v1 and providing your API key. This allows you to leverage existing SDK functionality without writing custom HTTP request logic for standard text-to-speech operations.

What happens if a synthesis request fails?

If a synthesis request fails, the charge is returned in full. You are not billed for failed requests, ensuring you only pay for successfully generated audio files. This policy applies regardless of the reason for failure, providing financial protection for your agency’s budget while testing different voices, speeds, or formats.

Are the voices based on real human recordings?

Yes, the voices are based on licensed recordings from LibriTTS-R (CC BY 4.0) and public-domain audiobook readings from LibriVox. Each generated file includes an inaudible watermark marking it as synthetic speech. This ensures high-quality, natural-sounding audio while maintaining transparency about the synthetic nature of the generated content for your YouTube audience. Every file carries an inaudible watermark.

Can I use the generated audio for commercial YouTube videos?

The API provides a reliable text-to-speech service suitable for commercial content pipelines. Generated audio files are returned in the response and not stored by the API, allowing you to download and use them directly in your YouTube videos. The deterministic pricing and transparent billing make it easy to scale production for multiple creator accounts.

How are long scripts handled in the API?

You must split long texts into parts of up to 4096 characters and join the resulting audio files. The API processes requests sequentially, so under load, a request may wait in a queue. For long scripts, implement a client-side splitter to manage chunking and concatenation efficiently before sending requests to the endpoint.

What payment methods are accepted?

We accept USDT on the TRON network (TRC-20) for top-ups. There are no credit cards, PayPal, or invoices. Transfers are credited automatically within minutes. The minimum top-up amount is $5. This method ensures fast, borderless payments for agencies managing multiple accounts without the friction of traditional banking or subscription management systems.

Is there a minimum spend requirement?

There is no minimum spend requirement for using the API. You pay only for the characters you generate, with a rate of $0.01 per 1,000 characters. The only financial threshold is the $5 minimum for a USDT top-up. This allows agencies to scale usage up or down without committing to fixed monthly costs.

Does the balance expire after the trial?

No, your balance does not expire. Trial credit is valid for seven days, but any top-up funds remain available indefinitely. You can top up via USDT at any time, and the balance will be credited automatically. This ensures that your agency’s audio production pipeline remains uninterrupted, regardless of when you choose to add funds.

Which languages does the API support?

The API supports 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. Languages like Vietnamese, Indonesian, Thai, Ukrainian, Romanian, Czech, and Bengali are not supported, so ensure your content aligns with this list.

How is the language detected if not specified?

If the language parameter is not set, the API guesses the language from the text script. Latin-script text defaults to English. For non-English Latin-script text, you should explicitly set the language parameter to ensure accurate pronunciation. This automatic detection simplifies integration but requires manual override for non-English Latin-script text to avoid misidentification.

First request

curl

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

API Overview

Sound wave illustration for: API Overview

LinguaRiff exposes a standard REST endpoint at https://api.99grill.cc/v1. Submissions use a simple JSON body compatible with the OpenAI speech schema, allowing agencies to integrate directly via existing OpenAI Python SDKs by adjusting the base_url.

Deterministic pricing applies regardless of volume. There are no tiered discounts. Charges are calculated strictly on character count, including spaces and punctuation. Failed requests incur no cost, ensuring predictable budgeting for high-volume YouTube content pipelines.

JSON-based request structure

JSON-based request structure

Requests are sent via POST to the /v1/audio/speech endpoint. The body requires model, input, voice, response_format, and optional speed parameters. The API accepts standard character strings up to 4096 characters.

OpenAI SDK compatibility

The API mirrors the OpenAI speech endpoint structure. Python developers can use the official OpenAI SDK, pointing the base_url to https://api.99grill.cc/v1. Authentication uses a Bearer token issued per account.

Deterministic pricing model

Pricing is fixed at $0.01 per 1,000 characters. There are no tiered discounts or variable rates based on model selection. Both tts-1 and tts-1-hd engines use the same rate, simplifying cost estimation for agency clients.

Voice Selection

Sound wave illustration for: Voice Selection

Select from eight distinct voice presets optimized for diverse YouTube content styles. Each voice delivers specific tonal characteristics suitable for narration, commentary, or promotional material, allowing precise alignment with your channel’s audio identity.

All voices support all 23 languages. For non-English Latin script text, explicitly set the language parameter to ensure accurate pronunciation, as the system defaults to English for Latin characters.

Female presets: Aria, Nova, Luna, Sage

Aria provides a warm, clear narrator tone ideal for structured content. Nova offers a bright, upbeat delivery for energetic videos. Luna delivers a soft, storytelling voice for narrative content. Sage ensures calm, instructional clarity for educational material.

  • Aria: warm, clear narrator
  • Nova: bright, upbeat
  • Luna: soft, storytelling
  • Sage: calm, instructional

Male presets: Felix, Milo, Atlas, Orion

Felix delivers energetic, promo-style audio. Milo provides a friendly, conversational tone for direct address. Atlas offers a neutral, news-style delivery. Orion provides a deep, documentary voice for serious content.

  • Felix: energetic, promo
  • Milo: friendly, conversational
  • Atlas: neutral, news
  • Orion: deep, documentary

Licensed recordings from LibriVox

All eight voice presets are based on licensed recordings from LibriTTS-R (CC BY 4.0). The audio data originates from LibriVox public-domain audiobook readings, ensuring reliable source material for synthetic generation without additional licensing complexity.

Audio Formats & Quality

Sound wave illustration for: Audio Formats & Quality

LinguaRiff supports MP3, WAV, Opus, FLAC, and PCM output formats, allowing agencies to select the optimal balance between file size and fidelity for their YouTube content pipelines. This flexibility ensures compatibility with major video editing and distribution platforms without requiring additional conversion steps.

MP3, WAV, Opus, FLAC, PCM support

Each format serves specific production needs, from lightweight web delivery to archival-quality master files. The API returns the audio file directly in the response, streamlining integration into automated publishing workflows.

Inaudible synthetic watermarking

Every generated audio file contains an inaudible watermark that identifies the content as synthetic speech. This provides a clear audit trail for content origin, distinguishing AI-generated narration from human-recorded voiceovers in your media library.

Real-time generation speed

Generation typically occurs at roughly real-time speed, processing approximately 25 characters of text per second of audio. While short phrases may take a few seconds, longer scripts are processed sequentially, so under load a request may wait in a queue.

Language Support

Sound wave illustration for: Language Support

LinguaRiff supports 23 languages, allowing agencies to produce localized YouTube content without managing multiple voice engines. The API handles Arabic through Turkish, including major markets like English, Spanish, German, and Japanese, ensuring broad geographic coverage for creator pipelines.

23 supported languages

Supported languages include 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 preset can speak any of these languages, providing consistent audio quality across diverse regional content.

  • Arabic, Chinese, Danish, Dutch, English, Finnish, French, German, Greek, Hebrew, Hindi, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese, Russian, Spanish, Swahili, Swedish, Turkish

Automatic language detection

The API automatically infers the language from the input script. Latin script text defaults to English if no language is specified, simplifying workflows for primary English-language YouTube channels where manual configuration is unnecessary.

Explicit language code setting

For non-English Latin-script text, set the language parameter explicitly to ensure accurate pronunciation. This prevents misidentification and guarantees the correct voice rendering for specific regional dialects or less common language pairs in your production pipeline.

Volume Handling

Sound wave illustration for: Volume Handling

Large YouTube scripts often exceed the single-request character limit, requiring a structured approach to ensure consistent audio output without data loss. Our API enforces a strict 4,096-character boundary per synthesis job, which aligns with typical segment lengths for professional narration workflows.

Agencies managing high-volume content pipelines can implement client-side splitting logic to divide longer texts into manageable chunks before submission. This ensures predictable processing times and maintains synchronization across multiple creator accounts.

4096 character limit per request

The API accepts a maximum of 4,096 characters per POST request. This limit includes all spaces and punctuation marks, which count toward your character billing. Requests exceeding this threshold will fail, so ensure your input payload is validated before submission. Failed requests are free.

  • Limit applies to the input field in the JSON body.
  • Spaces and punctuation are counted as characters.
  • Exceeding the limit results in a failed request, which remains free.

Client-side splitting for long scripts

For scripts longer than 4,096 characters, you must split the text into segments on the client side. Each segment is submitted as a separate request to the /v1/audio/speech endpoint. This method allows you to control the granularity of audio segments, which is essential for precise editing in video production pipelines.

Splitting logic should preserve semantic boundaries where possible to avoid awkward pauses between joined audio files. Since requests are processed sequentially under load, splitting ensures that no single request blocks the generation of the entire script.

  • Split text into chunks of ≤ 4,096 characters.
  • Submit each chunk as an independent request.
  • Maintain order of segments for accurate reconstruction.

Sequential audio joining

After receiving the audio files for each segment, you must join them sequentially to reconstruct the full script. The API does not handle multi-segment joining server-side. This gives agencies full control over the final audio assembly, allowing for quality checks between segments.

Ensure that the audio formats are compatible before joining. We recommend using WAV or FLAC for lossless concatenation to prevent quality degradation during the assembly process. MP3 is also supported but may introduce minor gaps depending on the encoder used.

  • Retrieve audio files in the order of submission.
  • Concatenate files sequentially to match the original text order.
  • Use lossless formats like WAV or FLAC for best quality.
Volume Handling

Pricing Structure

Sound wave illustration for: Pricing Structure

LinguaRiff applies a strict $0.01 per 1,000 character rate for all synthesis requests. This flat rate applies uniformly across both the tts-1 and tts-1-hd models, ensuring predictable cost allocation for high-volume YouTube content pipelines.

$0.01 per 1,000 characters

The API charges $0.01 for every 1,000 characters processed. This deterministic pricing eliminates variable tier complexities, allowing agencies to forecast expenses precisely based on script length.

Spaces and punctuation counted

Every character in the input string contributes to the total, including spaces and punctuation marks. Accurate character counting ensures that billing aligns exactly with the text volume sent to the synthesis engine.

No monthly subscriptions

The service operates on a pay-as-you-go basis with no recurring monthly subscriptions or minimum spend requirements. Credits remain available in the account balance without expiration, supporting flexible agency workflows.

Trial & Onboarding

Sound wave illustration for: Trial & Onboarding

The onboarding process begins with a Google sign-up, granting immediate access to an API key and a $0.50 trial credit. This initial balance covers approximately 50,000 characters, allowing agencies to validate the pipeline before committing to larger volume purchases.

Google sign-up with $0.50 credit

Signing in via Google provisions a unique API key instantly. The account starts with $0.50 of credit, which is sufficient for testing up to 50,000 characters of text. This allows teams to verify integration accuracy without upfront payment.

7-day trial validity

The trial credit remains active for seven days from the moment of sign-up. Agencies can use this window to test voice selection, format variations, and speed settings across their YouTube content pipelines. Once the period expires, the trial credit is lost, but any top-up balance remains valid indefinitely.

Immediate API key issuance

Upon successful authentication, the API key is issued immediately. This key is valid for the https://api.99grill.cc/v1 endpoint and can be rotated at any time (a new key stops the old one instantly). If a key is revoked, it stops working instantly, ensuring tight control over agency access.

Integration Speed

Sound wave illustration for: Integration Speed

LinguaRiff integrates directly into your YouTube content pipeline via standard REST endpoints, eliminating the need for proprietary middleware. The API adheres to the OpenAI speech endpoint shape, allowing agencies to route requests through existing infrastructure with minimal configuration changes.

By leveraging the official OpenAI SDKs with a simple base_url adjustment, teams can maintain consistent codebases across multiple services. This approach reduces development overhead and ensures that high-volume character billing remains transparent and deterministic for all creator accounts.

Standard REST endpoint

The core endpoint POST https://api.99grill.cc/v1/audio/speech accepts JSON bodies identical to the OpenAI speech format. This compatibility allows agencies to swap providers without rewriting client logic, ensuring stable production environments for automated video generation workflows.

No custom SDK required

We do not maintain a separate LinguaRiff SDK, reducing version dependency risks. You can use the official OpenAI Python SDK by setting base_url to https://api.99grill.cc/v1. This ensures you are always using a stable, well-documented library.

Straightforward Python implementation

Implementation requires only standard HTTP calls or the OpenAI client. Pass your tts-... key via the Authorization header. The JSON response returns the audio file directly, enabling immediate storage or streaming into your video editing pipeline. (Note: The API does not support WebSocket streaming; audio is returned as a file in the response body).

  • Use tts-1 or tts-1-hd models
  • Supports mp3, wav, opus, flac, pcm
  • Rate limit: 60 requests per minute per key

Data Privacy

Sound wave illustration for: Data Privacy

LinguaRiff processes input text exclusively for the immediate synthesis of audio files. Your source scripts are not ingested into training datasets, ensuring that your proprietary content remains distinct from the model's learning corpus.

Input text not used for training

The text submitted for conversion is used solely to generate the audio response. It is not retained for retraining the TTS engine, preserving the confidentiality of your specific voiceovers and scripts.

Audio not stored after response

Generated audio files are returned directly in the API response and are not permanently stored on our servers. Once delivered, the audio data is removed, minimizing data exposure for your production pipeline.

Billing metadata retention

We retain request metadata, including timestamp, character count, and status, strictly for billing accuracy. This data ensures transparent invoicing and helps track usage limits without storing the actual content of your voiceovers.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Transfers are credited automatically within minutes, ensuring your production pipeline remains uninterrupted.

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. MDN: Web Speech API
  3. W3C WAI: making audio and video accessible
  4. LibriVox public-domain audiobooks
  5. Node.js documentation
  6. Creative Commons Attribution 4.0
  7. OpenAI API reference: create speech
  8. TRON developer hub: TRC-20
  9. curl documentation
  10. Tether (USDT)
  11. ISO 639 language codes
  12. openai-node on GitHub

More on this site