Inference APIs

Voices and samples

Every sample is this sentence, generated through the API with default settings: “The quick brown fox jumps over the lazy dog, and then it stops to enjoy the afternoon sun.”

ListenVoice idVoiceRound-trip check
American, femaleAll 18 words understood
American, femaleAll 18 words understood
American, femaleAll 18 words understood
American, femaleAll 18 words understood
American, femaleAll 18 words understood
American, femaleAll 18 words understood
American, femaleAll 18 words understood
American, femaleAll 18 words understood
American, femaleAll 18 words understood
American, femaleAll 18 words understood
American, femaleAll 18 words understood
American, maleAll 18 words understood
American, maleAll 18 words understood
American, maleAll 18 words understood
American, maleAll 18 words understood
American, maleAll 18 words understood
American, maleAll 18 words understood
American, maleAll 18 words understood
American, maleAll 18 words understood
American, maleAll 18 words understood
British, femaleAll 18 words understood
British, femaleAll 18 words understood
British, femaleAll 18 words understood
British, femaleAll 18 words understood
British, maleAll 18 words understood
British, maleAll 18 words understood
British, maleAll 18 words understood
British, maleAll 18 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.

Orpheus voices

Orpheus 3B is slower and costs more, and in exchange it acts: it supports inline tags such as <laugh> and <sigh>. The sample sentence is “I honestly did not expect that to work <laugh> but here we are.”

ListenVoice idRound-trip check
All 12 words understood
All 12 words understood
All 12 words understood
All 12 words understood
All 12 words understood
All 12 words understood
2 of 12 words misheard
All 12 words understood

Whisper does not transcribe laughter, so the tag is left out of the comparison. Use model: "canopylabs/orpheus-3b-0.1-ft"; details on the Orpheus page.

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": "af_heart", "input": "The quick brown fox jumps over the lazy dog, and then it stops to enjoy the afternoon sun.", "response_format": "mp3"}' \
  --output english.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="af_heart", input="The quick brown fox jumps over the lazy dog, and then it stops to enjoy the afternoon sun.")
audio.write_to_file("english.mp3")

Notes for English

  • American (af_, am_) and British (bf_, bm_) voices. English is Kokoro's strongest language; most of its training audio was English.
  • OpenAI voice names such as alloy and nova are accepted and mapped to the Kokoro voice of the same name, so OpenAI speech code runs unchanged.
  • 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 90-character sample above is 5.7 seconds of audio and costs $0.00047; at that rate an hour of English speech is about 57,000 characters, or roughly $0.30. 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 costs $19.50 per million characters and took about a minute for 300 characters, so render it ahead of time.

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

Speech-to-text in English

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