Install
net8.0 and above.
Quick start
- Text session
- Streaming session
- Dependency injection
await using ensures the session is closed even if an exception is thrown.Client options
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.HttpClient request timeout. Applied per request. The caller’s CancellationToken
takes precedence if it expires sooner.Number of automatic retries on
503 PROVIDER_ERROR. Uses exponential back-off with
a 1-second base delay.Override the API base URL. Defaults to
https://api.humain.ai. Useful for local
development against a proxy or staging environment.Error handling
The SDK throws typed exceptions derived fromKioskException:
Cancellation token support
Passing CancellationToken to all async methods
Passing CancellationToken to all async methods
Every async method in the SDK accepts an optional Cancelling the token:
CancellationToken. Pass the token
from your ASP.NET Core request context to respect client disconnects and timeouts:- Cancels any in-flight HTTP or WebSocket request immediately
- Triggers
DisposeAsyncon the session, which closes the session server-side - Does not leave orphaned sessions — the
await usingpattern handles cleanup
Multi-turn conversation loop
Multi-turn conversation loop