Portuguese text-to-speech
Portuguese (Brazilian voices): 3 Kokoro voices on the OpenAI /v1/audio/speech endpoint. $5.20 per million characters, mp3 or wav, no daily cap.
Voices
Kokoro voice ids encode language and gender in the prefix (pf_, pm_). Click to copy.
Quickstart
curl https://api.inferenceapis.com/v1/audio/speech \
-H "Authorization: Bearer $INFERENCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "hexgrad/Kokoro-82M", "voice": "pf_dora", "input": "Olá, esta é uma amostra da voz.", "response_format": "mp3"}' \
--output portuguese.mp3import os
from openai import OpenAI
client = OpenAI(base_url="https://api.inferenceapis.com/v1", api_key=os.environ["INFERENCE_API_KEY"])
audio = client.audio.speech.create(model="hexgrad/Kokoro-82M", voice="pf_dora", input="Olá, esta é uma amostra da voz.")
audio.write_to_file("portuguese.mp3")Notes
- Pass
language: "pt"to make pronunciation of ambiguous tokens follow Portuguese rules when mixing scripts. - Numbers, dates and abbreviations are read as written; spell out anything that must be pronounced a specific way.
- Billing is per input character; the
X-Usage-Charactersheader shows the metered count.
Cost and speed for Portuguese
Kokoro is billed at $5.20 per million characters, so a 1,000-word Portuguese article of roughly 6,000 characters costs about $0.03 and an hour-long audiobook chapter of 60,000 characters about $0.31. In our measurement a 300-character request returned in 0.84 s, fast enough to generate sentence by sentence in an interactive app. Orpheus is English-only, so Portuguese output always uses Kokoro. Requests up to 4,096 characters are accepted; split longer text on sentence boundaries and concatenate the audio.
Other languages with voices: English, Japanese, Chinese, Spanish, French, Hindi, Italian.
Speech-to-text in Portuguese
The reverse direction: transcribe Portuguese audio with Whisper on the Portuguese speech-to-text page.
