gemini-2.5-pro-preview-tts。
核心能力
- 文字轉語音 - 將文字轉換為生成音訊
- 音色選擇 - 設定預置音色
- 音訊輸出 - 返回生成的語音資料
快速範例
- cURL
- Python
curl "https://api.mixroute.ai/v1/models/gemini-2.5-pro-preview-tts:generateContent" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"parts": [
{
"text": "Say clearly: Welcome to MixRoute."
}
]
}
],
"generationConfig": {
"responseModalities": [
"AUDIO"
],
"speechConfig": {
"voiceConfig": {
"prebuiltVoiceConfig": {
"voiceName": "Kore"
}
}
}
}
}'
import requests
response = requests.post(
"https://api.mixroute.ai/v1/models/gemini-2.5-pro-preview-tts:generateContent",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={'contents': [{'parts': [{'text': 'Say clearly: Welcome to MixRoute.'}]}],
'generationConfig': {'responseModalities': ['AUDIO'],
'speechConfig': {'voiceConfig': {'prebuiltVoiceConfig': {'voiceName': 'Kore'}}}}},
)
print(response.json())
參數
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
contents | array | 是 | 需要朗讀的文字內容。 |
generationConfig.responseModalities | array | 是 | 設定為 AUDIO。 |
generationConfig.speechConfig | object | 是 | 語音與音色設定。 |