initializeForServer

fun initializeForServer(apiKey: String, context: Any? = null, debugLogging: Boolean = false, preload: Set<AIModel> = AIModels.DEFAULT)

Initialize SDK with API key for server-side, desktop, or non-mobile environments.

Use this method for:

  • Server-side audio processing

  • Desktop applications

  • Python bindings

  • CLI tools

  • Automated testing

For mobile apps: Use initialize with proxyEndpoint or initializeWithAttestation instead, as they provide better security for mobile deployments.

Validates the API key synchronously with the server (10 second timeout). This ensures invalid or revoked keys are rejected at initialization.

// Server-side Kotlin
try {
VT.initializeForServer(
apiKey = "sk_live_abc123...",
debugLogging = true,
preload = setOf(AIModels.Pitch.REALTIME)
)
} catch (e: VoxaTraceKilledException) {
println("License error: ${e.message}")
}

Parameters

apiKey

Your VoxaTrace API key (starts with "sk_live_" or "sk_test_")

context

Platform context (optional, null for server-side)

debugLogging

Enable debug logging output (default: false)

preload

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

Throws

if API key is invalid or revoked (401/403)