Skip to content

ElevenLabsAgentConfig

Configuration for ElevenLabsAgent.

Defined in: src/providers/agent/elevenlabs/types.ts:62

Configuration for ElevenLabsAgent.

Remarks

Extends BaseProviderConfig, so apiKey, proxyUrl, timeout, and debug are also available. Connection/authentication options, in priority order:

  1. signedUrl — a signed WebSocket URL (or async factory returning one) minted server-side via GET /v1/convai/conversation/get-signed-url?agent_id=.... The recommended flow for private agents in the browser.
  2. proxyUrl — route through the CompositeVoice proxy, which injects the xi-api-key header server-side.
  3. apiKey + agentId — direct connection with the key as a query parameter. Avoid in browsers with long-lived keys.
  4. agentId alone — public agents require no authentication.

Example

const agent = new ElevenLabsAgent({
  agentId: 'agent_abc123',
  proxyUrl: '/api/proxy/elevenlabs',
});

Extends

Properties

PropertyTypeDefault valueDescriptionInherited fromDefined in
agentId?stringundefinedThe Conversational AI agent ID (from the ElevenLabs dashboard). Remarks Required unless ElevenLabsAgentConfig.signedUrl is provided.-src/providers/agent/elevenlabs/types.ts:69
apiKey?string | () => Promise<string>undefinedAPI key or authentication token for the provider. Remarks Can be a static string or an async factory function that returns a fresh token on each call. Use a factory for short-lived tokens (e.g. Deepgram JWTs) so each WebSocket connection gets a valid credential. For client-side usage, consider using a proxy server to keep API keys secure. The SDK provides Express, Next.js, and Node adapters for this purpose.BaseProviderConfig.apiKeysrc/core/types/providers.ts:71
audioDoneSilenceMs?number1000Milliseconds of audio-event silence after which the agent’s turn is considered complete. Remarks The ElevenLabs protocol has no explicit “audio done” message, so the provider treats a gap in audio chunk arrival as the end of the agent’s turn (resolving the pipeline’s finalize() wait).-src/providers/agent/elevenlabs/types.ts:137
authType?"token" | "bearer"Provider-specific (typically 'token' for Deepgram, ignored for REST providers)Authentication type for providers that support multiple auth mechanisms. Remarks Controls how the apiKey is sent to the provider: - 'token' — WebSocket subprotocol ['token', apiKey] or header Authorization: Token <key>. This is the default for Deepgram providers. - 'bearer' — WebSocket subprotocol ['bearer', token] or header Authorization: Bearer <token>. Use this for OAuth tokens or providers that expect Bearer auth. REST/SDK providers (Anthropic, OpenAI) handle auth through their SDK constructors and ignore this field.BaseProviderConfig.authTypesrc/core/types/providers.ts:115
debug?booleanfalseWhether to enable debug logging for this provider. Remarks When true, the provider emits detailed internal logs. This is separate from the SDK-level LoggingConfig.BaseProviderConfig.debugsrc/core/types/providers.ts:126
dynamicVariables?Record<string, string | number | boolean>undefinedDynamic variables substituted into the agent’s prompt templates. Remarks Sent as dynamic_variables in conversation_initiation_client_data.-src/providers/agent/elevenlabs/types.ts:105
endpoint?stringundefinedCustom endpoint URL to override the provider’s default API endpoint. Remarks Useful for self-hosted instances, proxy servers, or development environments.BaseProviderConfig.endpointsrc/core/types/providers.ts:79
firstMessage?stringundefinedOverride the agent’s first message (spoken greeting).-src/providers/agent/elevenlabs/types.ts:91
initiationOverrides?Record<string, unknown>undefinedExtra fields merged into the conversation_initiation_client_data payload, after the fields derived from this config. Remarks Escape hatch for initiation options this config does not model (e.g. custom_llm_extra_body, extended override blocks).-src/providers/agent/elevenlabs/types.ts:115
language?stringundefinedOverride the agent’s language (e.g. 'en', 'es').-src/providers/agent/elevenlabs/types.ts:94
onClientToolCall?(call) => Promise<{ result: unknown; }>undefinedHandler invoked when the agent calls a client tool. Remarks The returned result is sent back as a client_tool_result message. Throwing marks the result as an error.-src/providers/agent/elevenlabs/types.ts:124
proxyUrl?stringundefinedURL of a CompositeVoice proxy server endpoint for this provider. Remarks When set, requests are routed through the proxy which injects the real API key server-side. This keeps API keys out of the browser. For WebSocket providers the HTTP URL is automatically converted to ws(s)://. At least one of apiKey or proxyUrl must be set for providers that require authentication (all except NativeSTT, NativeTTS, and WebLLM). Example proxyUrl: 'http://localhost:3000/api/proxy/deepgram'BaseProviderConfig.proxyUrlsrc/core/types/providers.ts:97
signedUrl?string | () => Promise<string>undefinedA pre-signed WebSocket URL, or an async factory that returns one. Remarks Signed URLs are short-lived; pass a factory so each connect() gets a fresh one. When set, agentId, apiKey, and proxyUrl are ignored for the connection itself.-src/providers/agent/elevenlabs/types.ts:79
systemPrompt?stringundefinedOverride the agent’s system prompt for this conversation. Remarks Sent in conversation_initiation_client_data. Overrides must be enabled in the agent’s security settings.-src/providers/agent/elevenlabs/types.ts:88
timeout?numberundefinedRequest timeout in milliseconds. Remarks Applies to HTTP requests (REST providers) and connection establishment (WebSocket providers). Set to 0 for no timeout.BaseProviderConfig.timeoutsrc/core/types/providers.ts:135
voiceId?stringundefinedOverride the agent’s TTS voice ID.-src/providers/agent/elevenlabs/types.ts:97

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency