Text-to-Speech 提供 global、us、eu 多區域和區域 API 端點。如果使用區域端點,靜態和使用中的資料會分別保留在歐洲或美國的區域或大陸疆界內。如果為了遵守當地法規要求,必須控管資料位置,請務必指定端點。API 行為沒有任何功能性變更。
全域
| 模型名稱 | 全域 |
|---|---|
Gemini 2.5 Flash TTS (gemini-2.5-flash-tts) |
|
Gemini 2.5 Flash TTS (gemini-2.5-pro-tts) |
|
| Chirp 3:HD 語音 | |
| Chirp 3:即時 Custom Voice |
美國
| 模型名稱 | 美國 (多區域) |
|---|---|
Gemini 2.5 Flash TTS (gemini-2.5-flash-tts) |
|
Gemini 2.5 Flash TTS (gemini-2.5-pro-tts) |
|
| Chirp 3:HD 語音 | |
| Chirp 3:即時 Custom Voice |
歐洲
| 歐洲 (多區域) | 英國倫敦 (europe-west2) | 德國法蘭克福 (europe-west3) | 荷蘭埃姆斯港 (europe-west4) | |
|---|---|---|---|---|
Gemini 2.5 Flash TTS (gemini-2.5-flash-tts) |
||||
Gemini 2.5 Flash TTS (gemini-2.5-pro-tts) |
||||
| Chirp 3:HD 語音 | ||||
| Chirp 3:即時 Custom Voice |
亞太地區
| 日本東京 (asia-northeast1) | 澳洲雪梨 (australia-southeast1) | 印度孟買 (asia-south1) | 新加坡 (asia-southeast1) | 韓國首爾 (asia-northeast3) | |
|---|---|---|---|---|---|
Gemini 2.5 Flash TTS (gemini-2.5-flash-tts) |
|||||
Gemini 2.5 Flash TTS (gemini-2.5-pro-tts) |
|||||
| Chirp 3:HD 語音 | |||||
| Chirp 3:即時 Custom Voice |
使用區域端點
使用區域端點時,請務必在 parent 字串中加入相符的 us 或 eu 位置。如要進一步瞭解如何設定合成要求主體,請參閱 Synthesize 說明文件。
通訊協定
如要使用區域端點執行文字轉語音合成,請在下表中執行適用指令以設定正確的端點:
| 多區域 | 端點覆寫 |
|---|---|
| 歐洲 | $ export CLOUD_TTS_ENDPOINT=https://eu-texttospeech.googleapis.com |
| 美國 | $ export CLOUD_TTS_ENDPOINT=https://us-texttospeech.googleapis.com |
下列端點僅提供 Neural2 語音:
| 單一區域 | 端點覆寫 |
|---|---|
| 美國 Central1 | $ export CLOUD_TTS_ENDPOINT=https://us-central1-texttospeech.googleapis.com |
下列程式碼範例說明如何傳送 synthesis request,確保將所有資料限制在特定區域。您可以將 EU 或 US 區域端點替換為 CLOUD_TTS_ENDPOINT 變數,並將 PROJECT_ID 替換為專案 ID。
$ curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "x-goog-user-project: PROJECT_ID" \ -H "Content-Type: application/json; charset=utf-8" \ --data "{ 'input':{ 'text':'Android is a mobile operating system developed by Google, based on the Linux kernel and designed primarily for touchscreen mobile devices such as smartphones and tablets.' }, 'voice':{ 'languageCode':'en-gb', 'name':'en-GB-Neural2-A', 'ssmlGender':'FEMALE' }, 'audioConfig':{ 'audioEncoding':'MP3' } }" $CLOUD_TTS_ENDPOINT/v1/text:synthesize > synthesize-text.txt
這個範例使用 Google Cloud CLI 為 Google 帳戶建立存取權杖。如需 gcloud CLI 的安裝操作說明,請參閱「向 Text-to-Speech 進行驗證」一文。
限制全域 API 端點用量
如要強制使用區域端點,請使用 constraints/gcp.restrictEndpointUsage 組織政策限制,封鎖對全域 API 端點的要求。詳情請參閱「限制端點用量」。