Public
Remixed
Any OpenRouter model codes a web page live, with tok/s + cost
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.

OpenRouter Coder

Pick any model on OpenRouter and watch it code a web page live — with measured tokens/second, time-to-first-token, and exact cost per generation.

Sibling of kimi-coder, which is pinned to Kimi K3 on Modal.

How it works

  • index.ts — Hono server: streams /api/generate as server-sent events; /api/models proxies OpenRouter's model catalog (cached) to power the typeahead
  • openrouter.ts — one streaming chat completion with provider: {sort: "throughput"} (fastest host) and reasoning: {enabled: false} (raw codegen speed, no thinking)
  • frontend/ — React chat + model picker (native datalist typeahead over all ~340 models) + code stream + live preview

Remix it

  1. Remix this val
  2. Get an API key at openrouter.ai/keys, then:

👉 Add OPENROUTER_API_KEY here: https://www.val.town/x/stevekrouse/openrouter-coder/environment-variables?key=OPENROUTER_API_KEY