Learning resourcesReviewed · OpenRouter

Turn Any Text into a Two-Voice Podcast

This OpenRouter guide teaches developers to turn written material into a two-speaker audio conversation, but it requires API credits and a compatible speech model. It combines structured dialogue generation with one speech request and local WAV creation, using examples in TypeScript, Python, Go and cURL.

Researched 23 Nov 2026

In short.

This OpenRouter tutorial helps developers turn documents into two-speaker audio, but it depends on paid API calls and provider-specific speech support. Its examples generate a structured host-and-guest script, map speakers to voices and save the returned audio as a WAV file. The documented Gemini speech model accepts raw PCM output and at most two distinct voices. The page reports a 49-second demonstration costing $0.0074 for speech synthesis; that figure is an example, not a general price guarantee. Nothing was executed, and audio quality, factual accuracy, latency and current model availability were not assessed.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage includes the complete selected page at [https://openrouter.ai/docs/cookbook/audio/two-voice-podcast.md], including all four language examples, transcript, reported outputs, costs and troubleshooting. Linked documentation, model listings and external terms are excluded. The embedded audio was not independently assessed, and no code or API request was executed. Runtime behavior, current availability, general audio quality and applicable rights remain unverified where the page does not establish them.

The overview

identity

Turn Any Text into a Two-Voice Podcast is an OpenRouter cookbook tutorial at [https://openrouter.ai/docs/cookbook/audio/two-voice-podcast.md]. It explains how to convert a document, changelog or article into a short host-and-guest conversation.

The resource provides three connected implementation steps, with examples in TypeScript, Python, Go and cURL: generate dialogue, synthesize both speakers together and save a playable audio file.

assessment

The guide is a useful starting point for developers adding short audio explanations to existing written content. Its main practical advantage is sending the entire conversation in one speech request, avoiding separate requests and audio assembly for individual lines.

The worked code, format explanations and specific error cases make the approach concrete. Production reliability and listening quality remain unassessed: the supplied examples were not executed, and the demonstration does not establish performance across other documents.

users

The tutorial suits developers building a listen-to-this-post feature or producing short conversational versions of articles, documents and release notes. Readers need enough programming knowledge to configure an API key, send HTTP requests, read JSON and write a local file.

Beginners receive complete request examples and an explanation of the audio format. Experienced developers can reuse the structured dialogue schema, speaker-to-voice mapping and per-turn delivery instructions in a larger application.

capabilities

The script asks a chat model for six to eight alternating host-and-guest turns, each under 40 words, with delivery directions such as curious or laughing. It maps the host to Kore and the guest to Puck, then submits every turn together for speech generation.

Each speech turn carries its own text, voice and instructions. The response contains the combined conversation, which the example saves as podcast.wav. The page also shows how to obtain a generation identifier for cost lookup and describes an optional MP3 conversion.

Using it

requirements

The documented requirements are an OpenRouter API key in OPENROUTER_API_KEY, available API credits and a model whose provider supports multi-speaker input. The requests send source text and the generated dialogue to remote APIs.

The TypeScript route requires Bun or Node.js 24 or newer, according to the guide. The Python example imports requests; the Go example uses standard-library packages; the shell example uses cURL, jq and command-line utilities. Python and Go minimum versions are not specified. MP3 conversion additionally requires ffmpeg.

mechanism

The first request goes to [https://openrouter.ai/api/v1/responses] using google/gemini-3.8-flash. A strict JSON schema describes an object containing turns, with speaker, text and direction fields. The script extracts the returned text and parses it as JSON.

The second request goes to [https://openrouter.ai/api/v1/audio/speech] using google/gemini-3.8-flash-lite-tts. It converts each dialogue turn into text, voice and instructions fields and requests PCM audio. Turn-specific instructions take precedence over the top-level default described by the page.

The documented response format is raw 16-bit PCM at 24 kHz with one channel. The final step prepends a 44-byte WAV header, making the audio playable without changing its underlying samples.

setup

For the TypeScript path, the guide instructs readers to configure OPENROUTER_API_KEY, place the three steps in order in podcast.ts and launch it with bun podcast.ts or node podcast.ts. Replace the sample source paragraph with the material to adapt.

The Python and cURL examples follow the same sequence. The Go snippets explain where later steps belong inside main and identify the additional binary-encoding import needed for WAV creation. The examples print the dialogue and response metadata before saving the audio.

example

The worked example turns a paragraph about tides into six conversational turns. The host asks why two high tides occur, and the guest explains the two ocean bulges and the Earth's rotation. Delivery directions give the speakers different reactions and speaking styles.

The page presents an embedded demonstration, its transcript and a saved-file message reporting 48.7 seconds, rounded to 49 seconds elsewhere on the page. These are source-provided examples; the audio was not independently listened to or reproduced.

Assessment & evidence

limitations

Multi-speaker input is provider-dependent. The guide says unsupported providers return an error, Gemini rejects more than two distinct voices, and each turn needs a voice unless a top-level default is supplied.

The documented Gemini TTS route supports PCM output only; requesting MP3 returns an error. MP3 delivery requires a later conversion. Maximum document length, audio duration limits, language coverage and generation latency are not specified.

The examples check unsuccessful HTTP responses, but do not include explicit request timeouts, retries or a recovery strategy. Their suitability for a production service was not assessed.

reasoning

Separating script generation from speech generation makes the dialogue inspectable before audio is produced. Structured JSON also avoids extracting speaker labels from free-form prose, while the direction field supplies delivery guidance for each turn.

The schema constrains field names, required fields and the two speaker labels. However, six-to-eight turns, alternating speakers and the under-40-word limit appear only in the prompt; the schema does not enforce them. An application relying on those rules should validate them explicitly.

A well-formed script can still misrepresent the source. Factual fidelity and the effectiveness of delivery directions are not established by the example, so reviewing the dialogue is a useful addition before paying for speech generation.

alternatives

The page suggests google/gemini-3.8-flash-tts for higher-quality speech using the same request structure at a higher output price. That quality description is the source's claim; no comparative listening results or measurements are supplied.

The four language examples offer implementation choices for different development environments. For MP3 output, the documented route converts the generated WAV with ffmpeg. Other speech providers and the linked model listings were not assessed.

evidence

The supporting source is the complete OpenRouter cookbook page at [https://openrouter.ai/docs/cookbook/audio/two-voice-podcast.md]. It includes request code, a dialogue transcript, example response headers, WAV-writing code, a reported cost and troubleshooting guidance.

The transcript, timing, price and printed output are documentation examples supplied by the source. No code was executed, and no independent audio-quality assessment, billing verification or performance benchmark is available.

Access & freshness

costs

The guide estimates about one cent of credits per minute of audio and reports $0.0074 to voice its 49-second example. It says generating the script adds a fraction of a cent, without providing an itemized total or general unit-price table. The exact cost for another document is unknown.

The speech response's x-generation-id header can be used with the documented generation lookup endpoint to obtain that request's cost. The page also identifies google/gemini-3.8-flash-tts as a higher-output-price option. Current prices and independent billing results are not established by the supplied page.

rights

The supplied page does not state a documentation or code licence. Permission to redistribute the guide or reuse its example code under a particular licence is therefore unknown from this source.

The page also does not establish commercial-use rights for generated audio or provide provider terms, data-retention rules or confidentiality commitments. Rights to adapt the input document and publish the resulting conversation need to be established separately.

freshness

The supplied page was captured on 23 November 2026 at 10:00:09 UTC. Its text does not provide a publication date, last-updated date or tutorial version.

Model identifiers, runtime requirements, supported voices, provider limits and prices are presented as documented in that capture. Their current availability and behavior were not independently verified.

actions

Choose the example matching your programming environment, configure the API key and start with a short document you are entitled to adapt. Before generating speech, review the dialogue for factual accuracy and validate its turn count, speaker alternation and length limits.

Confirm that the selected provider supports two-speaker input and the chosen voices. Use PCM for the documented Gemini route, check that the returned audio metadata matches the WAV header assumptions, and listen for speaker identity and turn order. Retrieve the actual request cost through its generation identifier; convert the WAV afterward if MP3 is required.

Evidence for this report

selected-page.txtselected · checked 2026-11-23