Skip to main content
The Swift SDK wraps the Humain Device API with native Swift async/await and AsyncSequence patterns. It is the only server-side SDK that includes WebRTC voice — all the audio session management is handled inside the SDK without external dependencies. For a complete integration walkthrough — including Xcode setup, SwiftUI examples, microphone permission handling, and AVAudioSession configuration — see the iOS 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

In Xcode: File → Add Package Dependencies and enter:
Or add to Package.swift:

Quick example


KioskClient options

String
required
Your device credential token, hk_live_… (production) or hk_test_… (sandbox). Issue credentials from the Humain admin panel under Kiosk → Credentials → Issue new credential. There is no separate client mode or URL for sandbox — it’s determined entirely by which credential you pass. See Sandbox mode.
TimeInterval
default:"30"
Request 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.

Error types

Error
401 — invalid or revoked credential.
Error
429 — too many requests. The retryAfter value is the minimum wait in seconds.
Error
503 — LLM temporarily unavailable. retryable: true means safe to retry with back-off.
Error
The user denied microphone access. The app should guide the user to Settings to re-enable.
Error
Returned when calling sendMessage() or stream() on a closed session.