Skip to main content

Install

Requires .NET 8+. Compatible with .NET 8 and .NET 9. The package targets net8.0 and above.
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.

Quick start

await using ensures the session is closed even if an exception is thrown.

Client 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.
TimeSpan
default:"TimeSpan.FromSeconds(30)"
HttpClient request timeout. Applied per request. The caller’s CancellationToken takes precedence if it expires sooner.
int
default:"2"
Number of automatic retries on 503 PROVIDER_ERROR. Uses exponential back-off with a 1-second base delay.
Uri
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 from KioskException:

Cancellation token support

Every async method in the SDK accepts an optional CancellationToken. Pass the token from your ASP.NET Core request context to respect client disconnects and timeouts:
Cancelling the token:
  • Cancels any in-flight HTTP or WebSocket request immediately
  • Triggers DisposeAsync on the session, which closes the session server-side
  • Does not leave orphaned sessions — the await using pattern handles cleanup

Never hard-code your credential. Read it from an environment variable: