OP Inference

Speech

Turn text into spoken audio.

POST /v1/audio/speech submits a text to speech job. It answers 202 with a job, not an audio file; see How media jobs work for polling and output.

curl https://api.opinference.com/v1/audio/speech \
  -H "Authorization: Bearer $OP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "hexgrad/kokoro-82m",
    "prompt": "Welcome to OP Inference.",
    "voice": "af_heart"
  }'

The text goes in prompt, not input as in the OpenAI speech API.

Inputs

InputMeaning
promptThe text to speak
voiceA voice name. Each model has its own list
languageThe language, where the model asks for one
speedSpeaking rate, where the model offers it

The model's page at opinference.com/models lists its voices and limits.

Output

One audio file in output[], such as audio/wav. Speech is usually priced per character of prompt, and usage.units.characters counts them.

On this page