Realtime API Server Always Fails #381
Answered
by
taylorbrown2686
taylorbrown2686
asked this question in
Q&A
-
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using UnityEngine;
using OpenAI;
using OpenAI.Realtime;
using OpenAI.Models;
public class RealtimeSessionRunner : MonoBehaviour
{
async void Start()
{
var api = new OpenAIClient("MYKEY");
var cancellationTokenSource = new CancellationTokenSource();
var tools = new List<Tool>
{
Tool.FromFunc("goodbye", () =>
{
cancellationTokenSource.Cancel();
return "Goodbye!";
})
};
var configuration = new SessionConfiguration(Model.GPT4oRealtime, tools: tools);
using var session = await api.RealtimeEndpoint.CreateSessionAsync(configuration);
var responseTask = session.ReceiveUpdatesAsync<IServerEvent>(ServerEvents, cancellationTokenSource.Token);
await session.SendAsync(new ConversationItemCreateRequest("Hello!"));
await session.SendAsync(new CreateResponseRequest());
await session.SendAsync(new InputAudioBufferAppendRequest(new ReadOnlyMemory<byte>(new byte[1024 * 4])), cancellationTokenSource.Token);
await session.SendAsync(new ConversationItemCreateRequest("GoodBye!"));
await session.SendAsync(new CreateResponseRequest());
await responseTask;
}
void ServerEvents(IServerEvent @event)
{
switch (@event)
{
case ResponseAudioTranscriptResponse transcriptResponse:
Debug.Log(transcriptResponse.ToString());
break;
case ResponseFunctionCallArgumentsResponse functionCallResponse:
if (functionCallResponse.IsDone)
{
ToolCall toolCall = functionCallResponse;
toolCall.InvokeFunction();
}
break;
}
}
} I have taken this code directly from the documentation but it always fails. I get some generic exception 'ServerResponse Failed!' Is this on the end of OpenAI or is something wrong in the example or how I have set it up? EDIT: Formatting won't work for some reason. Pasted the code many times using the `` tags. Also removed my API key despite it being deleted already. |
Beta Was this translation helpful? Give feedback.
Answered by
taylorbrown2686
Jun 18, 2025
Replies: 1 comment 11 replies
-
Pretty sure this is a temporary outage. All of my unit tests and sample scene testing passed before I made the latest release for realtime endpoint. |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Upon further investigation, this appears to be a quota issue. A response object comes through with the info nested inside of it, this is surprising since I haven't used realtime for more than a few conversations.
I will have to check their platform to see how I can upgrade. Thanks for your help!