tryAGI.AssemblyAI 0.0.0-dev.187

Prefix Reserved
This is a prerelease version of tryAGI.AssemblyAI.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package tryAGI.AssemblyAI --version 0.0.0-dev.187
                    
NuGet\Install-Package tryAGI.AssemblyAI -Version 0.0.0-dev.187
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="tryAGI.AssemblyAI" Version="0.0.0-dev.187" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="tryAGI.AssemblyAI" Version="0.0.0-dev.187" />
                    
Directory.Packages.props
<PackageReference Include="tryAGI.AssemblyAI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add tryAGI.AssemblyAI --version 0.0.0-dev.187
                    
#r "nuget: tryAGI.AssemblyAI, 0.0.0-dev.187"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package tryAGI.AssemblyAI@0.0.0-dev.187
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=tryAGI.AssemblyAI&version=0.0.0-dev.187&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=tryAGI.AssemblyAI&version=0.0.0-dev.187&prerelease
                    
Install as a Cake Tool

AssemblyAI

Nuget package dotnet License: MIT Discord

AssemblyAI has an official .NET SDK available, and we use this SDK primarily to improve the overall experience of our SDK/try to reach/exceed the level of the official one and extend it to all our generated SDKs for other platforms.

Features 🔥

  • Fully generated C# SDK based on official AssemblyAI OpenAPI specification using OpenApiGenerator
  • Same day update to support new features
  • Updated and supported automatically if there are no breaking changes
  • All modern .NET features - nullability, trimming, NativeAOT, etc.
  • Support .Net Framework/.Net Standard 2.0
  • Microsoft.Extensions.AI ISpeechToTextClient support

Usage

using AssemblyAI;

using var api = new AssemblyAIClient(apiKey);

var fileUrl = "https://github.com/AssemblyAI-Community/audio-examples/raw/main/20230607_me_canadian_wildfires.mp3";

//// You can also transcribe a local file by passing in a file path
// var filePath = "./path/to/file.mp3";
// var uploadedFile = await client.Transcript.UploadFileAsync();
// fileUrl = uploadedFile.UploadUrl;

Transcript transcript = await client.Transcript.CreateTranscriptAsync(TranscriptParams.FromUrl(
    fileUrl,
    new TranscriptOptionalParams
    {
        LanguageDetection = true,
        SpeakerLabels = true, // Identify speakers in your audios
        AutoHighlights = true, // Identifying highlights in your audio
    }));

transcript.EnsureStatusCompleted();

Console.WriteLine(transcript);

Microsoft.Extensions.AI

The SDK implements ISpeechToTextClient:

using AssemblyAI;
using Microsoft.Extensions.AI;

ISpeechToTextClient speechClient = new AssemblyAIClient(apiKey);

await using var audioStream = File.OpenRead("recording.wav");
var response = await speechClient.GetTextAsync(audioStream);

Console.WriteLine(response.Text);

Transcribe

using var client = GetAuthenticatedApi();

var fileUrl = "https://github.com/AssemblyAI-Community/audio-examples/raw/main/20230607_me_canadian_wildfires.mp3";

// You can also transcribe a local file by passing in a file path
// var filePath = "./path/to/file.mp3";
// var uploadedFile = await client.Transcript.UploadFileAsync();
// fileUrl = uploadedFile.UploadUrl;

Transcript transcript = await client.Transcript.CreateTranscriptAsync(TranscriptParams.FromUrl(
    fileUrl,
    new TranscriptOptionalParams
    {
        SpeechModels = [],
        LanguageDetection = true,
        SpeakerLabels = true, // Identify speakers in your audios
        AutoHighlights = true, // Identifying highlights in your audio
    }));

transcript.EnsureStatusCompleted();

Console.WriteLine(transcript);

// If you want to summarize the transcript, you can use the Lemur API
// LemurTaskResponse response = await client.LeMUR.LemurTaskAsync(LemurTaskParams.FromPrompt(
//     prompt: "Provide a brief summary of the transcript.",
//     @params: new LemurBaseParams
//     {
//         TranscriptIds = [transcript.Id],
//         FinalModel = LemurModel.AnthropicClaude35Sonnet
//     }));
//
// Console.WriteLine(response.String?.Value1?.Response ?? "No response found.");
// Console.WriteLine($"Input tokens: {response.String?.Value2?.Usage.InputTokens}");
// Console.WriteLine($"Input tokens: {response.String?.Value2?.Usage.OutputTokens}");

Transcribe Live

using var client = GetAuthenticatedApi();

// - You need to have `sox` installed on your system. If not, run:
//   macOS: brew install sox (macOS)
//   Linux: sudo apt-get install sox libsox-fmt-all
//   Windows: manually download and install sox, and add sox to your PATH environment variable.
//            https://sourceforge.net/projects/sox/

// Set up the cancellation token, so we can stop the program with Ctrl+C
var cts = new CancellationTokenSource();
var ct = cts.Token;
Console.CancelKeyPress += (sender, e) => cts.Cancel();

// Set up the realtime transcriber
// await using var transcriber = new RealtimeTranscriber(new RealtimeTranscriberOptions
// {
//     SampleRate = 16_000
// });
//
// transcriber.PartialTranscriptReceived.Subscribe(transcript =>
// {
//     if (transcript.Text == "") return;
//     Console.WriteLine($"Partial transcript: {transcript.Text}");
// });
// transcriber.FinalTranscriptReceived.Subscribe(transcript =>
// {
//     Console.WriteLine($"Final transcript: {transcript.Text}");
// });

//await transcriber.ConnectAsync();

var soxArguments = string.Join(' ', [
    // --default-device doesn't work on Windows
    OperatingSystem.IsWindows() ? "-t waveaudio default" : "--default-device",
    "--no-show-progress",
    "--rate 16000",
    "--channels 1",
    "--encoding signed-integer",
    "--bits 16",
    "--type wav",
    "-" // pipe
]);
Console.WriteLine($"sox {soxArguments}");
using var soxProcess = new Process();
soxProcess.StartInfo = new ProcessStartInfo
{
    FileName = "sox",
    Arguments = soxArguments,
    RedirectStandardOutput = true,
    RedirectStandardError = true,
    UseShellExecute = false,
    CreateNoWindow = true
};

soxProcess.Start();
soxProcess.BeginErrorReadLine();
var soxOutputStream = soxProcess.StandardOutput.BaseStream;
var buffer = new Memory<byte>(new byte[4096]);
while (await soxOutputStream.ReadAsync(buffer, ct) > 0)
{
    if (ct.IsCancellationRequested) break;
    //await transcriber.SendAudioAsync(buffer);
}

soxProcess.Kill();
//await transcriber.CloseAsync();

Support

Priority place for bugs: https://github.com/tryAGI/AssemblyAI/issues
Priority place for ideas and general questions: https://github.com/tryAGI/AssemblyAI/discussions
Discord: https://discord.gg/Ca2xhfBf3v

Acknowledgments

JetBrains logo

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

CodeRabbit logo

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

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.0-dev.191 0 3/20/2026
0.0.0-dev.189 23 3/20/2026
0.0.0-dev.188 19 3/20/2026
0.0.0-dev.187 19 3/20/2026
0.0.0-dev.186 24 3/20/2026
0.0.0-dev.185 23 3/19/2026
0.0.0-dev.184 25 3/19/2026
0.0.0-dev.182 29 3/19/2026
0.0.0-dev.181 25 3/19/2026
0.0.0-dev.180 27 3/19/2026
0.0.0-dev.179 29 3/19/2026
0.0.0-dev.178 32 3/19/2026
0.0.0-dev.176 25 3/19/2026
0.0.0-dev.174 23 3/19/2026
0.0.0-dev.173 31 3/19/2026
0.0.0-dev.172 28 3/19/2026
0.0.0-dev.171 32 3/19/2026
0.0.0-dev.170 27 3/19/2026
0.0.0-dev.169 25 3/19/2026
0.0.0-dev.168 25 3/19/2026
Loading failed