Text to Speech

API Overview

To simplify the integration of different text-to-speech-creation models (tts), OneRouter provides a unified image API.

API Specification

Generates audio from the input text.

curl https://audio.onerouter.pro/v1/audio/speech \
    -H "Content-Type: application/json" \
    -H "Authorization: <API_KEY>" \
    -d '{
    "model": "gpt-4o-mini-tts",
    "input": "A cute baby sea otter",
    "voice": "alloy"
  }' \
  --output speech.mp3
  • <API_KEY> is your API Key generated in API page.

  • model is the model name, such as gpt-4o-mini-tts, available model list can be access in Model page.

  • The voice to use when generating the audio. Supported voices are alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, and verse.

Example response

The audio file content.

27KB
Open

Last updated