Public
Talk an app into existence. Voice agent on Cerebras.
ai-agentcerebrasvoice
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

Cerebras Voice Coder

Talk an app into existence. Say what to build, watch it appear, say the next change. Each edit takes about a second, because the models run on Cerebras.

How to use it

  • Hold Space and talk. Release to send. This is the default.
  • Click "Space to talk" above the bottom strip for hands-free: it listens all the time and sends after a second of silence. If you keep talking after it sent, it undoes that and resends the whole sentence.
  • Type any letter to get a text box.
  • Chat, bottom left, opens the whole conversation in a panel. Escape closes it.
  • ⚙ Settings, next to Chat, picks the model (GPT-OSS 120B, Qwen 3.8 27B, or any other id) and how much it thinks (off, low, medium, high). Medium is the default: off is a little faster but tends to drop parts of a request that asks for several things.

The agent builds the smallest thing you asked for, so you build up the app one step at a time. The page you are building fills the screen; what you said and what changed show briefly at the bottom, big enough to read from across the room. Agent replies scroll past and fade.

Setup

Set CEREBRAS_API_KEY in the val's environment variables. Chrome or Safari, for the built-in speech recognizer.

Optional: OPENROUTER_API_KEY lets the model setting take any OpenRouter slug, like anthropic/claude-opus-5-fast. URL parameters: ?model= and ?thinking= set the initial settings, ?silence= tunes the hands-free cutoff in milliseconds, ?voice=1 starts in hands-free mode.

How it works

  • agent.ts: the agent loop. One streaming chat completion per turn with four tools (list, read, write, edit files); tool calls run against an in-memory workspace; every step streams to the browser as server-sent events. A cerebras:<model> id calls Cerebras directly; anything else goes through OpenRouter. The thinking setting maps to each model's reasoning parameter.
  • index.ts: Hono server. POST /api/agent runs one instruction; the browser holds the conversation and the files, so the server keeps no state.
  • frontend/components/VoiceButton.tsx: the speech hook: Web Speech API, silence cutoff, continued-sentence detection, push-to-talk.
  • frontend/components/App.tsx: the page, the run loop, undo-and-resend.
  • frontend/components/Overlay.tsx: the bottom strip, the mic, the chat panel, and settings.