Realtime API Session Create doesn't work

I am trying to use the Realtime API by sending a request to the Create session endpoint, as described in the documentation. However, I am encountering the following error:

{
  "message": "Unknown parameter: 'client_secret.expires_at'.",
  "type": "invalid_request_error",
  "param": "client_secret.expires_at",
  "code": "unknown_parameter"
}

According to the documentation, it is stated that the
client_secret parameter can be included in the request body. Below is the curl command I used:

curl --location 'https://api.openai.com/v1/realtime/sessions' \
--header 'Authorization: Bearer $OPENAI_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "model": "gpt-4o-mini-realtime-preview-2024-12-17",
    "client_secret": {
      "expires_at": {
        "seconds": 60
      }
    }
}'
1 Like

I am having the exact same issue. I would really like to take advantage of the two-hour max session time.

In my case, this works fine:

curl --location 'https://api.openai.com/v1/realtime/transcription_sessions' \
--header "Authorization: Bearer $OPENAI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "input_audio_transcription": {
        "language": "en",
        "prompt": "",
        "model": "gpt-4o-transcribe"
    }
}'

Whereas this gives the error you describe:

curl --location 'https://api.openai.com/v1/realtime/transcription_sessions' \
--header "Authorization: Bearer $OPENAI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "client_secret": {
        "expires_at": {
            "seconds": 7200
        }
    },
    "input_audio_transcription": {
        "language": "en",
        "prompt": "",
        "model": "gpt-4o-transcribe"
    }
}'