OpenAI Audio API Integration Guide & Examples

MethodPathUse
POST/v1/audio/speechText to speech
POST/v1/audio/transcriptionsSpeech to text
POST/v1/audio/translationsAudio translation

Whether a model offers an endpoint follows the protocols shown in the model marketplace; otherwise the gateway answers 400 model_protocol_not_offered.

Speech

The request is JSON (OpenAI {model, input, voice}) and the response body is binary audio.

bash
curl https://api.modelgo.ai/v1/audio/speech \
  -H "Authorization: Bearer $MODELGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"<openai-speech-model>","input":"Hello from ModelGo.","voice":"alloy"}' \
  --output speech.mp3

MiniMax speech models

speech-2.8-hd / speech-2.8-turbo can also be called on this endpoint the same way. Note:

  • voice takes a MiniMax voice ID (e.g. female-shaonv), not an OpenAI name such as alloy;
  • response_format supports mp3 (default) / pcm / flac / wav; opus / aac return 400 and are not billed;
  • speed maps to MiniMax's speech-rate setting.

For MiniMax-native fields (voice mix, subtitles, hex JSON, SSE), see MiniMax Audio Inbound Protocol.

Transcriptions

Upload the audio file and model as multipart/form-data; the response is JSON with the recognized text.

bash
curl https://api.modelgo.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer $MODELGO_API_KEY" \
  -F "model=<model>" \
  -F "file=@./speech.m4a"

Translations

Uploads follow the same shape as transcriptions and return translated text in JSON.

bash
curl https://api.modelgo.ai/v1/audio/translations \
  -H "Authorization: Bearer $MODELGO_API_KEY" \
  -F "model=<model>" \
  -F "file=@./speech.m4a"

For transcriptions and translations the whole request body, audio file included, is capped at 10 MiB; a larger one returns 400, so compress or split longer audio first.