Skip to content

Failing to access "gpt-4o-realtime-preview-2024-12-17" model #28

Open
@seratch

Description

@seratch

Hello! It seems my account can't access the gpt-4o-realtime-preview-2024-12-17 model, but it can use the gpt-4o-realtime-preview. Should this example app consistently use the gpt-4o-realtime-preview to ensure broader audiences can run it successfully?

Here is the error response with gpt-4o-realtime-preview-2024-12-17 model:

{
  "type": "response.done",
  "event_id": "event_XXX",
  "response": {
    "object": "realtime.response",
    "id": "resp_XXX",
    "status": "failed",
    "status_details": {
      "type": "failed",
      "error": {
        "type": "invalid_request_error",
        "code": "model_not_found",
        "message": "The model `gpt-4o-realtime-preview-2024-12-17` does not exist or you do not have access to it."
      }
    },
    "output": [],
    "conversation_id": "conv_XXX",
    "modalities": [
      "audio",
      "text"
    ],
    "voice": "coral",
    "output_audio_format": "pcm16",
    "temperature": 0.8,
    "max_output_tokens": "inf",
    "usage": {
      "total_tokens": 0,
      "input_tokens": 0,
      "output_tokens": 0,
      "input_token_details": {
        "text_tokens": 0,
        "audio_tokens": 0,
        "cached_tokens": 0,
        "cached_tokens_details": {
          "text_tokens": 0,
          "audio_tokens": 0
        }
      },
      "output_token_details": {
        "text_tokens": 0,
        "audio_tokens": 0
      }
    },
    "metadata": null
  }
}

Modifying the code this way resolved the issue for me:

diff --git a/src/app/api/session/route.ts b/src/app/api/session/route.ts
index 9f1d9bc..d92f37b 100644
--- a/src/app/api/session/route.ts
+++ b/src/app/api/session/route.ts
@@ -11,7 +11,7 @@ export async function GET() {
           "Content-Type": "application/json",
         },
         body: JSON.stringify({
-          model: "gpt-4o-realtime-preview-2024-12-17",
+          model: "gpt-4o-realtime-preview",
         }),
       }
     );
diff --git a/src/app/lib/realtimeConnection.ts b/src/app/lib/realtimeConnection.ts
index df0a5e2..8549e49 100644
--- a/src/app/lib/realtimeConnection.ts
+++ b/src/app/lib/realtimeConnection.ts
@@ -21,7 +21,7 @@ export async function createRealtimeConnection(
   await pc.setLocalDescription(offer);
 
   const baseUrl = "https://api.openai.com/v1/realtime";
-  const model = "gpt-4o-realtime-preview-2024-12-17";
+  const model = "gpt-4o-realtime-preview";
 
   const sdpResponse = await fetch(`${baseUrl}?model=${model}`, {
     method: "POST",

I am happy to send a pull request as necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions