API Documentation for Text-to-Speech Integration

By Narative editorial team · Updated 2026-11-19

This guide helps SaaS product teams integrate high-quality AI voices into application interfaces and automated notifications. You will find concrete examples for generating speech using the Narative API, including ready-to-use cURL commands and OpenAI SDK configurations. We cover the full workflow from obtaining your API key to handling audio responses, ensuring you can deliver seamless multilingual experiences without managing complex pipelines.

The documentation explains how to leverage 23 languages and eight distinct voice presets to enhance user engagement. You will learn about request parameters, rate limits, and error handling, with specific details on billing adjustments and supported audio formats. Whether you are building global dashboards or notification systems, this page provides the technical specifics needed to start integrating Narative’s text-to-speech capabilities into your product immediately.

API Documentation for Text-to-Speech Integration

Frequently asked questions

What is the base URL for the API?

The API base URL is https://api.ppn88.info/v1. You use this endpoint for all requests, including POST for speech synthesis and GET for retrieving voices and models. This unified base URL allows you to integrate the Narative API into your existing infrastructure easily.

How do I set the Authorization header?

Include the header Authorization: Bearer tts-... with your unique API key. Each account has one active key at a time. You can generate a new key on your dashboard, which immediately invalidates the previous one, ensuring secure access to the synthesis endpoint.

Which models are available for synthesis?

Two models are available: tts-1 and tts-1-hd. Both use the same engine and pricing structure. You can choose either model depending on your preference, as they use the same engine and cost $0.01 per 1,000 characters.

Can I use the OpenAI Python SDK?

Yes, the official OpenAI SDKs work perfectly. Simply change the base_url to https://api.ppn88.info/v1 and provide your Narative API key. This compatibility allows you to use familiar code structures for text-to-speech integration without needing to learn a new client library.

How do I specify the language in the request?

Pass the optional language parameter with an ISO code. If omitted, the system guesses the language from the script, defaulting to English for Latin text. For non-English Latin-script content, explicitly setting the language parameter ensures accurate pronunciation and voice selection.

What is the maximum input length?

Each request supports up to 4096 characters of input text. For longer texts, split your content into chunks of this size and join the resulting audio files. Spaces and punctuation count toward this character limit, so plan your input accordingly.

How do I handle rate limit errors?

You are limited to 60 requests per minute per key. If you exceed this, requests may queue or return errors. Implement exponential backoff in your application logic to handle temporary limits gracefully, especially during high-volume generation periods or initial usage phases.

What happens if I exceed the 60 requests per minute?

Requests are processed sequentially, so exceeding the limit causes your requests to wait in a queue. This may increase latency, especially under load. New accounts start with a 10 requests per minute limit until the first top-up is processed and credited.

Is there a difference between tts-1 and tts-1-hd?

No functional difference exists between tts-1 and tts-1-hd; they use the same engine and pricing. Both models cost $0.01 per 1,000 characters. You can choose either model based on preference, as they use the same engine.

How do I switch my API key?

Generate a new key from your dashboard at /get-api-key/. The new key becomes active immediately, and the old one stops working at once. This ensures seamless transition without downtime, allowing you to rotate keys for security or project separation easily.

What audio formats can I request?

You can request audio in mp3, wav, opus, flac, or pcm formats. Specify the desired format using the response_format field in your request body. This flexibility allows you to choose the best codec for your application’s storage and playback requirements.

Does the API support speed adjustment?

Yes, you can adjust the playback speed between 0.25 and 4.0 using the speed parameter. This allows you to speed up or slow down the generated speech to fit your application’s timing needs, providing control over the final audio output duration.

How do I get a list of available voices?

Send a GET request to /v1/voices to retrieve all available voices, languages, formats, and pricing details. This endpoint provides the complete list of eight presets, including their characteristics and supported languages, helping you select the right voice for your specific use case.

Are the voices gender-specific to languages?

No, any voice can speak any of the 23 supported languages. The eight presets—such as Aria, Nova, or Felix—are not tied to specific languages. You can use any voice for any supported language, including Hindi, English, or German, without restriction.

First request

curl

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

Narative’s API is straightforward: get a key, send JSON, receive audio. Start by creating an account on the /get-api-key/ page using Google or email. This gives you a single active Bearer key for all requests.

Sign Up for an Account

Sign Up for an Account

Visit the registration page and choose Google Sign-In for immediate access or use email and password. Google sign-ups include a $0.50 free trial valid for 7 days, while email accounts start with zero balance. No credit card is required to begin.

Locate Key in Dashboard

Locate Key in Dashboard

Once logged in, the dashboard displays your active API key, current balance, and character usage. Copy this key to use in the Authorization: Bearer header. It is the only credential needed for authentication across all endpoints.

Issue New Key if Needed

You can issue a new key at any time from the dashboard. The old key stops working immediately upon generation, ensuring security if a key is compromised. Only one active key exists per account at any given time.

First Request with cURL

Sound wave illustration for: First Request with cURL

The API accepts standard JSON payloads via a POST request to the speech endpoint. You send the text to convert and receive a binary audio file in return, making integration straightforward for any HTTP client.

Basic JSON Body Structure

The request body consists of four primary fields: model, input, voice, and response_format. You specify the engine version, the text string (up to 4096 characters), the desired voice preset, and the output audio format.

Required Fields Explanation

The model field accepts 'tts-1' or 'tts-1-hd', both using the same engine. The input field contains your text, while the voice field selects from eight presets like aria or felix. The response_format defines the output type, such as mp3 or wav.

  • model: tts-1 or tts-1-hd
  • input: string, max 4096 chars
  • voice: e.g., aria, nova
  • response_format: mp3, wav, opus, flac, pcm

Example cURL Command

Use the following cURL command to generate speech. Replace YOUR_API_KEY with your secret key and adjust the voice and text parameters as needed.

  • curl -X POST "https://api.ppn88.info/v1/audio/speech" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "tts-1", "input": "Hello world", "voice": "aria", "response_format": "mp3"}'

Using the OpenAI SDK

Sound wave illustration for: Using the OpenAI SDK

Integrate Narative’s text-to-speech API into your SaaS notifications using the OpenAI SDK. By simply updating the base URL, you leverage familiar methods without learning a new client library, ensuring a smooth developer experience for your product team.

Change Base URL Configuration

Point the SDK’s base_url to https://api.ppn88.info/v1. This redirects standard speech requests to our endpoint while retaining all existing OpenAI SDK functionality. No other code changes are required for basic integration.

Standard Endpoint Compatibility

The API mirrors the OpenAI /v1/audio/speech structure. You send a JSON body with model, input, and voice parameters, receiving an audio file in response. This compatibility allows you to use the same SDK version your team already knows.

  • Supports tts-1 and tts-1-hd models
  • Accepts MP3, WAV, Opus, FLAC, and PCM formats

SDK Implementation Example

Initialize the client with your API key and the new base URL. Call the audio.speech.create method with your desired voice and text. The SDK handles the request and returns the audio file directly to your application.

Available Audio Formats

Sound wave illustration for: Available Audio Formats

Choose the audio format that best fits your application’s playback environment. MP3 offers universal compatibility for web players, while WAV provides uncompressed quality for high-fidelity needs.

MP3 for Web Compatibility

MP3 is the recommended default for most web and mobile applications. It balances file size and quality, ensuring broad support across all modern browsers and devices without requiring additional codecs.

WAV for High Quality

Select WAV when you need lossless audio fidelity. This format is ideal for archival purposes or playback systems that prioritize uncompressed sound quality over bandwidth efficiency.

Opus, FLAC, and PCM Options

Opus offers efficient compression for low-bandwidth scenarios. FLAC provides lossless compression for storage efficiency, while PCM delivers raw uncompressed audio for immediate processing pipelines.

  • Opus: Efficient compression for low-bandwidth scenarios
  • FLAC: Lossless compression for storage
  • PCM: Raw audio for immediate processing

Request Parameters Details

Sound wave illustration for: Request Parameters Details

Choose between tts-1 and tts-1-hd for identical engine quality and pricing. The choice is purely about the output format you prefer, as both models process requests at the same speed and cost.

Model Selection: tts-1 vs tts-1-hd

Both models deliver the same voice synthesis quality. Use tts-1 or tts-1-hd as they use the same engine and pricing.

Voice Preset Selection

Select from eight presets like aria (warm narrator) or atlas (neutral news). Each voice supports all 23 languages, allowing you to maintain consistent branding across global SaaS notifications without managing separate voice profiles.

  • Female: aria, nova, luna, sage
  • Male: felix, milo, atlas, orion

Speed Adjustment Range

Adjust playback speed between 0.25 and 4.0. This allows you to optimize delivery speed for automated alerts or ensure clarity for instructional content, fitting the audio perfectly into your application's user experience timeline.

  • Range: 0.25x to 4.0x
Request Parameters Details

Rate Limits and Quotas

Sound wave illustration for: Rate Limits and Quotas

Narative enforces a strict rate limit of 60 requests per minute per API key. This ensures fair usage for all SaaS product teams integrating our text-to-speech API into their automated notifications and application interfaces. Since requests are processed sequentially, under load a request may wait in a queue, which can slightly increase latency for large batches.

60 Requests Per Minute Limit

Each account is allocated one active key with a maximum throughput of 60 requests per minute. This limit applies to the POST /v1/audio/speech endpoint. If you are generating long texts that require splitting into multiple 4096-character chunks, ensure your implementation respects this rate to avoid delays.

Initial Limit Before Top-Up

New accounts start with a reduced limit of 10 requests per minute. This applies until you complete your first top-up. The limit increases to the full 60 requests per minute automatically once your USDT (TRC-20) payment is credited to your balance.

Handling Rate Limit Errors

When you exceed the limit, the API returns a 429 Too Many Requests error. Implement exponential backoff in your SDK integration to handle these retries gracefully. Failed requests are free, so retrying after a brief pause does not incur additional costs if the synthesis fails.

Error Handling and Responses

Sound wave illustration for: Error Handling and Responses

When synthesis fails, the API returns a standard error response indicating the issue, such as invalid input or a server-side processing error. These errors are distinct from rate limit responses, ensuring you can differentiate between quota exhaustion and actual synthesis failures.

The system guarantees that any request resulting in a failure is free. If the audio generation does not complete successfully, the character count is not deducted from your balance, and no charge is applied to your account.

Standard Error Codes

The API returns standard HTTP status codes to indicate the result of your request. A 4xx status indicates a client-side issue, such as an invalid voice ID or malformed JSON, while 5xx codes suggest a temporary server-side problem.

Rate limit errors return a 429 status, indicating you have exceeded the 60 requests per minute limit. You should implement exponential backoff to handle these gracefully without consuming additional quota.

  • 400: Bad Request (invalid parameters)
  • 401: Unauthorized (invalid API key)
  • 429: Too Many Requests (rate limit exceeded)
  • 500: Internal Server Error (synthesis failure)

Retry Logic for Failures

For transient 5xx errors, implement a retry mechanism with exponential backoff. Since requests are processed sequentially, brief delays often resolve temporary congestion without wasting credits.

Do not retry immediately on a 400 error, as the input is likely malformed. Verify your JSON structure and voice IDs before attempting again to avoid unnecessary API calls.

Billing Adjustment on Errors

Failed requests are completely free. If synthesis fails, the charge is returned in full, ensuring you only pay for successfully generated audio files. This applies to both tts-1 and tts-1-hd models.

Your dashboard reflects accurate usage only for successful generations. If you encounter a billing discrepancy, contact support via email with your request ID for investigation.

Voice and Model Endpoints

Sound wave illustration for: Voice and Model Endpoints

Retrieve your available assets programmatically before synthesis begins. These endpoints provide the definitive list of supported voices, languages, and audio formats without requiring a full API key for basic discovery.

GET /v1/voices Endpoint

Call this endpoint to list all eight voice presets and their supported languages. The response includes metadata for each voice, such as Aria, Nova, or Atlas, allowing your application to dynamically render voice selection dropdowns based on the user's preferred language.

  • Returns a JSON array of voice objects
  • Includes voice ID, name, and supported languages
  • Supports all 23 listed languages including Hindi and English

GET /v1/models Endpoint

Fetch the list of available TTS models. Currently, the API supports "tts-1" and "tts-1-hd", both using the same engine and pricing. This endpoint confirms the model IDs required for your speech synthesis requests.

  • Returns available model IDs
  • Confirms tts-1 and tts-1-hd availability
  • No additional configuration needed for model selection

Fetching Available Options

Integrate these calls into your onboarding flow to ensure clients always have the latest voice options. Since voices are static presets, caching this data for 24 hours is efficient. Use the returned voice IDs directly in your POST /v1/audio/speech requests.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Understanding cost predictability is vital for SaaS notification systems.

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. Python documentation
  4. MDN: Web Speech API
  5. openai-python on GitHub
  6. OpenAI API reference: create speech
  7. ISO 639 language codes
  8. W3C WAI: making audio and video accessible
  9. Creative Commons Attribution 4.0
  10. Tether (USDT)
  11. IETF RFC 7845: Ogg Opus
  12. curl documentation

More on this site