Skip to main content
The Kotlin SDK wraps the Humain Device API with coroutine-native suspend functions and Kotlin Flow for streaming. It is the only server-side SDK that includes WebRTC voice — audio capture, WebRTC negotiation, and VAD are all handled inside the SDK. For a complete integration walkthrough — including Gradle setup, Compose ViewModel examples, runtime permission handling, and AudioManager configuration — see the Android guide.
During development, initialise the client with an hk_test_… sandbox credential instead of hk_live_…. There is no separate sandbox mode or URL — sandbox behavior comes entirely from the credential prefix. No AI credits are consumed and no usage is billed. See Sandbox mode.

Install

Add permissions to AndroidManifest.xml:

Quick example


KioskConfig fields

String
required
Your device credential token in hk_live_… format. Store in BuildConfig (injected from local.properties) — never commit to source control.
KioskConfig.Mode
default:"Mode.LIVE"
Mode.SANDBOX returns instant stub responses without consuming AI credits. Use Mode.LIVE for production.
Long
default:"30"
OkHttp call timeout in seconds. Applied to the session open call and each sendMessage() call.
Int
default:"2"
Number of automatic retries on provider errors (503). Uses exponential back-off starting at 1 second.
String
default:"\"https://api.humain.ai\""
Override the API base URL. Useful for testing against a local proxy or staging environment.

Exception types

KioskException
401 — invalid or revoked credential.
KioskException
429 — too many requests. Check retryAfterSeconds for the minimum wait time.
KioskException
503 — LLM temporarily unavailable. Check isRetryable before retrying.
KioskException
RECORD_AUDIO permission was not granted before calling openVoiceSession(). Request the permission in your Activity or Composable before starting a voice session.
KioskException
Thrown when calling sendMessage() or stream() on a session that has been closed.