Skip to Content
Configuration

Configuration

Customize SDK behavior globally using the configuration API. Settings affect all VoiceAgent components and VoiceSessionProvider instances.

Configuration API

setConfig

Update configuration settings. Partial updates are supported.

import { setConfig } from '@vocobase/voice-client-sdk' setConfig({ baseUrl: 'https://custom-api.example.com', debug: true, retry: { maxAttempts: 5 } })

getConfig

Retrieve the current configuration:

import { getConfig } from '@vocobase/voice-client-sdk' const config = getConfig()

resetConfig

Reset all settings to defaults:

import { resetConfig } from '@vocobase/voice-client-sdk' resetConfig()

Configuration Options

interface SDKConfig { baseUrl: string retry: { maxAttempts: number baseDelayMs: number maxDelayMs: number } connection: { timeoutMs: number reconnectAttempts: number } transcript: { maxEntries: number | null } debug: boolean }

Default Values

const defaultConfig = { baseUrl: 'https://api.vocobase.com', retry: { maxAttempts: 3, baseDelayMs: 1000, maxDelayMs: 10000 }, connection: { timeoutMs: 30000, reconnectAttempts: 3 }, transcript: { maxEntries: null }, debug: false }

Environment Variables

VariableOverrides
NEXT_PUBLIC_VOCOBASE_API_URLbaseUrl

Common Configurations

Development

setConfig({ baseUrl: 'http://localhost:3001', debug: true, connection: { timeoutMs: 60000 } })

Production (High Reliability)

setConfig({ retry: { maxAttempts: 5, baseDelayMs: 500 }, connection: { reconnectAttempts: 5 } })

Memory-Constrained (Mobile)

setConfig({ transcript: { maxEntries: 50 } })

When to Configure

Configure the SDK once at app startup, before rendering any Vocobase components:

app/layout.tsx
import { setConfig } from '@vocobase/voice-client-sdk' if (process.env.NODE_ENV === 'development') { setConfig({ baseUrl: 'http://localhost:3001', debug: true }) } export default function RootLayout({ children }) { return <html><body>{children}</body></html> }
Last updated on