Auto-generated C# SDK for Label Studio — open-source data labeling and annotation platform for ML with 30k+ GitHub stars. Supports projects, tasks, annotations, ML backends, webhooks, and storage integrations (S3, GCS, Azure, Redis). OpenAPI spec from the official HumanSignal/label-studio-client-generator Fern definition.
dotnet build LabelStudio.slnx
dotnet test src/tests/IntegrationTests/Tests use Testcontainers with automatic environment detection:
- Debug builds (
dotnet test): Connect to local instance atlocalhost:8080(requiresLABEL_STUDIO_API_KEY) - Release/CI builds (
dotnet test -c Release): Automatically spin upheartexlabs/label-studioDocker container with preset API token (3-minute startup timeout)
Token-based auth (Authorization: Token <api_key>):
var client = new LabelStudioClient(apiKey); // LABEL_STUDIO_API_KEY env varThe SDK converts Bearer auth to Label Studio's Token scheme via a PrepareRequest hook.
src/libs/LabelStudio/openapi.yaml— OpenAPI spec (downloaded from HumanSignal/label-studio-client-generator)src/libs/LabelStudio/generate.sh— Downloads spec, converts apiKey auth to http/bearer, runs autosdksrc/libs/LabelStudio/Generated/— Never edit — auto-generated code (~2695 files)src/libs/LabelStudio/Extensions/LabelStudioClient.Auth.cs— PrepareRequest hook:Bearer → Tokensrc/libs/LabelStudio/Extensions/LabelStudioClient.Tools.cs— MEAI AIFunction toolssrc/tests/IntegrationTests/Environment.cs— Testcontainers setup (Docker in CI, localhost in debug)src/tests/IntegrationTests/Tests.cs— Assembly-level init/cleanupsrc/tests/IntegrationTests/Examples/— Example tests (also generate docs)
Label Studio uses apiKey auth in the spec with Token prefix. The generate.sh converts it to http/bearer for AutoSDK, and PrepareRequest rewrites Bearer → Token at runtime.
The API is organized into sub-clients:
client.Projects2.ListAsync(...)— List labeling projectsclient.Projects2.GetAsync(...)— Get project detailsclient.Projects2.CreateAsync(...)— Create a projectclient.Tasks2.List2Async(...)— List tasks in a projectclient.Tasks2.GetAsync(...)— Get task detailsclient.Annotations.CreateAsync(...)— Create an annotationclient.Annotations.ListAsync(...)— List annotations for a taskclient.Ml.ListAsync(...)— List ML backendsclient.Webhooks.ListAsync(...)— List webhooksclient.StorageS3.*/client.StorageGcs.*/client.StorageAzure.*— Cloud storageclient.Organizations.*— Organization managementclient.Users.*— User managementclient.Export.*— Data exportclient.Import.*— Data importclient.Views.*— Data manager views
AIFunction tools for use with any IChatClient:
AsListProjectsTool()— List labeling projects with search/paginationAsGetProjectTool()— Get project details by IDAsListTasksTool()— List tasks in a projectAsCreateAnnotationTool()— Create an annotation on a task
Default base URL is http://localhost:8000 (Label Studio is typically self-hosted). Set LABEL_STUDIO_BASE_URL env var or pass a custom baseUri to the constructor for different deployments.