Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

add xspace-agent/xspace-agent/agent-voice-chat/providers/openai-realtime.js

oversteppinga6af9d8d0d3d
diff --git a/xspace-agent/xspace-agent/agent-voice-chat/providers/openai-realtime.js b/xspace-agent/xspace-agent/agent-voice-chat/providers/openai-realtime.js
new file mode 100644
index 000000000..ad12c3b9b
--- /dev/null
+++ b/xspace-agent/xspace-agent/agent-voice-chat/providers/openai-realtime.js
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent)
+
+const axios = require("axios")
+
+class OpenAIRealtimeProvider {
+ static name = "openai"
+ static requiredEnvVars = ["OPENAI_API_KEY"]
+
+ constructor() {
+ this.type = "webrtc"
+ this.name = "openai"
+ this.model = process.env.OPENAI_REALTIME_MODEL || "gpt-4o-realtime-preview-2024-12-17"
+ }
+
+ async createSession(agentId, prompts, voices) {
+ const response = await axios.post(
+ "https://api.openai.com/v1/realtime/sessions",
+ {
+ model: this.model,
+ modalities: ["audio", "text"],
+ voice: voices[agentId],
+ instructions: prompts[agentId]
+ },
+ {
+ headers: {
+ Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
+ "Content-Type": "application/json"
+ }
+ }
+ )
+ return response.data
+ }
+}
+
+module.exports = OpenAIRealtimeProvider
+
+