Next.js (App Router)
A route handler that proxies synthesis. The key never leaves the server.app/api/tts/route.ts
Express
Serverless notes
Cold starts: the GPU backend scales to zero, so the first request after idle can take tens of seconds. Raise your function’s max duration (e.g. Next.js
maxDuration) and keep the SDK’s default 120 s timeout.- Reuse the client: construct
new Geko(...)once at module scope, not per request. - Long text? stream it. For paragraphs or assistant replies,
geko.tts.stream()starts audio after the first sentence instead of the full render — proxy the chunks straight through. See Streaming audio.