RuntokenDocs

Audio

Revision 1 · Updated 2026-11-12 · 1 min read

Generate speech or transcribe audio through Runtoken.

Choose an operation#

Speech generation accepts JSON; transcription accepts a multipart file upload. Select a model for the operation you need.

  • Speech: POST /v1/audio/speech.
  • Transcription: POST /v1/audio/transcriptions.

Both use your platform key in the Authorization header on https://api.runtoken.net.

Generate speech#

This example saves the MP3 response to a local file.

Save generated speechbash
curl 'https://api.runtoken.net/v1/audio/speech' \
  -H 'Authorization: Bearer YOUR_PLATFORM_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "YOUR_MODEL_ID",
    "input": "Hello!",
    "voice": "alloy",
    "response_format": "mp3"
  }' --output YOUR_OUTPUT_AUDIO.mp3

Replace these placeholders before running the example.

PlaceholderReplace with
YOUR_PLATFORM_KEYYour platform API key from the console.
YOUR_MODEL_IDA speech model ID.
YOUR_OUTPUT_AUDIO.mp3Local path for the generated audio.

Set the voice and output format with these parameters.

ParameterExample valueDescription
voicealloyVoice name; confirm support for the selected model.
response_formatmp3Output audio format; confirm support for the selected model.

Inspect the HTTP status and content type before treating a downloaded response as playable audio.

Transcribe audio#

Submit a local audio file using a multipart request.

Transcribe a local filebash
curl 'https://api.runtoken.net/v1/audio/transcriptions' \
  -H 'Authorization: Bearer YOUR_PLATFORM_KEY' \
  -F 'model=YOUR_MODEL_ID' \
  -F 'file=@YOUR_INPUT_AUDIO.wav' \
  -F 'response_format=verbose_json'

Replace these placeholders before running the example.

PlaceholderReplace with
YOUR_PLATFORM_KEYYour platform API key from the console.
YOUR_MODEL_IDA transcription model ID.
YOUR_INPUT_AUDIO.wavPath to the local audio file.

The transcription example sets response_format to verbose_json. Use it only if the selected model supports that format.

curl constructs the multipart body for the file upload.

Usage and duration#

Transcription response formats vary by model. Where supported, verbose_json can provide duration; a JSON response may instead carry native token usage.

Media billing uses explicit evidence. Missing usage enters review, and file size is never used to infer audio duration.

Supported formats and limits#

Confirm the accepted voice names, output formats and upload limits before you build a voice selector or accept audio uploads.

Next steps#

For asynchronous generation, see Video Tasks. Common routing and billing behavior is covered in the integration guide.

Was this page helpful?