Skip to content

Getting started

Install the package and ask your first System One question.

Terminal window
dotnet add package TypeSafe.AI.Sdk

Targets net10.0 and netstandard2.0. Building the library itself requires the .NET 10 SDK.

Set TYPESAFE_API_KEY in your environment, or pass apiKey / TypeSafeClientOptions.ApiKey explicitly.

Terminal window
export TYPESAFE_API_KEY=tsk_...
using TypeSafe.AI.Sdk;
using var client = new TypeSafeClient();
var response = await client.SystemOneAsync(
new { document = "I was charged twice. Please fix this ASAP." },
("category", Question.Choice("What is this ticket about?",
("billing", null),
("technical", null),
("other", null))));
Console.WriteLine(response.GetChoice("category").Choice);

That mirrors the JavaScript quickstart. Batch independent questions in one SystemOneAsync call.

Terminal window
export TYPESAFE_API_KEY=tsk_...
dotnet run --project samples/TypeSafe.AI.Sdk.Sample

MIT · Copyright (c) Dario Kondratiuk. · not affiliated with TypeSafe beyond being a client of the public API