Create podcasts from topics, URLs, or text. Triggers on: "做播客", "podcast", "播客", "录一期节目", "chat about", "discuss", "debate", "dialogue", "make a podcast about".
/speech)/explainer)/image-gen)/content-parser)Generate podcast episodes with 1-2 AI speakers discussing a topic. Supports quick overviews, deep analysis, and debate formats. Input can be a topic description, URL(s), or text. Output is a full audio episode with transcript.
shared/authentication.md for API key and headersshared/common-patterns.md for polling, errors, and interaction patternsshared/config-pattern.md before any interactionshared/speaker-selection.md for speaker selection (text table + free-text input)~/Downloads/ — use .listenhub/podcast/ from configFollow shared/config-pattern.md § API Key Check. If the key is missing, stop immediately.
Follow shared/config-pattern.md Step 0.
If file doesn't exist — ask location, then create immediately:
mkdir -p ".listenhub/podcast"
echo '{"outputDir":".listenhub","outputMode":"inline","language":null,"defaultMode":null,"defaultMethod":null,"defaultSpeakers":{}}' > ".listenhub/podcast/config.json"
CONFIG_PATH=".listenhub/podcast/config.json"
# (or $HOME/.listenhub/podcast/config.json for global)
Then run Setup Flow below.
If file exists — read config, display summary, and confirm:
当前配置 (podcast):
输出方式:{inline / download / both}
语言偏好:{zh / en / 未设置}
默认模式:{quick / deep / debate / 未设置}
默认生成方式:{one-step / two-step / 未设置}
默认主播:{speakerName(s) / 未设置}
Ask: "使用已保存的配置?" → 确认,直接继续 / 重新配置
Ask these questions in order, then save all answers to config at once:
outputMode: Follow shared/output-mode.md § Setup Flow Question.
Language (optional): "默认语言?"
nullMode (optional): "默认播客模式?"
nullMethod (optional): "默认生成方式?"
defaultMethod: "one-step"defaultMethod: "two-step"nullAfter collecting answers, save immediately:
# Follow shared/output-mode.md § Save to Config
NEW_CONFIG=$(echo "$CONFIG" | jq --arg m "$OUTPUT_MODE" '. + {"outputMode": $m}')
echo "$NEW_CONFIG" > "$CONFIG_PATH"
CONFIG=$(cat "$CONFIG_PATH")
Note: defaultSpeakers are saved after generation (see After Successful Generation section).
Free text input. Ask the user:
What topic or content would you like to turn into a podcast?
Accept: topic description, URL, or pasted text.
If config.defaultMode is set, pre-fill and show in summary — skip this question.
Otherwise ask:
Question: "What podcast generation mode?"
Options:
- "Quick" — Short, concise overview (~5 min)
- "Deep" — Thorough analysis with more detail (~10-15 min)
- "Debate" — Two speakers with opposing views (requires 2 speakers)
If config.language is set, pre-fill and show in summary — skip this question.
Otherwise ask:
Question: "What language?"
Options:
- "Chinese (zh)" — Content in Mandarin Chinese
- "English (en)" — Content in English
Question: "How many speakers?"
Options:
- "1 speaker (solo)" — Monologue style
- "2 speakers (dialogue)" — Conversation style
Note: Debate mode automatically sets 2 speakers.
Follow shared/speaker-selection.md for the full selection flow, including:
config.defaultSpeakers.{language} (skip step if set)For 2-speaker mode (dialogue/debate): run selection twice (or until both are chosen).
Question: "Any reference materials to include?"
Options:
- "Yes, URL(s)" — Provide URLs to analyze
- "Yes, text" — Paste reference text
- "No references" — Generate from topic alone
If config.defaultMethod is set, pre-fill and show in summary — skip this question.
Otherwise ask:
Question: "How would you like to generate?"
Options:
- "One step (recommended)" — Generate text + audio together, faster
- "Two steps (review first)" — Generate text, review/edit, then generate audio
Summarize all choices:
Ready to generate podcast:
Topic: {topic}
Mode: {mode}
Language: {language}
Speakers: {speaker name(s)}
References: {yes/no}
Method: {one-step/two-step}
Proceed?
Wait for explicit confirmation before calling any API.
Submit (foreground): POST /podcast/episodes with collected parameters → extract episodeId
Tell the user the task is submitted
Poll (background): Run the following exact bash command with run_in_background: true and timeout: 600000. Do NOT use python3, awk, or any other JSON parser — use jq as shown:
EPISODE_ID="<id-from-step-1>"
for i in $(seq 1 30); do
RESULT=$(curl -sS "https://api.marswave.ai/openapi/v1/podcast/episodes/$EPISODE_ID" \
-H "Authorization: Bearer $LISTENHUB_API_KEY" 2>/dev/null)
STATUS=$(echo "$RESULT" | tr -d '\000-\037\177' | jq -r '.data.processStatus // "pending"')
case "$STATUS" in
success|completed) echo "$RESULT"; exit 0 ;;
failed|error) echo "FAILED: $RESULT" >&2; exit 1 ;;
*) sleep 10 ;;
esac
done
echo "TIMEOUT" >&2; exit 2
When notified of completion, Step 6: Present result
Read OUTPUT_MODE from config. Follow shared/output-mode.md for behavior.
inline or both: Display audioUrl as a clickable link.
Present:
播客已生成!
在线收听:{audioUrl}
字幕:{subtitlesUrl}(如有)
时长:{audioDuration / 1000}s
消耗积分:{credits}
download or both: Also download the file.
DATE=$(date +%Y-%m-%d)
JOB_DIR=".listenhub/podcast/${DATE}-{episodeId}"
mkdir -p "$JOB_DIR"
curl -sS -o "${JOB_DIR}/{episodeId}.mp3" "{audioUrl}"
Present the download path in addition to the above summary.
Offer to show transcript or provide download URL on request
POST /podcast/episodes/text-content → extract episodeIdjq-based polling loop above (substitute endpoint podcast/episodes/text-content/{episodeId} if needed), with run_in_background: true and timeout: 600000.listenhub/podcast/YYYY-MM-DD-{episodeId}/{episodeId}-draft.md (human-readable: **{speakerName}**: {content} per line){episodeId}-draft.json (raw scripts array)POST /podcast/episodes/{episodeId}/audio with {}POST /podcast/episodes/{episodeId}/audio with modified {scripts: [...]}jq-based loop, run_in_background: true, timeout: 600000curl -sS -o .listenhub/podcast/{dir}/{episodeId}.mp3 {audioUrl}Update config with the choices made this session:
NEW_CONFIG=$(echo "$CONFIG" | jq \
--arg lang "{language}" \
--arg mode "{mode}" \
--arg method "{one-step/two-step}" \
--argjson speakers '{"{language}": ["{speakerId}"]}' \
'. + {"language": $lang, "defaultMode": $mode, "defaultMethod": $method, "defaultSpeakers": (.defaultSpeakers + $speakers)}')
echo "$NEW_CONFIG" > "$CONFIG_PATH"
shared/api-speakers.mdshared/speaker-selection.mdshared/api-podcast.mdshared/common-patterns.md § Async Pollingshared/config-pattern.mdUser: "Make a podcast about the latest AI developments"
Agent workflow:
curl -sS -X POST "https://api.marswave.ai/openapi/v1/podcast/episodes" \
-H "Authorization: Bearer $LISTENHUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sources": [{"type": "text", "content": "The latest AI developments"}],
"speakers": [{"speakerId": "cozy-man-english"}],
"language": "en",
"mode": "deep"
}'
Poll until complete, then present the result with title and listen link.