You are browsing as a guest. Sign up (or log in) to start making projects!

5h 2m 15s logged

Phase 2 Devlog — Voice IntegrationPhase 2 was all about giving Rick his actual voice using Fish Audio, which hosts a Rick Sanchez voice clone model. The first problem hit immediately: Fish Audio had quietly updated their API. The old speech-1.5 model name passed inside the request body no longer worked — Fish Audio now expects the model as an HTTP header (model: s2.1-pro-free), and the model names themselves had changed entirely. Once we figured that out and stripped the invalid body parameters, the request was clean. But Rick still wasn’t speaking.The bigger wall was CORS. The moment a browser fetch() call sends an Authorization header to a third-party API, the browser fires a preflight check — and if the server doesn’t explicitly whitelist your origin, the request gets blocked before it even leaves the browser. Fish Audio’s API is designed for server-to-server use, so no frontend origin gets through, whether you’re on localhost or a real GitHub Pages domain. There’s no client-side fix for this. As a temporary workaround we wired in the browser’s built-in speechSynthesis API, tuning the pitch down and slowing the rate to approximate Rick’s drawl. It worked, but it obviously wasn’t Rick.The real fix was a Cloudflare Worker acting as a one-file serverless proxy. The insight is simple: CORS only applies to browser-to-server calls, not server-to-server. So the browser calls the Worker (which is on your own domain, no CORS issue), the Worker forwards the request to Fish Audio privately, and streams the audio blob back with open CORS headers. The whole proxy is about 60 lines of JavaScript, deploys in two minutes from the Cloudflare dashboard for free.

0
2

Comments 0

No comments yet. Be the first!