In short.
This is an OpenRouter cookbook page for web developers who want to add a hold-to-talk voice button. The button transcribes a spoken question, answers it with a chat model and speaks the reply. The main catch is that every turn makes three OpenRouter requests in a row, and the page gives no prices or billing rules, so the charges and the cost per turn are unknown. Technically, one server route (/api/talk) receives a browser recording. It calls elevenlabs/scribe-v2 to transcribe it, anthropic/claude-haiku-5.5 for a short answer written to be spoken, and elevenlabs/eleven-v4-turbo to turn that answer into an MP3. It returns the transcript, the answer and the audio as base64. The browser keeps the conversation history so follow-up questions work. The page gives full code for the server, page, script and styles. These behaviours, the sample output and the timing figure all come from the page's own text and code listings, and the code has not been run to confirm them.
Researched and written by an AI model and checked by a second AI model. How it works
The scope is the single page at [https://openrouter.ai/docs/cookbook/audio/push-to-talk-button.md], captured in full (17,018 bytes) on 2026-11-14. Linked pages are excluded: the Speech-to-Text and Text-to-Speech guides, the model catalog, the Scribe v2 and Eleven v4 Turbo model pages, the models API and the documentation index at [https://openrouter.ai/docs/llms.txt]. The embedded demo video and poster image were not captured. The page has no named licence or copyright notice. It invites readers to copy its code into their own apps, but broader reuse and redistribution rights are unknown. The code has not been run. Its runtime behaviour, the OpenRouter responses, the sample outputs, the timing and the browser behaviour are all the page's own claims and have not been independently checked.
The overview
What this resource is
This is a single documentation page from the OpenRouter cookbook, titled Add a Push-to-Talk Voice Button to Your App, at [https://openrouter.ai/docs/cookbook/audio/push-to-talk-button.md]. It is a guide with code, not a library or a hosted product. Its subtitle says it builds a hold-to-talk button that records a question, transcribes it with Scribe v2, answers it with a chat model and speaks the reply with Eleven v4 Turbo.
The captured page is 17,018 bytes of Markdown-style text. It contains four code listings (server.ts, index.html, talk.js, talk.css), a curl check with sample JSON output, a troubleshooting table and a short verification step. It also embeds a demo video and a collapsed transcript of a two-question conversation. The page does not name an author or a publication date.
Overall assessment
On its face this is a focused, well-structured guide. It covers one task from start to finish: a server route, a browser button, a curl command to check the server on its own, a way to try the whole thing in a browser, advice on moving it into your own app, and a troubleshooting table. The table matches eight specific error messages to their causes and fixes. The code is short enough to read in one sitting.
The guide is a demo-quality starting point rather than production guidance. The server code has no authentication, rate limiting or usage cap. It hard-codes English, one voice and three model names. It sends the whole conversation history from the browser on every turn. The page does not hide any of this: it presents the code as a working sample and describes what it does. The sample output, the video and the timing estimate all come from the guide itself. How the code actually performs when run has not been independently checked.
Who it is for
The main audience is web developers who already build or maintain an app and want to add voice questions and answers. They should be comfortable running a small server, reading JavaScript and handling an API key. The code is plain TypeScript and browser JavaScript, so a beginner who can follow terminal commands can copy it. Understanding it takes some familiarity with fetch, form posts and the browser audio APIs.
It is less suited to people who want a ready-made product, a hosted widget or a stack that does not use JavaScript. The page gives no examples for Python, mobile apps or native clients. It is also a poor fit if you need streaming, real-time conversation or the ability to interrupt the reply. The page describes a record, send, wait, play flow, with about ten seconds from releasing the button to the first word of the reply.
What it lets you build
The finished feature records the microphone while a button is held, sends the recording to a server route and plays back a spoken answer. The page lists three outcomes: a /api/talk route that takes a recording and returns a spoken answer, a hold-to-talk button that records, sends and plays the reply, and a conversation that remembers earlier turns.
The code shows these specific behaviours. The browser uses the recording format MediaRecorder reports, and the server chooses the transcription format from it: m4a if the file type contains mp4, otherwise webm. Presses shorter than 400 ms are ignored. The button has labelled states (Hold to talk, Listening, Thinking, Speaking), each with its own styling. The answer text is shown with its leading audio tag, such as [warmly], removed. The server returns OpenRouter errors with a 502 status. If the history field is not valid JSON, the turn starts with an empty conversation. The code does not check that valid JSON is actually a list, so a JSON object in that field can end the turn with a 502 error instead. The troubleshooting table covers microphone permission, a missing microphone, pages not served over HTTPS, a missing or wrong voice, an unsupported speed setting, bad audio uploads and a missing format field.
Using it
What you need
The page lists three requirements: an OpenRouter API key in the OPENROUTER_API_KEY environment variable, Bun to run the server, and a browser with a microphone. The server stops with an error at start-up if the key is not set.
Other requirements follow from the code. The page must be served from localhost or over HTTPS, because the troubleshooting table says browsers only allow microphone access on secure pages. The browser must support MediaRecorder and getUserMedia. The page notes that Safari records MP4 audio. The reply plays from a data: URL after a request that can take several seconds, and the page's own error handling admits that the browser may block playback.
For use in another stack, the page says handleTalk takes a standard Request and returns a Response. That means it works in any fetch-style server on Bun or Node, which supply the process.env and Buffer it uses. The page gives a Next.js app/api/talk/route.ts example. It does not say which Bun or Node versions are needed.
How it works
In the browser, talk.js listens for pointerdown, pointerup and pointerleave events on the button. On press it asks for the microphone and starts a MediaRecorder. On release it stops recording and checks the recording lasted at least 400 ms. It then posts a form to /api/talk containing the audio and the conversation history as JSON.
On the server, handleTalk reads the form and makes three calls in a row to [https://openrouter.ai/api/v1], sending the API key from the environment as a bearer token. First, it posts to /audio/transcriptions with model elevenlabs/scribe-v2, the audio as base64, a format and language set to en. Second, it posts to /responses with model anthropic/claude-haiku-5.5, the history plus the new question, a 300-token limit on the answer (max_output_tokens) and a system prompt. The prompt asks for two or three short spoken sentences with no markdown, lists, numbers written as digits or emoji, starting with one audio tag. Third, it posts to /audio/speech with model elevenlabs/eleven-v4-turbo, the voice george and MP3 output.
The route returns JSON with the question, the answer and the speech as a base64 MP3. The browser adds the user's question and the assistant's answer to its in-memory history, so the next request carries the context. The page notes that the API key stays on the server and the browser holds the conversation. Because the history lives in a JavaScript array, it is lost when the page reloads. The page does not describe saving it.
Setup steps
The guide has three steps. Step 1 creates server.ts and starts it with bun server.ts. It suggests checking the server on its own by posting a short voice memo with curl and viewing the result with jq. Step 2 adds index.html, talk.js and talk.css next to server.ts; Bun bundles the HTML and the files it links when the server starts. Step 3 opens [http://localhost:3000], allows the microphone, then holds the button, asks a question and releases it.
server.ts imports ./index.html, so all four files must exist before the server starts. The page says the server listens on port 3000. It lists no package installation step, which fits with the code using only built-in tools (fetch, Buffer, FormData and Bun.serve). To reuse the route elsewhere, the page says to copy server.ts without the index.html import and the Bun.serve block, then mount handleTalk at /api/talk. The results of these steps are as the page describes them and have not been independently checked.
Worked example from the page
The page's example is a two-turn conversation. The user asks why the sky is blue, and the agent explains Rayleigh scattering. The user then asks why it turns orange at sunset, referring to the sky only as it. The agent explains that sunset light travels through more atmosphere. The page uses this to show that follow-up questions work.
The curl check comes with sample output: a JSON object with question set to Why is the sky blue?, an answer starting with the audio tag [warmly], and a shortened base64 string starting SUQzBAAAAAAAI1RTU0UAAAAP for the speech. The page's own success checks are: both questions appear as spoken, the second answer is about the sky even though the question never names it, the answers play in the george voice, and no bracketed tag appears on screen or in the audio. These outputs are the page's own illustration and have not been independently checked.
Assessment & evidence
Limitations and caveats
The code shows these limits. The language is hard-coded to en and the voice is fixed to george. The server only treats files whose type contains mp4 as m4a and treats everything else as webm, so other recording types are not handled. The route has no authentication, rate limiting or cost cap. The code has no upload-size check of its own, and any size limits set by the runtime or by OpenRouter are unknown. If you expose the route publicly as written, anyone who can reach /api/talk can make OpenRouter requests with your key, and what those requests cost is unknown. This is an observation about the sample code; the page does not discuss it.
The page says a turn takes about ten seconds from release to the first word, with speech as the slowest stage. That timing has not been independently checked. The three calls run one after another and the reply arrives only after the whole MP3 is generated, so there is no streaming. The history grows with every turn and is sent again in full each time, and the code does not trim it. When a turn fails, the page shows a generic Something went wrong message; the detailed OpenRouter error appears only in the browser console and the response body. The script has no pointercancel handler, and how it behaves on touch devices is unknown. Behaviour in browsers other than Chrome (shown in the video) has not been checked, apart from the page's note that Safari records MP4. The models the page names, and their pricing, may change over time.
Reasoning behind the assessment
The page is a complete walkthrough, and its code mostly matches its text. The 400 ms rule, the format choice, the 502 error path and the code that strips the audio tag in talk.js are all described in the text and present in the listings. The history fallback is narrower than the text says. The text says a malformed history field starts a fresh conversation. In the code, only history that is not valid JSON starts an empty conversation, and valid JSON is never checked to be a list. The troubleshooting table quotes exact error messages and ties them to settings the code uses, such as voice, speed and format. That suggests it was written from real runs, but this is an inference: the page does not say how the table was made.
The guide fits the learning-resource category rather than the product category. It teaches a pattern and supplies sample code, and it does not ship an installable package. It shows clearly what the work involves (a server route, a button and a conversation history), so it is useful for judging whether OpenRouter's audio endpoints suit an app. How well it suits a given app depends on cost, tolerance for delay and privacy needs, which the page leaves to the reader.
Alternatives and related options
The page points to related OpenRouter material: the Speech-to-Text and Text-to-Speech guides, the model catalog, and the Scribe v2 and Eleven v4 Turbo model pages. It says any chat model in the catalog can be used for the answer step. It names elevenlabs/eleven-multilingual-v2 as a model with speed control, for when you need speed settings that Eleven v4 Turbo does not support. Those linked pages are not part of this evidence, so what they contain is unknown.
The page does not compare itself with other approaches, such as speech APIs built into the browser, real-time or streaming voice APIs from other companies, or hosted voice-agent platforms. Whether any of these would be faster or cheaper is unknown from this evidence.
Evidence base
The source is a single OpenRouter cookbook page, [https://openrouter.ai/docs/cookbook/audio/push-to-talk-button.md], captured in full (17,018 bytes) on 2026-11-14. What is known about the guide comes from that page's text, its four code listings, its sample curl output and its troubleshooting table. The pages it links to were not captured.
The page embeds a demo video and a poster image. Their content was not captured, so only the written transcript under the video is available. The examples, the sample curl output and the timing estimate of about ten seconds all come from the guide itself. How the code actually performs when run has not been independently checked.
Access & freshness
Costs
The page states no prices, billing rules or free allowance. It says to see the Scribe v2 and Eleven v4 Turbo model pages for pricing, but those pages are not part of this evidence. It does not mention the price of the chat model (anthropic/claude-haiku-5.5) at all. Each voice turn makes three requests in a row: transcription, a response and speech generation. Whether and how much each request is charged, and so the cost per turn, is unknown. It is also unknown whether OpenRouter offers any free allowance for these models.
The page does not explain how charges are calculated. It is therefore unknown whether the recording length, the growing history sent on each turn, the answer length (capped at 300 tokens) or the length of the spoken text change what a turn costs. The page does not mention costs for Bun or hosting. Anyone planning to deploy this should check current model pricing and set their own usage limits first.
Rights and reuse
The captured page contains no named licence, copyright notice or detailed reuse terms. It does expressly invite readers to use its code in their own apps: it says to copy server.ts into your app (without the index.html import and the Bun.serve block), to copy the button, talk.js and talk.css into the page that needs it, and it suggests pasting the page URL into Claude Code, Codex or Cursor to add the button. Because no licence or detailed terms are given, rights beyond that stated use, such as redistributing the code or republishing the page text, are unknown.
Using the sample also means using third-party models through OpenRouter. This page does not state the terms for those models, how OpenRouter and the underlying providers handle or keep audio and text, or any limits on voices or generated speech, so all of these are unknown. The sample sends users' voice recordings to outside services, so anyone deploying it to real users should check those terms and the privacy implications separately.
Freshness
The page shows no publication or last-updated date. The only date is the capture date, 2026-11-14. The page names specific models (elevenlabs/scribe-v2, anthropic/claude-haiku-5.5, elevenlabs/eleven-v4-turbo) and a voice (george). It is unknown whether these are still available or still behave as described after the capture date, and current pricing is unknown.
A note at the top of the page points to a documentation index at [https://openrouter.ai/docs/llms.txt]. How actively the page is maintained, and how often it is updated, is unknown. The OpenRouter API, the model catalog and browser audio behaviour can all change. Check the live page and the model pages again before relying on any detail.
Suggested next steps
If you are considering this guide, first open the Scribe v2 and Eleven v4 Turbo model pages and the chat model's page to estimate the cost per turn, because the guide gives none. Then decide whether about ten seconds per turn, with no streaming, is acceptable for your users.
If you go ahead, set OPENROUTER_API_KEY on the server only. Use the curl check from Step 1 to test the server on its own, then try the browser flow on localhost. Before making it available beyond your own machine, serve it over HTTPS and add authentication, rate limiting and a usage cap in front of /api/talk. If you plan to redistribute the code beyond your own app, check OpenRouter's terms first, because the page names no licence. Also check the privacy and usage terms for the audio you send and the models you call, because the page does not state them. Finally, if you expect long sessions, trim or cap the conversation history.
