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

oversteppingc889ea967a37
diff --git a/xspace-agent/xspace-agent/.env.example b/xspace-agent/xspace-agent/.env.example
new file mode 100644
index 000000000..206da4411
--- /dev/null
+++ b/xspace-agent/xspace-agent/.env.example
@@ -0,0 +1,216 @@
+# ============================================================================
+# agent-space — Root Environment Configuration
+# ============================================================================
+# Copy this file to .env and fill in your values.
+# This covers both the root server (src/server/) and packages/server.
+#
+# Quick-start examples:
+#
+# Cheapest (Groq LLM + browser TTS):
+# AI_PROVIDER=groq
+# GROQ_API_KEY=gsk_...
+# TTS_PROVIDER=browser
+#
+# Best quality (OpenAI Realtime — single key does LLM + STT + TTS):
+# AI_PROVIDER=openai
+# OPENAI_API_KEY=sk-...
+#
+# Claude + ElevenLabs voices:
+# AI_PROVIDER=claude
+# ANTHROPIC_API_KEY=sk-ant-...
+# STT_PROVIDER=groq
+# GROQ_API_KEY=gsk_...
+# TTS_PROVIDER=elevenlabs
+# ELEVENLABS_API_KEY=...
+#
+# ============================================================================
+
+# ── X / Twitter Authentication ──────────────────────────────────────────────
+# Required for X Spaces integration. Two options:
+#
+# Option A (recommended): Copy auth_token and ct0 cookies from your browser.
+# Open x.com → DevTools → Application → Cookies → copy auth_token & ct0.
+#
+# Option B: Username + password login (may trigger 2FA or CAPTCHAs).
+#
+# If both are set, token-based auth is tried first.
+
+# Option A — cookie-based auth (recommended)
+X_AUTH_TOKEN=
+X_CT0=
+
+# Option B — credential-based auth
+X_USERNAME=
+X_PASSWORD=
+
+# Email used during X's verification step (falls back to X_USERNAME if empty)
+X_EMAIL=
+
+# ── X Spaces Integration ────────────────────────────────────────────────────
+
+# Set to "true" to enable the X Spaces module (requires auth above).
+# X_SPACES_ENABLED=false
+
+# Auto-join this Space URL on startup (optional).
+# X_SPACE_URL=
+
+# ── Browser Mode ────────────────────────────────────────────────────────────
+# Controls how the agent connects to a browser.
+#
+# "managed" (default) — Agent launches its own headless Chrome with Puppeteer.
+# Requires X authentication (tokens, username/password).
+#
+# "connect" — Agent connects to an already-running Chrome via Chrome DevTools
+# Protocol (CDP). Requires NO authentication since you're already
+# logged in to x.com in that Chrome window. Recommended for development.
+#
+# To use connect mode:
+# 1. Launch Chrome: google-chrome --remote-debugging-port=9222
+# 2. Log into x.com manually in that Chrome
+# 3. Set BROWSER_MODE=connect in your .env
+# 4. Run the agent (it will auto-discover the CDP endpoint on localhost:9222)
+
+BROWSER_MODE=managed
+
+# ── CDP Connection (for BROWSER_MODE=connect) ────────────────────────────────
+# Only needed if BROWSER_MODE=connect. Auto-discovered if omitted.
+
+# Full WebSocket URL for CDP connection. If not set, auto-discovered from host:port.
+# Example: ws://localhost:9222/devtools/browser/a1b2c3d4-5678-90ab-cdef-1234567890ab
+# CDP_ENDPOINT=
+
+# CDP host for auto-discovery (default: localhost).
+# CDP_HOST=localhost
+
+# CDP port for auto-discovery (default: 9222).
+# CDP_PORT=9222
+
+# ── 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
+
+# Override the default model for each provider (optional).
+# OPENAI_MODEL=gpt-4o-mini
+# OPENAI_REALTIME_MODEL=gpt-4o-realtime-preview-2024-12-17
+# CLAUDE_MODEL=claude-sonnet-4-20250514
+# GROQ_MODEL=llama-3.3-70b-versatile
+
+# Model override used by packages/server (optional, provider-specific).
+# AI_MODEL=
+
+# Custom system prompt — replaces the built-in agent personality (optional).
+# SYSTEM_PROMPT=You are a helpful AI assistant.
+
+# Maximum tokens in AI response (packages/server only, default: 300).
+# MAX_TOKENS=300
+
+# ── API Keys ────────────────────────────────────────────────────────────────
+# Only the key(s) 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 — 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 to spoken audio. Only used with socket-based providers.
+#
+# "openai" — OpenAI TTS API (good quality, requires OPENAI_API_KEY)
+# "elevenlabs" — ElevenLabs API (best quality, requires ELEVENLABS_API_KEY)
+# "browser" — Browser's built-in speech synthesis (free, lower quality)
+#
+# Auto-detected if not set: elevenlabs (if key present) > openai (if key present) > browser.
+TTS_PROVIDER=openai
+
+# ElevenLabs voice IDs — override defaults per agent (optional).
+# Find voices: https://elevenlabs.io/voice-library
+# ELEVENLABS_VOICE_0=VR6AewLTigWG4xSOukaG
+# ELEVENLABS_VOICE_1=TxGEqnHWrfWFTfGW9XjX
+
+# Voice ID used by packages/server (optional).
+# VOICE_ID=
+
+# ── Security ──────────────────────────────────────────────────────────────────
+# These settings secure the admin panel, API, and stored credentials.
+
+# Required: API key for admin panel and Socket.IO authentication.
+# Generate with: openssl rand -hex 32
+ADMIN_API_KEY=
+
+# Comma-separated list of allowed CORS origins (default: http://localhost:3000).
+# CORS_ORIGINS=http://localhost:3000,https://yourdomain.com
+
+# Encryption key for cookies stored on disk. If not set, cookies are stored
+# in plain text (less secure). Generate with: openssl rand -hex 32
+# COOKIE_ENCRYPTION_KEY=
+
+# Rate limiting (per IP). Defaults: 100 requests per 60 seconds.
+# RATE_LIMIT_MAX=100
+# RATE_LIMIT_WINDOW_MS=60000
+
+# ── Server ───────────────────────────────────────────────────────────────────
+
+# Port the server listens on (default: 3000).
+PORT=3000
+
+# Run browser in headless mode (packages/server). Set to "false" to show browser.
+# HEADLESS=true
+
+# ── Branding & UI ───────────────────────────────────────────────────────────
+
+# Display name shown in the UI header.
+PROJECT_NAME=AI Agents
+
+# Custom avatar image URLs for agents (optional).
+# AVATAR_URL_1=
+# AVATAR_URL_2=
+
+# Enable text input box in the UI. Set to "false" for voice-only mode.
+# INPUT_CHAT=true
+
+# Enable live chat feature. Set to "false" to disable.
+# LIVE_CHAT=true
+
+# ── Project / Token Info ────────────────────────────────────────────────────
+# Optional metadata displayed in the UI and shared by agents when asked.
+
+# CONTRACT=
+# CONTRACT_ADDRESS=
+# TOKEN_CHAIN=Solana
+# BUY_LINK=
+# WEBSITE=
+# WEBSITE_LINK=
+# TEAM=
+
+# ── Links ───────────────────────────────────────────────────────────────────
+
+# Community / social links shown in the UI.
+# X_COMMUNITY_LINK=https://x.com
+# X_LINK=https://x.com
+# GITHUB_LINK=https://github.com
+
+