Google 會運用 AI 技術將內容翻譯成你偏好的語言,但可能會出錯。
生成 Podcast (API 方法)
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Gemini Enterprise 提供 API,可根據來源文件生成 Podcast。輸出內容與使用者在筆記本中生成的 Podcast 非常相似。
透過 API 生成 Podcast 非常適合批次工作,例如您可能有數十或數百本書籍、文章或課程,並想為每本書籍、文章或課程生成 Podcast。
Podcast API 是獨立 API。也就是說,您不需要 Gemini Notebook Enterprise 筆記本、Gemini Enterprise 授權或資料儲存庫。只要啟用 Google Cloud 專案並具備 Podcast API 使用者角色,即可開始使用。
API 的輸入內容是 context 元素陣列。這是生成 Podcast 的來源資料。輸入內容可以是文字、圖片、音訊和影片。內容陣列的總內容必須少於 100,000 個權杖。
如需支援的類型清單,請參閱 Gemini 2.5 Flash 頁面上的圖片、文件、影片和音訊技術規格。
輸出內容
API 的輸出內容是 MP3 格式的 Podcast。
事前準備
您必須具備下列條件,才能使用 API 生成 Podcast:
根據輸入的內容生成 Podcast
使用下列指令呼叫 podcast 方法,生成 Podcast。
輸入內容是多媒體物件陣列,例如文字、圖片、音訊和短片。
REST
如要生成及匯出 Podcast,請按照下列步驟操作:
執行下列 curl 指令:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1/projects/PROJECT_ID/locations/global/podcasts" \
-d '{
"podcastConfig": {
"focus": "FOCUS",
"length": "LENGTH",
"languageCode": "LANGUAGE_CODE"
},
"contexts": [
{
"text": "TEXT_CONTENT"
},
{
"inlineData": {
"mimeType": "MIME_TYPE",
"data": "BASE64_ENCODED_DATA"
}
}
],
"title": "PODCAST_TITLE",
"description": "PODCAST_DESCRIPTION"
}'
更改下列內容:
PROJECT_ID:專案 ID。
FOCUS:提示詞,建議 Podcast 的重點。
LENGTH:有兩個選項:
SHORT (通常需要 4 到 5 分鐘)
STANDARD (通常約 10 分鐘,但如果資料集較小,時間可能會更短)
LANGUAGE_CODE:選用。請指定 Podcast 的語言代碼。請使用 BCP47 定義的語言標記。如未提供語言代碼,系統會以英文生成 Podcast。
TEXT_CONTENT:要加入的文字內容。
inlineData:非文字媒體的物件。
MIME_TYPE:blob 資料的 MIME 類型 (例如「image/png」)。
BASE64_ENCODED_DATA:媒體資料的 Base64 編碼原始位元組。
PODCAST_TITLE:Podcast 的標題。這項資訊可供內部使用,您也可以選擇向使用者顯示。
PODCAST_DESCRIPTION:Podcast 的說明。這項資訊可供內部使用,您也可以選擇向使用者顯示。
指令與結果範例
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
"https://discoveryengine.googleapis.com/v1/projects/my-project-123/locations/global/podcasts" \
-d '{
"podcastConfig": {
"focus": "Can you talk about how to find a job in Google?",
"length": "SHORT"
},
"contexts": [
{
"text": "Breaking into Google is a highly competitive endeavor, attracting millions of applicants globally due to its reputation as a top employer, its innovative work, and comprehensive perks. Success hinges on a multi-faceted approach, starting with meticulously tailored online applications that incorporate job description keywords for ATS and showcasing Googlyness—a blend of curiosity, collaborative spirit, and leadership potential. The rigorous, multi-stage interview process involves recruiter screens, behavioral interviews (often using the STAR method), and for technical roles, demanding coding challenges and system design questions that assess not just correct answers but also problem-solving thought processes and communication skills. Networking for referrals and informational interviews can significantly boost visibility, but ultimately, thorough preparation through mock interviews and platforms like LeetCode, combined with patience and resilience through the often lengthy process, are paramount for navigating this challenging but rewarding path."
},
{
"inlineData": {
"mimeType": "image/png",
"data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="
}
}
],
"title": "Find a job at Google ",
"description": "This podcast is based on a plain text document and an image that describe various aspects of getting a job at Google."
}'
{
"name": "projects/123456/locations/global/operations/create-podcast-54321"
}
生成 Podcast 需要幾分鐘。
請記下作業名稱,在步驟 4 下載 Podcast 時會用到。在上述範例中,作業名稱為 projects/123456/locations/global/operations/create-podcast-54321。
選用。輪詢 Podcast 建立作業的狀態。請參閱「取得長時間執行作業的詳細資料」。
作業完成後,請執行下列 curl 指令下載 Podcast:
curl -v \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://discoveryengine.googleapis.com/v1/OPERATION_NAME:download?alt=media" \
--output FILENAME.mp3 -L
更改下列內容:
OPERATION_NAME:您在步驟 2 記下的作業名稱。
FILENAME:Podcast 的檔案名稱。
這個指令會將 Podcast 下載為本機目錄中的 MP3 檔案。
指令與結果範例
curl -v \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://discoveryengine.googleapis.com/v1/projects/123456/locations/global/operations/create-podcast-54321:download?alt=media" \
--output my-podcast.mp3 -L
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Host discoveryengine.googleapis.com:443 was resolved.
...
{ [42044 bytes data]
100 14.3M 100 14.3M 0 0 10.9M 0 0:00:01 0:00:01 --:--:-- 29.7M
* Connection #0 to host discoveryengine.googleapis.com left intact
法規遵循
Podcast API 不符合 Gemini Enterprise 的 CMEK 規定。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2026-10-29 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2026-10-29 (世界標準時間)。"],[],[]]