I’m intermittently getting an error trying to connect to the realtime API.
My app was working, but now suddenly I’m getting errors based on the realtime console code here
Is it the case that this realtime (preview) API is very flaky and goes up and down?
this comes from the more simple SDK demo
the EPHEMERAL_KEY seems to be a valid key as far as I can see.
update - I can get a working token on the deployed app.
Are OpenAIs servers blocked for development from localhost, sometimes? Or some occasional CORS error?
I also thought maybe it’s the dreaded development mode with double renders in react, but that isn’t the case here since the token isn’t on an ‘effect’. It’s a button I push explicitly to call that method.
Oddly I can get the openAI sample App working, so there is something subtle with how my own app runs locally and this code
what i’ve checked
error only occurs on localhost code is fine when deployed
same API key used for local and staging envs
ephemeral key is valid (or at least there is one)
API is not ‘bouncing’ - only called once
tried with both model names gpt-4o-realtime-preview-2024-12-17 and
`gpt-4o-realtime-preview’
using Next/vercel so i tried with their NestResponse.json and plain new Response
update again - seems this was related to using an old API key.
the bizarre thing is it worked a few times, worked in prod, then stopped working locally. at least it seems that was what happened? unless its just general flakiness but seems reproducible.