Guides
Voice
The audio endpoints use OpenAI's request shapes, so existing SDK code keeps working. The one thing they add is a voice list you can filter, because voice IDs differ per vendor.
Try it first
The Playground lists every voice for a model, filters them by gender and language, and plays the result. Copy the voice ID from there into your code.
Generate speech with a chosen voice
Find the model
GET /v1/audio/modelslists the speech models, each with itskind:ttsgenerates speech andstttranscribes it.curl https://api.oneapi.id/v1/audio/models \ -H "Authorization: Bearer $ONEAPI_API_KEY"List its voices
Pass the model, plus any of
genderandlanguage. This asks for female voices that speak Indonesian:curl "https://api.oneapi.id/v1/audio/voices?model=eleven_v4_turbo&gender=female&language=id" \ -H "Authorization: Bearer $ONEAPI_API_KEY"{ "object": "list", "total": 2, "next_cursor": "", "data": [ { "id": "VOICE_ID", "name": "Voice name", "gender": "female", "accent": "standard", "languages": ["id"], "styles": [] } ] }Generate the audio
Send the voice's
idasvoice. The answer is the audio itself, so write it to a file.curl https://api.oneapi.id/v1/audio/speech \ -H "Authorization: Bearer $ONEAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "eleven_v4_turbo", "input": "Halo, pesanan Anda sudah dikirim.", "voice": "VOICE_ID", "language": "id" }' \ --output speech.wav
Multilingual voices
A voice with an empty languages list is multilingual and speaks whatever language you ask for. Filtering by language on an ElevenLabs model lists voices recorded for that language first, then these.
With the OpenAI SDK
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.oneapi.id/v1", api_key=os.environ["ONEAPI_API_KEY"])
speech = client.audio.speech.create(
model="eleven_v4_turbo",
voice="VOICE_ID",
input="Halo, pesanan Anda sudah dikirim.",
response_format="wav",
extra_body={"language": "id"},
)
speech.write_to_file("speech.wav")Tune an ElevenLabs voice
provider_options carries a vendor's own settings. On eleven_v4_turbo only stability applies. Other ElevenLabs models also take similarity_boost, style, speed and use_speaker_boost.
{
"model": "eleven_v4_turbo",
"input": "Halo.",
"voice": "VOICE_ID",
"provider_options": { "elevenlabs": { "stability": 0.4 } }
}Transcribe audio
Upload a WAV file holding 16-bit mono PCM. Convert any other format first, for example with ffmpeg -i in.mp3 -ac 1 -ar 16000 -c:a pcm_s16le out.wav.
curl https://api.oneapi.id/v1/audio/transcriptions \
-H "Authorization: Bearer $ONEAPI_API_KEY" \
-F model=muse-voice-transcribe-1.0 \
-F language=id \
-F [email protected]Each model accepts its own sample rates, listed as sample_rates in GET /v1/audio/models. A rate it does not take answers 415.
How audio is billed
Audio uses the model's input price, counted in characters or seconds rather than tokens. Request logs show that count in the input tokens column.
| Endpoint | Billed unit | Input price means |
|---|---|---|
/v1/audio/speech | Characters of input | Per million characters |
/v1/audio/transcriptions | Seconds of audio, rounded up | Per million seconds |
Field-by-field details are in /v1/audio/speech, /v1/audio/transcriptions and /v1/audio/voices.