Built from Voicebox's FastAPI OpenAPI schema, with a fallback to the checked-in docs schema, so the SDK tracks the upstream local API surface.
Auto-updated
Designed for fast regeneration and low-friction updates when the upstream API changes without breaking compatibility.
Modern .NET
Targets current .NET practices including nullability, trimming, NativeAOT awareness, and source-generated serialization.
Docs from examples
Examples stay in sync between the README, MkDocs site, and integration tests through the AutoSDK docs pipeline.
Usage
1234
usingVoicebox;usingvarclient=newVoiceboxClient();// or: new VoiceboxClient(baseUri: new Uri("http://127.0.0.1:17493"));
Health
Check a running Voicebox local server.
12345678
varclient=Client;// Check whether the local Voicebox backend is available.// The SDK defaults to http://127.0.0.1:17493, matching the desktop app backend port.varhealth=awaitclient.HealthHealthGetAsync();Console.WriteLine($"Voicebox status: {health.Status}");Console.WriteLine($"Backend: {health.BackendType ?? "unknown"}");
Profiles
List voice profiles configured in Voicebox.
1 2 3 4 5 6 7 8 910
varclient=Client;// List the local Voicebox voice profiles.// Profiles can be cloned voices, preset voices, or designed voices depending on the server setup.varprofiles=awaitclient.ListProfilesProfilesGetAsync();foreach(varprofileinprofiles.Take(5)){Console.WriteLine($"{profile.Id}: {profile.Name} ({profile.Language})");}
Models
Inspect Voicebox model availability and download status.
1 2 3 4 5 6 7 8 910
varclient=Client;// Retrieve the server's model status list without loading a model.// This is useful for checking which local TTS/STT assets are downloaded.varstatus=awaitclient.GetModelStatusModelsStatusGetAsync();foreach(varmodelinstatus.Models.Take(5)){Console.WriteLine($"{model.ModelName}: downloaded={model.Downloaded}, loaded={model.Loaded}");}
Voice Cloning
Create a cloned voice profile from reference audio, then optionally generate TTS with that profile.
varclient=Client;varreferenceAudio=GetReferenceAudio(requireExternalAudio:false);VoiceProfileResponse?profile=null;try{// Create a temporary cloned voice profile.// Set VOICEBOX_REFERENCE_AUDIO_PATH to use a real 2-30 second voice clip; otherwise this test uses a generated WAV only for endpoint coverage.profile=awaitclient.CreateProfileProfilesPostAsync(name:$"tryagi-sdk-e2e-{Guid.NewGuid():N}",description:"Temporary profile created by tryAGI.Voicebox integration tests.",language:TestLanguage,voiceType:"cloned",defaultEngine:TestEngine);// Attach reference voice audio and its transcript to the profile.varsample=awaitclient.AddProfileSampleProfilesProfileIdSamplesPostAsync(profileId:profile.Id,file:referenceAudio.Bytes,filename:referenceAudio.Filename,referenceText:referenceAudio.ReferenceText);// Read the sample list back through the API and update the transcript.varsamples=awaitclient.GetProfileSamplesProfilesProfileIdSamplesGetAsync(profile.Id);varupdatedReferenceText=$"{TestReferenceText} Updated.";varupdatedSample=awaitclient.UpdateProfileSampleProfilesSamplesSampleIdPutAsync(sampleId:sample.Id,referenceText:updatedReferenceText);// Download the stored sample audio to verify the binary audio endpoint.varsampleAudio=awaitDownloadAudioAsync($"samples/{sample.Id}");}finally{awaitTryDeleteProfileAsync(profile?.Id);}
Voice Cloning TTS
Generate speech from a cloned voice profile created at test time.
if(!bool.TryParse(GetOptionalEnvironmentVariable("VOICEBOX_RUN_TTS_E2E"),outvarrunE2E)||!runE2E){thrownewAssertInconclusiveException("Set VOICEBOX_RUN_TTS_E2E=true and VOICEBOX_REFERENCE_AUDIO_PATH to run the full voice cloning TTS test.");}varclient=Client;varclonedVoice=awaitCreateClonedVoiceProfileAsync(requireExternalAudio:true);GenerationResponse?generation=null;try{// Generate speech using the newly-created cloned profile.// VOICEBOX_LANGUAGE defaults to ru, VOICEBOX_ENGINE defaults to qwen, and VOICEBOX_MODEL_SIZE defaults to 0.6B for faster local validation.generation=awaitclient.GenerateSpeechGeneratePostAsync(newGenerationRequest{ProfileId=clonedVoice.Profile.Id,Text=TestGeneratedText,Language=TestLanguage,Engine=TestEngine,ModelSize=TestModelSize,Seed=1,Normalize=true,MaxChunkChars=300,});// Voicebox generates asynchronously, so poll history until completion and then download the produced audio.varcompleted=awaitWaitForGenerationAsync(generation.Id);varaudio=awaitDownloadAudioAsync($"audio/{generation.Id}");}finally{awaitTryDeleteGenerationAsync(generation?.Id);awaitTryDeleteProfileAsync(clonedVoice.Profile.Id);}
Generate Speech
Generate speech from text using an existing Voicebox profile.
1 2 3 4 5 6 7 8 91011121314151617
varclient=Client;varprofileId=GetRequiredEnvironmentVariable("VOICEBOX_PROFILE_ID");// Generate speech from text with an existing voice profile.// Set VOICEBOX_PROFILE_ID to the profile ID from your local Voicebox instance.vargeneration=awaitclient.GenerateSpeechGeneratePostAsync(newGenerationRequest{ProfileId=profileId,Text="Voicebox is running locally from a generated .NET SDK.",Language=GetOptionalEnvironmentVariable("VOICEBOX_LANGUAGE")??"en",Engine=GetOptionalEnvironmentVariable("VOICEBOX_ENGINE")??"qwen",ModelSize=GetOptionalEnvironmentVariable("VOICEBOX_MODEL_SIZE")??"1.7B",});Console.WriteLine($"Generated speech: {generation.Id}");