Internal Server Error when creating ephemeral token

I try to run the code straight from the docs.

const r = await fetch("https://api.openai.com/v1/realtime/sessions", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${key}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: "gpt-4o-realtime-preview-2024-12-17",
      voice: "verse",
    }),
  });

Response
status: 500,
statusText: ‘Internal Server Error’,

Tried with new key, old key, v2, … nothing more I can try. The issue presist since the release of that code in the docs.

Anyone else got this running?
Where to contact someone who can help?

I get the same error at the moment when using this package GitHub - cameronking4/openai-realtime-api-nextjs: Nextjs 15 starter with shadcn/ui to leverage the Realtime API Beta (12-17-2024) and tool calling capabilities. Build your own Voice AI Nextjs app or feature using OpenAI Realtime API & WebRTC.

try again! repo has been updated

I did a clean clone. (just FYI - there are some dependency errors - needed to to npm install —force

But the outcome, when running on localhost:3000 is still the same.
http://localhost:3000
I get the same when using your deploy direct to Vercel and running it from there. Not sure what the problem is. They OPENAI api key has all the rights needed, I;m Tier 4 user with those models in my playground etc.

Update - I restarted the app today - and it works. I wonder if there was a change on the OpenAI side of things (or in my account). Did not touch the code, keys etc. Cool stuff

1 Like

There was recently a correction for newly created accounts, so it could have been that. Hopefully everything is back to normal now.

2 Likes