Docs

Model APIs

Audio transcription, translation and speech

Use audio/transcriptions, audio/translations and audio/speech with multipart uploads and binary output.

Updated

POST/v1/audio/transcriptions
POST/v1/audio/translations
POST/v1/audio/speech

Transcribe and translate

POST /v1/audio/transcriptions converts audio to text; POST /v1/audio/translations requests audio translation. Both require a model supporting the task and audio.create permission. A typical request is multipart/form-data with model and a nonempty file. Let the HTTP client create the boundary rather than setting Content-Type manually.

Optional parameterMeaning
languageTranscription language hint, e.g. en; not a universal target-language selector
promptText hint for terminology and names
response_formatjson / text / verbose_json / srt / vtt
temperature0–1
cURL
curl --fail-with-body https://api.token4ai.cloud/v1/audio/transcriptions \
  -H "Authorization: Bearer $TOKEN4AI_API_KEY" \
  -F "model=$TOKEN4AI_MODEL" \
  -F "file=@./recording.mp3" \
  -F "response_format=json"
Response formats, file codecs and translation target language still depend on the model. translations is not a universal arbitrary-language translation API.

Generate speech

POST /v1/audio/speech accepts JSON containing model, input and voice. Success generally returns audio bytes rather than JSON. Check HTTP status and Content-Type before saving the output. voice and response_format must be supported by the selected model.

cURL
curl --fail-with-body https://api.token4ai.cloud/v1/audio/speech \
  -H "Authorization: Bearer $TOKEN4AI_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"model":"YOUR_MODEL_ID","input":"Welcome to Token4AI Cloud.","voice":"YOUR_VOICE_ID","response_format":"mp3"}' \
  --output speech.mp3

Large files and errors

Validate with a short recording before scaling file size. Split long recordings when appropriate and retain time offsets for merging transcripts. A 413 indicates an oversized payload. Correct model or capability errors instead of retrying; re-uploading after a disconnect can cause additional processing and usage.

Related guides