Skip to content

Fix OpenAI Realtime: use /v1/realtime/client_secrets (old /sessions returns 404)#2

Open
suyash-lyzr wants to merge 1 commit into
open-gitagent:mainfrom
suyash-lyzr:fix/openai-realtime-client-secrets-endpoint
Open

Fix OpenAI Realtime: use /v1/realtime/client_secrets (old /sessions returns 404)#2
suyash-lyzr wants to merge 1 commit into
open-gitagent:mainfrom
suyash-lyzr:fix/openai-realtime-client-secrets-endpoint

Conversation

@suyash-lyzr

Copy link
Copy Markdown

Problem

Voice mode is broken for all OpenAI Realtime users: POST https://api.openai.com/v1/realtime/sessions now returns HTTP 404 "Invalid URL" — OpenAI retired that endpoint. openai-realtime.ts calls it to mint the ephemeral token, so the WebSocket never connects, and the UI shows a misleading "no API key set" banner even when the key is valid.

Reproduced live (valid key):

POST /v1/realtime/sessions        -> 404  (Invalid URL)
POST /v1/realtime/client_secrets  -> 200  (returns a top-level "value")

Fix

Migrate both the initial-connect and refresh paths in src/openai-realtime.ts to the current endpoint:

Before After
URL /v1/realtime/sessions /v1/realtime/client_secrets
Body { model } { session: { type: "realtime", model } }
Response session.client_secret.value session.value (top-level)

Verification

  • Sent the exact request the patched code emits ({"session":{"type":"realtime","model":"gpt-realtime-2025-08-28"}}) → HTTP 200 with a top-level value ephemeral key (ek_...).
  • npm run build (tsc) passes clean.
  • Diff is one file, both call sites, no behavior change beyond the endpoint migration.

🤖 Generated with Claude Code

…eturns 404)

OpenAI retired POST /v1/realtime/sessions; it now returns HTTP 404
'Invalid URL', so voice mode fails to obtain an ephemeral token and the
UI shows a misleading 'no API key set' error for every user.

Migrate both the initial-connect and refresh paths to the current
endpoint POST /v1/realtime/client_secrets:
  - body: { model } -> { session: { type: 'realtime', model } }
  - response: session.client_secret.value -> session.value (top-level)

Verified live: old endpoint -> 404, new endpoint with this exact request
-> 200 with a top-level ephemeral 'value'. tsc build passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant