initialize

fun initialize(proxyEndpoint: String, context: Any? = null, debugLogging: Boolean = false, preload: Set<AIModel> = AIModels.DEFAULT, proxyAuthProvider: () -> String?? = null)

Initialize SDK with proxy endpoint for secure production deployment.

This is the recommended initialization method for production apps. Your API key stays secure on your server, and the SDK receives a device-specific token for telemetry.

Device token lifecycle:

  • Tokens expire after 30 days

  • SDK automatically refreshes tokens when < 7 days remaining

  • 7-day grace period allows continued operation during refresh

  • Fully transparent to app developers - no action required

// Android
try {
VT.initialize(
proxyEndpoint = "https://your-server.com/voxatrace/register",
context = this,
debugLogging = BuildConfig.DEBUG,
preload = setOf(AIModels.Pitch.REALTIME, AIModels.VAD.SPEECH)
)
} catch (e: VoxaTraceKilledException) {
// License error - disable audio features
showError("License error: ${e.message}")
}

Your proxy server implementation:

POST /voxatrace/register
Request: { "device_id": "sha256_hash" }
Response: { "device_token": "dt_xxx", "expires_at": 1735689600 }

Proxy should:
1. Verify user is authenticated (your auth system)
2. POST to https://api.musicmuni.com/v1/voxatrace/devices/register
with Authorization: Bearer sk_live_xxx
3. Forward response to SDK

Parameters

proxyEndpoint

Your proxy server's device registration endpoint

context

Android Context (required on Android, ignored on iOS)

debugLogging

Enable debug logging output (default: false)

preload

AI models to download at initialization (default: AIModels.DEFAULT)

proxyAuthProvider

Optional function that returns an Authorization header value (e.g., "Bearer eyJhbG...") for proxy requests. Called on each proxy request so the token can be refreshed. If null, no Authorization header is sent.

Throws

if registration fails or license is invalid