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/src/server/providers/openai-realtime.ts

overstepping12adc9454f97
diff --git a/xspace-agent/src/server/providers/openai-realtime.ts b/xspace-agent/src/server/providers/openai-realtime.ts
new file mode 100644
index 000000000..2b3d6ccce
--- /dev/null
+++ b/xspace-agent/src/server/providers/openai-realtime.ts
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent) [§32]
+
+import axios from "axios"
+import type { Provider } from "../types"
+
+const API_KEY = process.env.OPENAI_API_KEY
+const MODEL = process.env.OPENAI_REALTIME_MODEL || "gpt-4o-realtime-preview-2024-12-17"
+
+async function createSession(
+ agentId: number,
+ prompts: Record<number, string>,
+ voices: Record<number, string>,
+): Promise<unknown> {
+ const response = await axios.post(
+ "https://api.openai.com/v1/realtime/sessions",
+ {
+ model: MODEL,
+ modalities: ["audio", "text"],
+ voice: voices[agentId],
+ instructions: prompts[agentId],
+ },
+ {
+ headers: {
+ Authorization: `Bearer ${API_KEY}`,
+ "Content-Type": "application/json",
+ },
+ },
+ )
+ return response.data
+}
+
+const provider: Provider = { type: "webrtc", createSession }
+module.exports = provider
+
+