Portuguese Text-to-Speech API Integration Guide

By Polyglot Dev editorial team · Updated 2026-11-19

This guide shows indie developers how to integrate Polyglot Dev’s multilingual text-to-speech API into their applications. You will learn to generate high-quality Portuguese audio files using a simple, OpenAI-compatible endpoint. We cover everything from obtaining your API key to handling responses in Python or JavaScript, ensuring you can deliver clear legal or informational content to your users with minimal code.

You will find concrete examples for basic requests, SDK integration, and handling long texts that exceed character limits. The guide explains rate limits, error handling, and audio format options like MP3 and WAV. Whether you are building a reading assistant or an automated notification system, this page provides the specific technical details you need to get started quickly and reliably.

Portuguese Text-to-Speech API Integration Guide

Frequently asked questions

What is the API endpoint?

Send a POST request to https://api.abc777.info/v1/audio/speech. The endpoint accepts a JSON body containing your text, voice selection, and format preferences. This structure mirrors the standard OpenAI speech endpoint, ensuring compatibility with existing integrations and tools.

How do I authenticate requests?

Include your API key in the request header using the format Authorization: Bearer tts-... You can generate or rotate your key on the /get-api-key/ page. Each account holds one active key at a time, which stops immediately upon issuing a new one.

Which models are available?

Two models are available: tts-1 and tts-1-hd. Both use the same underlying engine and incur identical pricing. You can choose either model based on your preference, as there is no functional difference in quality or cost between them for standard usage.

What is the difference between tts-1 and tts-1-hd?

There is no difference. Both tts-1 and tts-1-hd use the same engine and have the same price of $10 per 1 million characters. You can use either model interchangeably without affecting the cost or the quality of the generated audio output.

Can I use the OpenAI Python SDK?

Yes, the official OpenAI Python SDK works perfectly. Simply change the base_url to https://api.abc777.info/v1 and provide your site-specific API key. This allows you to use familiar code structures and methods without needing to learn a new library or integration pattern.

Can I use the OpenAI JavaScript SDK?

Yes, the official OpenAI JavaScript SDK is compatible. Update the base_url to https://api.abc777.info/v1 and use your API key. This enables seamless integration into your web applications or Node.js services using standard methods you likely already know from other OpenAI projects.

What is the character limit per request?

Each request supports up to 4096 characters of input text. If your text exceeds this limit, you must split it into smaller parts. The API returns audio files for each part, which you can then join together to create the final audio file.

How do I set the language to Portuguese?

Include the language parameter set to the ISO code for Portuguese in your JSON body. Although the API guesses languages from Latin script, explicitly setting the language ensures accurate Portuguese synthesis. This is recommended to avoid defaulting to English for ambiguous text.

What formats are supported?

You can request audio in mp3, wav, opus, flac, or pcm formats. Select the response_format field in your request body to specify your preferred output. This flexibility allows you to choose the best balance between file size and quality for your specific application needs.

What are the rate limits?

The limit is 60 requests per minute per API key. New accounts start with a lower limit of 10 requests per minute until the first top-up is processed.

What happens if I exceed the rate limit?

If you exceed the 60 requests per minute limit, your requests may wait in a queue. The API processes requests sequentially, so high load may also cause delays. Ensure your implementation handles retries gracefully to manage temporary spikes in traffic effectively.

How are errors returned?

Errors are returned as standard HTTP status codes with a JSON body describing the issue. Failed synthesis requests are free, and any charges are returned in full. Check the response body for details on why the request failed, such as invalid parameters.

Is SSML supported?

No, SSML is not supported. The API accepts plain text input only. You cannot use SSML tags to control pronunciation, pauses, or emphasis. If you need specific control, you must manage these aspects by splitting your text or adjusting the speed parameter.

Can I stream the audio?

No, streaming is not supported. The API returns the complete audio file in the response body after synthesis is finished. You cannot receive partial audio chunks in real-time. This means you must wait for the full generation to complete before playing the audio.

First request

curl

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

Get Your API Key

Sound wave illustration for: Get Your API Key

Accessing the Polyglot Dev API starts with creating an account on our /get-api-key/ page. You can authenticate instantly using your Google account or by setting up a standard email and password. This step generates your unique API credentials, allowing you to begin sending text-to-speech requests immediately.

Sign Up with Google

Sign Up with Google

Click the Google sign-in button on the registration page. After authentication, you receive a free trial credit of $0.50, valid for 7 days. This provides approximately 50,000 characters for testing integration without requiring payment details upfront.

Sign Up with Email

Sign Up with Email

Enter your email address and create a password to register. Unlike Google sign-ups, this method does not include the free trial credit. You must top up your balance before making your first request, as the account starts with zero credit.

Key Management

Your dashboard displays your active API key, current balance, and usage statistics. You can issue a new key at any time; the previous key stops working immediately. This ensures secure access management without needing to contact support.

  • Use the key in the Authorization header: Bearer tts-...
  • One active key per account
  • Old keys stop instantly upon renewal

Quickstart with cURL

Sound wave illustration for: Quickstart with cURL

Start by sending a POST request to the speech endpoint. The API returns a binary audio file, allowing you to immediately play or save the output without additional processing steps.

Basic Portuguese Request

Use the following cURL command to generate Portuguese audio. Replace YOUR_API_KEY with your key from /get-api-key/. The tts-1 model handles Portuguese natively, but you should set the language parameter to ensure accurate pronunciation, as Latin script defaults to English.

  • ```bash curl -X POST https://api.abc777.info/v1/audio/speech \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "tts-1", "input": "Olá, como você está?", "voice": "nova", "response_format": "mp3"}' \ -o speech.mp3 ```

Specifying Voice and Format

You can customize the output by changing the voice and response_format fields. For legal or informational content, aria (warm narrator) or atlas (neutral news) work well. Formats include mp3, wav, opus, and flac.

  • Set speed between 0.25 and 4.0 to adjust playback rate.

Response Handling

The API returns the audio file directly in the response body. Save this binary data to a file on your server or send it to your frontend player. No JSON wrapper is used for the audio data itself.

OpenAI SDK Integration

Sound wave illustration for: OpenAI SDK Integration

Polyglot Dev’s API follows the OpenAI request shape, allowing you to reuse existing SDK clients by simply swapping the base URL. This means you can integrate multilingual Portuguese TTS into your indie app without learning a new library or rewriting your integration logic from scratch.

Base URL Configuration

Point your OpenAI SDK client to our API base URL: https://api.abc777.info/v1. Use your API key in the standard Authorization header. This compatibility lets you use official OpenAI SDKs directly with our endpoints.

Python SDK Example

Install the openai package and configure the client with our base URL. Send a POST request to /v1/audio/speech with your Portuguese text, selected voice, and desired format. The response returns the audio file directly.

  • Install via pip install openai
  • Set base_url="https://api.abc777.info/v1"
  • Pass model="tts-1" or "tts-1-hd"

JavaScript SDK Example

Initialize the OpenAI SDK in your JavaScript environment, pointing to our base URL. Make a fetch call to the speech endpoint with your JSON body containing the text, voice, and language parameters. Handle the binary response to save or play the audio file.

  • Use new OpenAI({ baseURL: 'https://api.abc777.info/v1' })
  • Send input, voice, and response_format
  • Handle binary audio data in response

Request Parameters

Sound wave illustration for: Request Parameters

Configure your synthesis requests with precise control over model quality, voice character, and delivery speed. Every parameter directly influences the resulting audio file’s characteristics, ensuring the output matches your legal or informational content requirements.

Model Selection (tts-1 vs tts-1-hd)

Both tts-1 and tts-1-hd use the identical underlying engine and carry the same price of $0.01 per 1,000 characters. Choose based on your latency needs rather than cost differences, as the audio quality is consistent across both presets.

Voice Presets

Select from eight licensed presets to match your content’s tone. Female voices include aria (warm narrator), nova (upbeat), luna (soft storytelling), and sage (calm instruction). Male options feature felix (energetic promo), milo (conversational), atlas (neutral news), and orion (deep documentary).

  • All voices support all 23 languages, including Portuguese.

Speed and Language

Adjust playback speed between 0.25 and 4.0 to fit your pacing needs. While the API guesses the language from the script, explicitly setting the language field (e.g., pt-BR) ensures accurate pronunciation for non-English Latin text.

Response Formats

Sound wave illustration for: Response Formats

Choose the output format that best fits your app’s bandwidth and playback requirements. All formats deliver the same high-quality synthetic speech, distinguished only by compression and file size.

Selecting the right format ensures smooth integration, whether you need maximum compatibility or efficient storage for large volumes of generated audio.

MP3 Output

MP3 is the default and most widely supported format. It offers excellent compression with minimal quality loss, making it ideal for web playback and mobile apps. Use this format when you need broad device compatibility without managing large files.

  • Default response format
  • Small file size for efficient bandwidth usage
  • Universal support across all modern browsers and players

WAV Output

WAV provides uncompressed, high-fidelity audio. Choose this format for applications requiring precise audio editing or when the downstream system prefers raw PCM data. Note that WAV files are significantly larger than MP3s, so consider storage and bandwidth implications.

  • Uncompressed audio quality
  • Ideal for post-processing or editing workflows
  • Larger file size compared to compressed formats

OPUS and FLAC Options

OPUS offers high compression efficiency, making it suitable for low-bandwidth environments or archival storage. FLAC provides lossless compression, preserving every detail of the generated speech.

  • OPUS: High efficiency, small size
  • FLAC: Lossless quality, smaller than WAV
Response Formats

Rate Limits and Quotas

Sound wave illustration for: Rate Limits and Quotas

Rate limits protect the service during high-volume generation. You can make 60 requests per minute with a valid API key, ensuring consistent throughput for your application’s audio synthesis needs.

60 Requests Per Minute

Each API key allows up to 60 requests per minute. This limit applies per key. Each account maintains one active key at a time.

10 Requests Before Top-Up

New accounts without a top-up start with a lower limit of 10 requests per minute. This ensures stability for free trial users before they add USDT to their balance. Once topped up, the limit increases to the standard 60 requests per minute.

  • Free trial accounts: 10 requests/minute
  • Topped-up accounts: 60 requests/minute
  • Limit resets every 60 seconds

Queue Behavior

Requests are processed sequentially. If you exceed the limit, subsequent requests may wait in a queue. Short phrases take a few seconds to generate, while longer texts take longer, potentially causing brief delays under heavy load.

Error Handling

Sound wave illustration for: Error Handling

When synthesis fails, the API returns standard HTTP error codes alongside clear JSON messages. These errors typically indicate input issues, such as text exceeding the 4,096-character limit, invalid voice identifiers, or temporary network hiccups. Always check the response body for the specific error message to quickly identify the root cause.

Understanding these codes helps you implement robust error handling in your application. By anticipating these failures, you can ensure a smooth experience for your users, especially when processing legal or informational documents where accuracy is paramount.

Common Error Codes

The API uses standard HTTP status codes to indicate success or failure. A 400 Bad Request usually means your input text is malformed or exceeds the character limit. A 500 Internal Server Error suggests a temporary issue on our end.

A 429 Too Many Requests code indicates you have hit the rate limit. Review the response headers for detailed diagnostics if the error persists.

  • 400: Invalid input or parameter format
  • 401: Invalid or expired API key
  • 429: Rate limit exceeded (60 req/min)
  • 500: Temporary server error

Retry Logic

For transient errors like 500 or 503, implement exponential backoff. Start with a short delay and increase it with each retry to avoid overwhelming the server during high load. Since requests are processed sequentially, queuing delays may occur under heavy traffic.

Avoid retrying 400 errors, as they will fail again with the same input. Only retry 429 errors if you are sure you have reduced your request rate below the 60 requests per minute limit.

Billing Adjustments

If a synthesis request fails, the charge is returned in full. You do not lose credits for failed attempts. Failed requests are free, ensuring you only pay for successfully generated audio files.

Check your balance on the /get-api-key/ page to verify refunds. Credits never expire, so any refunded amount remains available for future use. This system ensures you are only charged for successful audio generation.

Long Text Handling

Sound wave illustration for: Long Text Handling

For legal documents exceeding 4,096 characters, you must split the text into smaller chunks before sending requests. Each chunk is processed independently to ensure stability and accurate character counting.

4096 Character Limit

The API strictly enforces a 4,096-character limit per request. Spaces and punctuation count toward this total. If your text is longer, the request will fail without charge.

Splitting Text Manually

Split your input at logical boundaries, such as sentence ends, to maintain natural audio flow. Avoid cutting mid-word. Calculate character counts carefully, as spaces and punctuation are included in the limit.

Joining Audio Files

Receive separate audio files for each chunk. Concatenate them in your application to produce the final legal document audio. This approach ensures reliability even for lengthy contracts or terms of service.

Listen to the 8 voices

Each sample below was generated by this API from the same sentence. Under heavy load, processing time increases slightly due to single-threaded synthesis, but the system remains reliable for batch jobs.

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. W3C WAI: making audio and video accessible
  3. LibriVox public-domain audiobooks
  4. openai-node on GitHub
  5. OpenAI API reference: create speech
  6. Python documentation
  7. curl documentation
  8. Tether (USDT)
  9. openai-python on GitHub
  10. IETF RFC 7845: Ogg Opus
  11. LibriTTS-R paper (arXiv 2305.18802)
  12. LibriTTS-R corpus (OpenSLR 141)

More on this site