We started getting this error when creating a Realtime WebRTC connection this week:
{"error": {"code": "invalid_offer", "message": "Invalid SDP offer. Please try again with a WHIP-compliant offer.", "param": null, "type": "invalid_request_error"}}
It seems to be upset that we start off with no media streams and only a data channel. This used to work just fine though, and we want to start off with just a data channel for text chat and only open a voice connection if the user chooses to.
I’m encountering the same issue when creating a WebRTC connection with the OpenAI Realtime API:
OperationError: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection':
Failed to parse SessionDescription.
{"error":{"message":"Invalid SDP offer. Please try again with a WHIP-compliant offer.",
"type":"invalid_request_error","param":null,"code":"invalid_offer"}}
Setup Details:
Using the OpenAI Realtime API beta client with React (18.x).
Implemented a relay server based on OpenAI’s documentation.
What I’ve Tried:
Verified API key and relay server setup.
Checked SDP offer format for WHIP compliance.
Updated to the latest API client version.
Questions:
What are the WHIP-compliance requirements for SDP offers?
Any known issues or debugging tips for SDP validation?
We have been working on a project for a few weeks then , suddenly this morning everything stopped working. our SDP offers are coming back null form the ICE candidate.
I ran into the same “Invalid SDP offer” issue when using the Realtime API. In my setup, I was using a relay server to (1) request the ephemeral token from OpenAI and (2) forward the SDP offer/answer. That caused the error:
{"error": {"message":"Invalid SDP offer. Please try again with a WHIP-compliant offer.","type":"invalid_request_error","param":null,"code":"invalid_offer"}}
How I Fixed It:
Use the Relay Server Only for Ephemeral Token
I changed my relay server so it only handles retrieving the ephemeral token from OpenAI:
// Relay server (simplified example)
// 1. Receive request from frontend
// 2. Use your OpenAI API key to call the ephemeral token endpoint
// 3. Return the ephemeral token to frontend
Send SDP Offers Directly to OpenAI from the Frontend
Once I received the ephemeral token in my frontend, I sent the SDP offer directly to:
https://api.openai.com/v1/realtime
with the ephemeral token for authentication. This got rid of the “Invalid SDP offer” error.
By separating the two steps—(a) retrieving the ephemeral token via the relay server, then (b) sending the actual offer from the client to OpenAI—my WebRTC session now starts correctly.