Skip to main content

Recipe: Transcribe audio, then translate

Chain two services: transcribe an audio file with speech-to-text, then translate the text into one or more languages. Both bill through your prx- key and charge only on success.

Prerequisites​

1. Transcribe (speech-to-text)​

curl https://gateway.primexos.com/v1/audio/transcriptions \
-H "Authorization: Bearer prx-YOUR_KEY" \
-F model="YOUR_STT_MODEL" \
-F file="@meeting.mp3"

The response contains the transcript text. STT is billed per audio minute. See Audio.

2. Translate the transcript​

curl https://gateway.primexos.com/v1/translate \
-H "Authorization: Bearer prx-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_TRANSLATION_MODEL",
"text": "PASTE_TRANSCRIPT_HERE",
"to": ["es", "fr"]
}'

to accepts one language or several at once; omit from to auto-detect the source. Translation is billed per 1M characters. See Translation and Language and Safety.

Notes​

  • To avoid publishing the audio, upload it once through the Files API and pass the file_id instead of the raw file.
  • Each stage is a separate, independently metered request; a failure in either costs $0. See Billing & Credits.