音声とオーディオ
This page covers speech generation, transcription, and audio translation endpoints.
Apifox のカバー範囲
- 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
モデル API / 音声とオーディオ
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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| model | path | string | Yes | Model Name |
| key | query | string | Yes | none |
| Content-Type | header | string | Yes | none |
| body | body | object | No | none |
| » contents | body | [object] | Yes | none |
| »» parts | body | [object] | No | none |
| »»» text | body | string | No | none |
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
| Status | Meaning | Description | Model |
|---|---|---|---|
| 200 | OK | none | Inline |
Response Schema
Status 200
| Name | Type | Required | Constraints | Chinese Name | Description |
|---|---|---|---|---|---|
| » id | string | true | none | none | |
| » object | string | true | none | none | |
| » created | integer | true | none | none | |
| » choices | [object] | true | none | none | |
| »» index | integer | false | none | none | |
| »» message | object | false | none | none | |
| »»» role | string | true | none | none | |
| »»» content | string | true | none | none | |
| »» finish_reason | string | false | none | none | |
| » usage | object | true | none | none | |
| »» prompt_tokens | integer | true | none | none | |
| »» completion_tokens | integer | true | none | none | |
| »» total_tokens | integer | true | none | none |
モデル API / 音声とオーディオ / ネイティブ OpenAI 形式
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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Content-Type | header | string | Yes | none |
| Authorization | header | string | Yes | none |
| body | body | object | No | none |
| » model | body | string | Yes | One of the available TTS models: tts-1 or tts-1-hd. |
| » input | body | string | Yes | Text to synthesize into audio. Maximum length: 4096 characters. |
| » voice | body | string | Yes | Voice used to generate the audio. Supported voices: alloy, echo, fable, onyx, nova, and shimmer. |
| » response_format | body | string | No | Audio format to return. Defaults to mp3. Supported formats: mp3, opus, aac, and flac. |
| » speed | body | number | No | Playback speed for generated audio. Choose a value between 0.25 and 4.0. The default is 1.0. |
Response Example
200 Response
{}
Responses
| Status | Meaning | Description | Model |
|---|---|---|---|
| 200 | OK | none | Inline |
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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Content-Type | header | string | Yes | none |
| Accept | header | string | Yes | none |
| Authorization | header | string | No | none |
| body | body | object | No | none |
| » file | body | string(binary) | Yes | Audio file to transcribe. Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm. |
| » model | body | string | Yes | ID of the model to use. Currently only whisper-1 is available. |
| » prompt | body | string | No | Optional text used to guide the model style or continue a previous audio segment. The prompt should match the language of the audio. |
| » response_format | body | string | No | none |
| » temperature | body | number | No | Sampling 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. |
| » language | body | string | No | Language of the input audio. Providing the language in ISO-639-1 format improves both accuracy and latency. |
Response Example
200 Response
{
"text": "string"
}
Responses
| Status | Meaning | Description | Model |
|---|---|---|---|
| 200 | OK | none | Inline |
Response Schema
Status 200
| Name | Type | Required | Constraints | Chinese Name | Description |
|---|---|---|---|---|---|
| » text | string | true | none | none |
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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| Content-Type | header | string | Yes | none |
| Accept | header | string | Yes | none |
| Authorization | header | string | No | none |
| body | body | object | No | none |
| » file | body | string(binary) | Yes | Audio file to translate. Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm. |
| » model | body | string | Yes | ID of the model to use. Currently only whisper-1 is available. |
| » prompt | body | string | No | Optional text used to guide the model style or continue a previous audio segment. The prompt must be in English. |
| » response_format | body | string | No | Output format for the transcription. Supported values: json, text, srt, verbose_json, or vtt. |
| » temperature | body | number | No | Sampling 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
| Status | Meaning | Description | Model |
|---|---|---|---|
| 200 | OK | none | Inline |
Response Schema
Status 200
| Name | Type | Required | Constraints | Chinese Name | Description |
|---|---|---|---|---|---|
| » text | string | true | none | none |