Skip to main content

Audio & Speech

This page covers speech generation, transcription, and audio translation endpoints.

Apifox Coverage Notes

  • Native OpenAI-style endpoints: TTS, whisper-1, gpt-4o-transcribe, audio translation, audio output, audio input
  • Vendor extensions: MiniMax speech synthesis and Doubao voice 2.0
  • Native Gemini audio generation and speech flows

Model APIs / Audio

POST Native Gemini Format

POST /v1beta/models/{model}:generateContent

Gemini audio-generation endpoint. You can use models such as gemini-2.5-flash-preview-tts.

Body Parameters

{
"contents": [
{
"parts": [
{
"text": "Say cheerfully: Have a wonderful day!"
}
]
}
],
"generationConfig": {
"responseModalities": [
"AUDIO"
],
"speechConfig": {
"voiceConfig": {
"prebuiltVoiceConfig": {
"voiceName": "Kore"
}
}
}
}
}

Request Parameters

NameInTypeRequiredDescription
modelpathstringYesModel Name
keyquerystringYesnone
Content-TypeheaderstringYesnone
bodybodyobjectNonone
» contentsbody[object]Yesnone
»» partsbody[object]Nonone
»»» textbodystringNonone

Response Example

200 Response

{
"id": "string",
"object": "string",
"created": 0,
"choices": [
{
"index": 0,
"message": {
"role": "string",
"content": "string"
},
"finish_reason": "string"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
}
}

Responses

StatusMeaningDescriptionModel
200OKnoneInline

Response Schema

Status 200

NameTypeRequiredConstraintsChinese NameDescription
» idstringtruenonenone
» objectstringtruenonenone
» createdintegertruenonenone
» choices[object]truenonenone
»» indexintegerfalsenonenone
»» messageobjectfalsenonenone
»»» rolestringtruenonenone
»»» contentstringtruenonenone
»» finish_reasonstringfalsenonenone
» usageobjecttruenonenone
»» prompt_tokensintegertruenonenone
»» completion_tokensintegertruenonenone
»» total_tokensintegertruenonenone

Model APIs / Audio / Native OpenAI Format

POST Doubao Speech 2.0

POST /audio/speech

Different voices support different emotional ranges. For the full list of voice emotions, see: https://www.volcengine.com/docs/6561/1257544 Examples include happy, sad, angry, surprised, and fear... Any parameters outside the OpenAI standard should be passed in metadata using the original vendor format; all vendor-specific fields are supported. Voice-emotion example: adjust the emotion parameter.

Body Parameters

{
"input": "你是一个好孩子",
"model": "seed-tts-1.1",
"response_format": "mp3",
"speed": 1,
"voice": "zh_female_shuangkuaisisi_emo_v2_mars_bigtts",
"metadata": {
"audio": {
"emotion_scale": 5,
"enable_emotion": true,
"emotion": "happy"
}
}
}

Request Parameters

NameInTypeRequiredDescription
Content-TypeheaderstringYesnone
AuthorizationheaderstringYesnone
bodybodyobjectNonone
» modelbodystringYesOne of the available TTS models: tts-1 or tts-1-hd.
» inputbodystringYesText to synthesize into audio. Maximum length: 4096 characters.
» voicebodystringYesVoice used to generate the audio. Supported voices: alloy, echo, fable, onyx, nova, and shimmer.
» response_formatbodystringNoAudio format to return. Defaults to mp3. Supported formats: mp3, opus, aac, and flac.
» speedbodynumberNoPlayback speed for generated audio. Choose a value between 0.25 and 4.0. The default is 1.0.

Response Example

200 Response

{}

Responses

StatusMeaningDescriptionModel
200OKnoneInline

Response Schema

POST Speech to Text / gpt-4o-transcribe

POST /audio/transcriptions

Official documentation:https://platform.openai.com/docs/api-reference/audio/createTranscription

Body Parameters

file: file:///Users/jun/Downloads/response.wav
model: gpt-4o-transcribe
prompt: eiusmod nulla
response_format: json
temperature: 0
language: ""

Request Parameters

NameInTypeRequiredDescription
Content-TypeheaderstringYesnone
AcceptheaderstringYesnone
AuthorizationheaderstringNonone
bodybodyobjectNonone
» filebodystring(binary)YesAudio file to transcribe. Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.
» modelbodystringYesID of the model to use. Currently only whisper-1 is available.
» promptbodystringNoOptional text used to guide the model style or continue a previous audio segment. The prompt should match the language of the audio.
» response_formatbodystringNonone
» temperaturebodynumberNoSampling temperature between 0 and 1. Higher values such as 0.8 make output more random, while lower values such as 0.2 make it more focused and deterministic. If set to 0, the model automatically raises the temperature using log probabilities until a threshold is reached.
» languagebodystringNoLanguage of the input audio. Providing the language in ISO-639-1 format improves both accuracy and latency.

Response Example

200 Response

{
"text": "string"
}

Responses

StatusMeaningDescriptionModel
200OKnoneInline

Response Schema

Status 200

NameTypeRequiredConstraintsChinese NameDescription
» textstringtruenonenone

POST Audio Translation

POST /audio/translations

Translates audio into English.

Body Parameters

file: string
model: whisper-1
prompt: ""
response_format: verbose_json
temperature: 0

Request Parameters

NameInTypeRequiredDescription
Content-TypeheaderstringYesnone
AcceptheaderstringYesnone
AuthorizationheaderstringNonone
bodybodyobjectNonone
» filebodystring(binary)YesAudio file to translate. Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm.
» modelbodystringYesID of the model to use. Currently only whisper-1 is available.
» promptbodystringNoOptional text used to guide the model style or continue a previous audio segment. The prompt must be in English.
» response_formatbodystringNoOutput format for the transcription. Supported values: json, text, srt, verbose_json, or vtt.
» temperaturebodynumberNoSampling temperature between 0 and 1. Higher values such as 0.8 make output more random, while lower values such as 0.2 make it more focused and deterministic. If set to 0, the model automatically raises the temperature using log probabilities until a threshold is reached.

Response Example

200 Response

{
"text": "string"
}

Responses

StatusMeaningDescriptionModel
200OKnoneInline

Response Schema

Status 200

NameTypeRequiredConstraintsChinese NameDescription
» textstringtruenonenone