Skip to main content
The golden rule: call Geko from your server, and let your frontend call your server. The API now allows cross-origin browser calls (CORS), but that doesn’t make it safe to expose your key — a key shipped to the client is public. Keep it on the server.

Next.js (App Router)

A route handler that proxies synthesis. The key never leaves the server.
app/api/tts/route.ts
Call it from a client component:

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.