官方文档:https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn#gemini-image-editing
POST
/v1beta/models/gemini-2.5-flash-preview-tts:generateContentTTS 文本转语音
API Key application/json
请求示例
curl -X POST https://top.qingyuntop.ai/v1beta/models/gemini-2.5-flash-preview-tts:generateContent \
-H "Authorization: Bearer ${QINGYUN_TOP_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"parts": [
{
"text": "说出,我是谁,谁是我"
}
]
}
],
"generationConfig": {
"responseModalities": [
"AUDIO"
],
"speechConfig": {
"voiceConfig": {
"prebuiltVoiceConfig": {
"voiceName": "Kore"
}
}
}
},
"model": "gemini-2.5-flash-preview-tts"
}'请求参数
| 参数 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
key | Query | string | 是 | - | {{YOUR_API_KEY}} |
Content-Type | Header | string | 是 | - | application/json |
contents | JSON body | array<object> | 是 | - | - |
contents[].parts | JSON body | array<object> | 否 | - | - |
contents[].parts[].text | JSON body | string | 否 | - | - |
contents[].parts[].inline_data | JSON body | object | 否 | - | - |
contents[].parts[].inline_data.mime_type | JSON body | string | 是 | - | - |
contents[].parts[].inline_data.data | JSON body | string | 是 | - | - |
generationConfig | JSON body | object | 是 | - | - |
generationConfig.responseModalities | JSON body | array<string> | 是 | - | - |
generationConfig.imageConfig | JSON body | object | 是 | - | - |
generationConfig.imageConfig.aspectRatio | JSON body | string | 是 | - | - |
返回响应 (200)
此部分没有定义参数。
来源原始接口定义(用于追溯)
以下内容来自 Apifox 快照,可能包含兼容层字段或旧示例;公开调用请以本页的协议说明和当前模型列表为准。
{
"id": 497673463,
"name": "TTS 文本转语音",
"type": "http",
"serverId": "",
"preProcessors": [],
"postProcessors": [],
"inheritPreProcessors": {},
"inheritPostProcessors": {},
"description": "官方文档:https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn#gemini-image-editing",
"operationId": "",
"sourceUrl": "",
"method": "post",
"path": "/v1beta/models/gemini-2.5-flash-preview-tts:generateContent",
"tags": [],
"status": 1,
"requestBody": {
"type": "application/json",
"parameters": [],
"jsonSchema": {
"type": "object",
"properties": {
"contents": {
"type": "array",
"items": {
"type": "object",
"properties": {
"parts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string"
},
"inline_data": {
"type": "object",
"properties": {
"mime_type": {
"type": "string"
},
"data": {
"type": "string"
}
},
"required": [
"mime_type",
"data"
],
"x-apifox-orders": [
"mime_type",
"data"
]
}
},
"x-apifox-orders": [
"text",
"inline_data"
]
}
}
},
"x-apifox-orders": [
"parts"
]
}
},
"generationConfig": {
"type": "object",
"properties": {
"responseModalities": {
"type": "array",
"items": {
"type": "string"
}
},
"imageConfig": {
"type": "object",
"properties": {
"aspectRatio": {
"type": "string",
"x-apifox-mock": "16:9"
}
},
"x-apifox-orders": [
"aspectRatio"
],
"required": [
"aspectRatio"
]
}
},
"required": [
"responseModalities",
"imageConfig"
],
"x-apifox-orders": [
"responseModalities",
"imageConfig"
]
}
},
"required": [
"contents",
"generationConfig"
],
"x-apifox-orders": [
"contents",
"generationConfig"
]
},
"examples": [
{
"mediaType": "application/json",
"value": "{\n \"contents\": [\n {\n \"parts\": [\n {\n \"text\": \"说出,我是谁,谁是我\"\n }\n ]\n }\n ],\n \"generationConfig\": {\n \"responseModalities\": [\n \"AUDIO\"\n ],\n \"speechConfig\": {\n \"voiceConfig\": {\n \"prebuiltVoiceConfig\": {\n \"voiceName\": \"Kore\"\n }\n }\n }\n },\n \"model\": \"gemini-2.5-flash-preview-tts\"\n}",
"name": "示例"
}
],
"mediaType": "",
"oasExtensions": "",
"required": false,
"additionalContentTypes": []
},
"parameters": {
"path": [],
"query": [
{
"id": "fNkAG1L7Ct",
"name": "key",
"required": true,
"enable": true,
"description": "",
"type": "string",
"sampleValue": "{{YOUR_API_KEY}}"
}
],
"cookie": [],
"header": [
{
"id": "DxzZ9GHHTb",
"name": "Content-Type",
"required": true,
"enable": true,
"description": "",
"type": "string",
"sampleValue": "application/json"
}
]
},
"commonParameters": {
"query": [],
"body": [],
"cookie": [],
"header": []
},
"auth": {},
"responses": [
{
"id": 190465298,
"name": "成功",
"code": 200,
"contentType": "json",
"jsonSchema": {
"type": "object",
"properties": {},
"x-apifox-orders": []
},
"itemSchema": {},
"description": "",
"mediaType": "",
"headers": [],
"oasExtensions": ""
}
],
"responseExamples": [],
"codeSamples": [],
"projectId": 8662722,
"moduleId": 8310462,
"folderId": 92749360,
"ordering": 114,
"responsibleId": 0,
"commonResponseStatus": {},
"advancedSettings": {
"disabledSystemHeaders": {}
},
"customApiFields": {},
"oasExtensions": "",
"mockScript": {},
"createdAt": "2026-08-05T14:40:23.000Z",
"updatedAt": "2026-08-06T12:15:55.000Z",
"creatorId": 2863449,
"editorId": 2863449,
"creatorUserId": 2863449,
"editorUserId": 2863449,
"responseChildren": [],
"visibility": "INHERITED",
"securityScheme": {},
"callbacks": ""
}