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.

fix(voice): pass agentId to the ElevenLabs proxy so owner-cloned voices work everywhere

nirholas36032dcf6ad0
diff --git a/src/agent-copilot.js b/src/agent-copilot.js
index 6e9df3882..a1a2242c3 100644
--- a/src/agent-copilot.js
+++ b/src/agent-copilot.js
@@ -919,7 +919,11 @@ export function mountTradingCopilot({ panel, agentId, agentName = 'Copilot', isO
try {
let resp;
if (cfg.provider === 'elevenlabs' && cfg.voiceId) {
- resp = await fetch('/api/tts/eleven', { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ voiceId: cfg.voiceId, text: clean }) });
+ // agentId names the agent whose voice this is, so the proxy can
+ // serve the clip on its owner's saved ElevenLabs key (BYOK). Without
+ // it an owner-cloned voice is unreachable here and silently degrades
+ // to browser speech.
+ resp = await fetch('/api/tts/eleven', { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ voiceId: cfg.voiceId, text: clean, agentId }) });
} else {
resp = await fetch('/api/tts/speak', { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text: clean, format: 'mp3' }) });
}
diff --git a/src/alpha-copilot.js b/src/alpha-copilot.js
index 05a659bc9..034896163 100644
--- a/src/alpha-copilot.js
+++ b/src/alpha-copilot.js
@@ -523,7 +523,10 @@ async function fetchTtsBlob(agent, text) {
const headers = { 'content-type': 'application/json' };
try {
if (provider === 'elevenlabs' && agent?.voice_id) {
- const r = await fetch('/api/tts/eleven', { method: 'POST', credentials: 'include', headers, body: JSON.stringify({ voiceId: agent.voice_id, text: text.slice(0, 500) }) });
+ // agentId lets the proxy serve the clip on the agent owner's saved
+ // ElevenLabs key (BYOK); without it an owner-cloned voice is
+ // unreachable on this surface.
+ const r = await fetch('/api/tts/eleven', { method: 'POST', credentials: 'include', headers, body: JSON.stringify({ voiceId: agent.voice_id, text: text.slice(0, 500), agentId: agent.id }) });
if (r.ok) return await r.blob();
}
// Default + cloned-but-non-eleven providers: the server's free TTS lane.
diff --git a/src/analytics.js b/src/analytics.js
index 6c3a8d42d..a6a68fb5c 100644
--- a/src/analytics.js
+++ b/src/analytics.js
@@ -38,6 +38,8 @@ export const ANALYTICS_EVENTS = Object.freeze({
WALLET_CONNECT_FAILED: 'wallet_connect_failed',
/** An agent was created. props: { agent_id?, source? } */
AGENT_CREATED: 'agent_created',
+ /** A recorded voice sample was cloned onto the agent. props: { agent_id?, billing?, source? } */
+ VOICE_CLONE_BOUND: 'agent_voice_clone_bound',
/** First embed/snippet generated for an agent. props: { agent_id?, embed_kind? } */
EMBED_GENERATED: 'embed_generated',