Inference APIs

Voices

Kokoro voice ids encode language and gender in the prefix (ef_, em_). Click to copy.

Quickstart

cURL
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": "ef_dora", "input": "Hola, esta es una muestra de la voz.", "response_format": "mp3"}' \
  --output spanish.mp3
Python · openai SDK
import 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="ef_dora", input="Hola, esta es una muestra de la voz.")
audio.write_to_file("spanish.mp3")

Notes

  • Pass language: "es" to make pronunciation of ambiguous tokens follow Spanish 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-Characters header shows the metered count.

Cost and speed for Spanish

Kokoro is billed at $5.20 per million characters, so a 1,000-word Spanish 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 Spanish 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, French, Hindi, Italian, Portuguese.

Speech-to-text in Spanish

The reverse direction: transcribe Spanish audio with Whisper on the Spanish speech-to-text page.