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/.env.example

overstepping118c1230ed44
diff --git a/xspace-agent/xspace-agent/agent-voice-chat/.env.example b/xspace-agent/xspace-agent/agent-voice-chat/.env.example
new file mode 100644
index 000000000..bd7eecdbe
--- /dev/null
+++ b/xspace-agent/xspace-agent/agent-voice-chat/.env.example
@@ -0,0 +1,185 @@
+# ============================================================================
+# agent-voice-chat — Environment Configuration
+# ============================================================================
+# Copy this file to .env and fill in your API keys.
+# At minimum, you need AI_PROVIDER and the corresponding API key.
+#
+# Quick start examples:
+# OpenAI Realtime (lowest latency): AI_PROVIDER=openai, OPENAI_API_KEY
+# Groq (fast + cheap): AI_PROVIDER=groq, GROQ_API_KEY, TTS_PROVIDER=openai, OPENAI_API_KEY
+# Claude (great quality): AI_PROVIDER=claude, ANTHROPIC_API_KEY, STT_PROVIDER=groq, GROQ_API_KEY, TTS_PROVIDER=openai, OPENAI_API_KEY
+# ============================================================================
+
+# --- AI Provider -----------------------------------------------------------
+# Which LLM generates agent responses.
+#
+# "openai" — OpenAI Realtime API via WebRTC (~200ms latency, handles its own STT/TTS)
+# "openai-chat" — OpenAI Chat Completions, streaming (~800ms, needs separate STT + TTS)
+# "claude" — Anthropic Claude, streaming (~900ms, needs separate STT + TTS)
+# "groq" — Groq with Llama models, streaming (~400ms, needs separate TTS)
+AI_PROVIDER=openai
+
+# --- API Keys --------------------------------------------------------------
+# Only the keys for your chosen provider(s) are required.
+
+# OpenAI (required for: openai, openai-chat, openai TTS, openai STT)
+# Get your key: https://platform.openai.com/api-keys
+OPENAI_API_KEY=
+
+# Anthropic (required for: claude provider)
+# Get your key: https://console.anthropic.com/
+ANTHROPIC_API_KEY=
+
+# Groq (required for: groq provider, groq STT)
+# Get your key: https://console.groq.com/
+GROQ_API_KEY=
+
+# ElevenLabs (optional, only if TTS_PROVIDER=elevenlabs)
+# Get your key: https://elevenlabs.io/
+ELEVENLABS_API_KEY=
+
+# --- Speech-to-Text (STT) --------------------------------------------------
+# Transcribes user speech to text. Only used with socket-based providers
+# (openai-chat, claude, groq). The openai realtime provider handles STT internally.
+#
+# "groq" — Groq Whisper Large V3 (fast, requires GROQ_API_KEY)
+# "openai" — OpenAI Whisper (requires OPENAI_API_KEY)
+STT_PROVIDER=groq
+
+# --- Text-to-Speech (TTS) --------------------------------------------------
+# Converts agent text responses to spoken audio. Only used with socket-based providers.
+#
+# "openai" — OpenAI TTS API (good quality, requires OPENAI_API_KEY)
+# "elevenlabs" — ElevenLabs API (best voice quality, requires ELEVENLABS_API_KEY)
+# "chatterbox" — Chatterbox by Resemble AI (open-source, self-hosted, MIT license)
+# "piper" — Piper TTS (open-source, self-hosted, lightweight, runs on CPU)
+# "browser" — Browser's built-in speech synthesis (free, lower quality)
+TTS_PROVIDER=openai
+
+# ElevenLabs voice IDs (optional, defaults are provided)
+# Find voices: https://elevenlabs.io/voice-library
+ELEVENLABS_VOICE_0=
+ELEVENLABS_VOICE_1=
+
+# Chatterbox — open-source TTS with voice cloning (only if TTS_PROVIDER=chatterbox)
+# GitHub: https://github.com/resemble-ai/chatterbox
+# Run your own server, then point CHATTERBOX_API_URL at it.
+CHATTERBOX_API_URL=http://localhost:8150
+# Optional: path to reference audio files for voice cloning (per agent)
+CHATTERBOX_VOICE_REF_0=
+CHATTERBOX_VOICE_REF_1=
+
+# Piper — lightweight open-source TTS (only if TTS_PROVIDER=piper)
+# GitHub: https://github.com/rhasspy/piper
+# Run: piper --http-server --port 5000
+PIPER_API_URL=http://localhost:5000
+# Piper voice model names (see https://rhasspy.github.io/piper-samples/)
+PIPER_VOICE_0=en_US-lessac-medium
+PIPER_VOICE_1=en_US-amy-medium
+
+# --- Server -----------------------------------------------------------------
+
+# Port the server listens on (1–65535).
+PORT=3000
+
+# Display name shown in the UI header.
+PROJECT_NAME=AI Agents
+
+# Enable text input box in the UI. Set to "false" for voice-only mode.
+INPUT_CHAT=true
+
+# Custom avatar image URLs for agents (optional).
+AVATAR_URL_1=
+AVATAR_URL_2=
+
+# Max request body size (format: "10mb", "500kb", etc.)
+BODY_SIZE_LIMIT=10mb
+
+# Socket.IO timing
+SOCKET_PING_TIMEOUT=60000 # Ping timeout in ms
+SOCKET_PING_INTERVAL=25000 # Ping interval in ms
+
+# Room / message limits
+MAX_ROOMS=100
+MAX_MESSAGES_PER_ROOM=500
+SHUTDOWN_TIMEOUT_MS=10000
+
+# --- Memory System ----------------------------------------------------------
+
+# Set to "false" to disable memory persistence entirely.
+MEMORY_ENABLED=true
+
+# Path for memory persistence files.
+MEMORY_STORAGE_PATH=./memory
+
+# Maximum number of stored memories before oldest are evicted.
+MEMORY_MAX_MEMORIES=1000
+
+# --- Knowledge Base ---------------------------------------------------------
+
+# Path for knowledge documents.
+KNOWLEDGE_DIRECTORY=./knowledge
+
+# Path for the knowledge index file.
+KNOWLEDGE_INDEX_PATH=./knowledge/index.json
+
+# Characters per chunk when indexing knowledge documents.
+KNOWLEDGE_CHUNK_SIZE=500
+
+# Overlap between consecutive chunks (characters).
+KNOWLEDGE_CHUNK_OVERLAP=50
+
+# Maximum chunks retrieved per query.
+KNOWLEDGE_MAX_CHUNKS=3
+
+# --- Concurrency & Timeouts ------------------------------------------------
+
+# Maximum concurrent memory extraction tasks.
+MAX_CONCURRENT_EXTRACTIONS=3
+
+# Maximum concurrent STT transcription tasks.
+MAX_CONCURRENT_STT=3
+
+# Maximum queued audio chunks before backpressure kicks in.
+AUDIO_QUEUE_MAX=20
+
+# Max TTL for in-flight LLM requests before cleanup (ms).
+IN_FLIGHT_MAX_TTL_MS=300000
+
+# LLM stream timeout (ms). Aborts if no data received within this window.
+STREAM_TIMEOUT_MS=120000
+
+# HTTP request timeout for API routes (ms).
+REQUEST_TIMEOUT_MS=30000
+
+# --- Security ---------------------------------------------------------------
+
+# API key authentication (optional: if set, all /api/* and /session/* routes require Bearer token)
+API_KEY=
+
+# CORS allowed origins (comma-separated). Defaults to localhost in dev, same-origin in production.
+CORS_ORIGINS=
+
+# X-Frame-Options: SAMEORIGIN (default) or DENY
+# X_FRAME_OPTIONS=SAMEORIGIN
+
+# --- Rate Limiting ----------------------------------------------------------
+
+# Messages per minute per IP (POST /api/agents/:id/message)
+RATE_LIMIT_MESSAGE=20
+
+# Sessions per minute per IP (GET /session/:agentId — creates billable OpenAI sessions)
+RATE_LIMIT_SESSION=5
+
+# General API requests per minute per IP
+RATE_LIMIT_GENERAL=100
+
+# --- Logging ----------------------------------------------------------------
+
+# Pino log level: trace, debug, info, warn, error, fatal
+LOG_LEVEL=info
+
+# Environment: development (pretty logs, permissive CORS) or production (JSON logs, strict defaults)
+NODE_ENV=development
+
+