Skip to content

ResembleAI

Modern .NET SDK for ResembleAI generated from the provider's OpenAPI definition with AutoSDK.

Nuget package dotnet License: MIT Discord

Generated from the source spec

Built from ResembleAI's OpenAPI definition so the SDK stays close to the upstream 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

1
2
3
using ResembleAI;

using var client = new ResembleAIClient(apiKey);

Account overview

Inspect the authenticated account, current team plan, and billing usage.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using var client = new ResembleAIClient(apiKey);

// Load the signed-in account profile.
var account = await client.SubpackageAccount.GetAccountAsync();
var email = account.Item?.Email;

// Load the first team record returned by the account API.
var team = await GetFirstTeamAsync(client);
var teamName = team.Name;
var teamPlan = team.Plan;

// Load the default project to confirm project management responses are typed.
var project = await GetFirstProjectAsync(client);
var projectName = project.Name;
var projectUuid = project.Uuid;

// Inspect current usage buckets reported by the billing endpoint.
var billingUsage = await client.SubpackageAccount.GetBillingUsageAsync();
var synthesisUsage = billingUsage.Items?.Synth;
var detectionUsage = billingUsage.Items?.Detect;

Console.WriteLine($"Email: {email}");
Console.WriteLine($"Team: {teamName} ({teamPlan})");
Console.WriteLine($"Project: {projectName} [{projectUuid}]");
Console.WriteLine($"Usage: synth={synthesisUsage}, detect={detectionUsage}");

List voices

List ready-to-use voices and pick one that supports both sync and streaming TTS.

1
2
3
4
5
6
7
using var client = new ResembleAIClient(apiKey);

// Fetch the first page of available voices from the management API.
var voices = await client.SubpackageVoices.ListVoicesAsync(page: 1, pageSize: 10);
var selectedVoice = await GetReadyVoiceAsync(client);

Console.WriteLine($"Selected voice: {selectedVoice.Name} ({selectedVoice.Uuid})");

Text to speech

Synthesize a short WAV clip and save it to disk using one of the ready voices.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
using var client = new ResembleAIClient(apiKey);
var selectedVoice = await GetReadyVoiceAsync(client);

try
{
    // Synthesize a short clip to WAV audio.
    var response = await client.SubpackageTextToSpeech.SynthesizeAsync(
        voiceUuid: selectedVoice.Uuid,
        data: "Hello from the Resemble AI SDK integration tests.",
        title: "resembleai-sync-sample",
        outputFormat: SynthesizePostRequestBodyContentApplicationJsonSchemaOutputFormat.Wav,
        sampleRate: SynthesizePostRequestBodyContentApplicationJsonSchemaSampleRate.x22050);

    // Persist the decoded audio payload to disk.
    await File.WriteAllBytesAsync("resembleai-sync.wav", response.AudioContent!);
    Console.WriteLine($"Saved {response.AudioContent?.Length ?? 0} bytes using {selectedVoice.Name}.");

}
catch (ApiException ex)
{
    AssertFeatureAvailable(ex, "text-to-speech");
}

Streaming text to speech

Stream a short WAV response and save the resulting bytes to disk.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
using var client = new ResembleAIClient(apiKey);
var selectedVoice = await GetReadyVoiceAsync(client);

try
{
    // Stream synthesized audio as a WAV byte buffer.
    var audioBytes = await client.SubpackageTextToSpeech.StreamSynthesizeAsync(
        voiceUuid: selectedVoice.Uuid,
        data: "This is a streaming text to speech check for the Resemble AI SDK.",
        sampleRate: StreamPostRequestBodyContentApplicationJsonSchemaSampleRate.x22050);

    await File.WriteAllBytesAsync("resembleai-stream.wav", audioBytes);
    Console.WriteLine($"Saved {audioBytes.Length} streamed bytes using {selectedVoice.Name}.");

}
catch (ApiException ex)
{
    AssertFeatureAvailable(ex, "streaming text-to-speech");
}

Speech to text from a file

Upload a local WAV file, poll until the transcript completes, and print the recognized text.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
using var client = new ResembleAIClient(apiKey);
var fixture = GetPrimaryAudioFixture();
var audioBytes = await LoadAudioFixtureAsync(fixture);

try
{
    // Submit a small local WAV file for transcription.
    var createdTranscript = await client.SubpackageSpeechToText.CreateTranscriptAsync(
        file: audioBytes,
        filename: fixture.FileName);

    // Poll the transcript until it reaches a terminal state.
    var transcript = await WaitForTranscriptCompletionAsync(client, createdTranscript.Item!.Uuid!.Value);
    Console.WriteLine(transcript.Item?.Text);

    AssertTranscriptLooksReasonable(transcript.Item?.Text, fixture);
}
catch (ApiException ex)
{
    AssertFeatureAvailable(ex, "speech-to-text");
}

Audio edit

Replace part of a short WAV clip by submitting the original and target transcript text.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
using var client = new ResembleAIClient(apiKey);
var fixture = GetPrimaryAudioFixture();
var selectedVoice = await GetEditableVoiceAsync(client);
var audioBytes = await LoadAudioFixtureAsync(fixture);

try
{
    // Submit an edit request that replaces the spoken text with new content.
    var audioEdit = await client.SubpackageAudioEdit.CreateAudioEditAsync(
        inputAudio: audioBytes,
        inputAudioname: fixture.FileName,
        originalTranscript: fixture.Transcript,
        targetTranscript: fixture.EditedTranscript,
        voiceUuid: selectedVoice.Uuid);

    Console.WriteLine($"Audio edit job: {audioEdit.Item?.Uuid}");

}
catch (ApiException ex)
{
    AssertFeatureAvailable(ex, "audio edit");
}

Support

Bugs

Open an issue in tryAGI/ResembleAI.

Ideas and questions

Use GitHub Discussions for design questions and usage help.

Community

Join the tryAGI Discord for broader discussion across SDKs.

Acknowledgments

JetBrains logo

This project is supported by JetBrains through the Open Source Support Program.