Inference APIs

Voices and samples

Every sample is this sentence, generated through the API with default settings: “Il fait très beau aujourd'hui, alors cet après-midi je vais me promener au parc avec des amis.”

ListenVoice idVoiceRound-trip check
FemaleAll 19 words understood

Round-trip check: we transcribed each sample with Whisper Large v3 and compared it with the text we sent. It tests whether the speech is intelligible to a machine, not whether it sounds natural to you; for that, listen.

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": "ff_siwis", "input": "Il fait très beau aujourd'\''hui, alors cet après-midi je vais me promener au parc avec des amis.", "response_format": "mp3"}' \
  --output french.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="ff_siwis", input="Il fait très beau aujourd\'hui, alors cet après-midi je vais me promener au parc avec des amis.")
audio.write_to_file("french.mp3")

Notes for French

  • There is one French voice, ff_siwis. If you need a male voice or several characters in French, Kokoro cannot do that today.
  • Numbers, dates and abbreviations are read as written. Spell out anything that must be pronounced a specific way.
  • Pacing follows punctuation; there is no SSML. speed changes the overall rate.

Cost and limits

Kokoro is billed at $5.20 per million Unicode characters of input. The 94-character sample above is 5.3 seconds of audio and costs $0.00049; at that rate an hour of French speech is about 64,000 characters, or roughly $0.33. A request accepts up to 20,000 characters; for longer text, split on sentence boundaries and join the audio. A paragraph returns in under a second in our measurement. Orpheus is English-only, so French always uses Kokoro.

Other languages: English · Japanese · Chinese · Spanish · Hindi · Italian · Portuguese

Speech-to-text in French

The reverse direction: Whisper Large v3 transcribed our French test clips with 6.6% word error. See French speech-to-text.