← All projects

Voice Agent

A weekend build that turns Claude into a voice assistant using the browser's speech APIs.

Diagram of the voice loop: Web Speech API to transcript to Claude API to speech synthesis, with a latency stat of ~3s down to under 1s
There's no UI to screenshot. It was a browser demo with almost no visual chrome, and the original build wasn't kept, so this is the loop as a diagram.

The short version

What it is

A weekend voice assistant using only Claude and the browser's built-in speech APIs. Speak, it listens, Claude answers and the browser talks back.

What I had to steer

Latency. The first version worked in two hours and felt slow, so all the effort went into cutting the wait.

What I wired together

The Web Speech API for recognition, the Claude API with streaming, and speech synthesis for the reply.

Where I pushed it

Starting speech on the first sentence of Claude's streamed reply cut the perceived wait from around three seconds to under one. That one change made the biggest difference.

The build log

A weekend voice agent

I wanted to know if I could build a useful voice agent in a weekend using only Claude’s API and the browser’s own speech APIs, with no third-party voice platform.

The loop is simple: the Web Speech API for recognition, the transcript to Claude and speech synthesis for the reply. The first version worked in about two hours.

Then it was all about latency, the gap between finishing a sentence and hearing a reply. Streaming Claude’s response and starting speech on the first sentence while the rest was still generating cut the perceived wait from around three seconds to under one.

It works for simple exchanges and falls apart on anything that needs more than a few turns, because the full conversation history eats the context window fast. The next step would be summarising old turns before sending them.