Skip to content
OneAPIDocs
ModelsOpen console

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

  1. Find the model

    GET /v1/audio/models lists the speech models, each with its kind: tts generates speech and stt transcribes it.

    List speech models
    curl https://api.oneapi.id/v1/audio/models \
      -H "Authorization: Bearer $ONEAPI_API_KEY"
  2. List its voices

    Pass the model, plus any of gender and language. This asks for female voices that speak Indonesian:

    Female Indonesian voices
    curl "https://api.oneapi.id/v1/audio/voices?model=eleven_v4_turbo&gender=female&language=id" \
      -H "Authorization: Bearer $ONEAPI_API_KEY"
    200 OK, shape only
    {
      "object": "list",
      "total": 2,
      "next_cursor": "",
      "data": [
        {
          "id": "VOICE_ID",
          "name": "Voice name",
          "gender": "female",
          "accent": "standard",
          "languages": ["id"],
          "styles": []
        }
      ]
    }
  3. Generate the audio

    Send the voice's id as voice. The answer is the audio itself, so write it to a file.

    Text to speech
    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

Python
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.

Request body
{
  "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.

Speech to text
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.

EndpointBilled unitInput price means
/v1/audio/speechCharacters of inputPer million characters
/v1/audio/transcriptionsSeconds of audio, rounded upPer million seconds

Field-by-field details are in /v1/audio/speech, /v1/audio/transcriptions and /v1/audio/voices.