Skip to content

Soniox

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

Nuget package dotnet License: MIT Discord

Generated from the source spec

Built from Soniox'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 Soniox;

using var client = new SonioxClient(apiKey);

Construct a SonioxClient

Basic example showing how to create an authenticated Soniox client. The SONIOX_API_KEY environment variable holds the API key issued by the Soniox Console.

1
using var client = new SonioxClient(apiKey);

List models

Fetches the list of Soniox speech-to-text models available to your workspace, including supported languages and transcription mode (async / real-time).

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

var response = await client.Models.GetModelsAsync();

foreach (var model in response.Models)
{
}

Transcribe from URL (async)

Submits a Soniox async transcription job for a public audio URL and polls until it completes. Uses the stt-async-preview model.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
using var client = new SonioxClient(apiKey);

var created = await client.Transcriptions.CreateTranscriptionAsync(
    model: SonioxClient.DefaultAsyncModel,
    audioUrl: "https://soniox.com/media/examples/coffee_shop.mp3");

// Poll until the job reaches a terminal state.
while (created.Status is TranscriptionStatus.Queued or TranscriptionStatus.Processing)
{
    await Task.Delay(1000);
    created = await client.Transcriptions.GetTranscriptionAsync(created.Id);
}

var transcript = await client.Transcriptions.GetTranscriptionTranscriptAsync(created.Id);

// Clean up to keep the workspace tidy.
await client.Transcriptions.DeleteTranscriptionAsync(created.Id);

MEAI ISpeechToTextClient

SonioxClient implements Microsoft.Extensions.AI.ISpeechToTextClient, so the same call site works with Soniox, Deepgram, Gladia, or any other MEAI STT provider.

Non-streaming calls upload the audio to /v1/files, create a transcription job on /v1/transcriptions, and poll until the job completes. Streaming calls open a WebSocket to wss://stt-rt.soniox.com/transcribe-websocket.

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

// SonioxClient implements Meai.ISpeechToTextClient directly.
Meai.ISpeechToTextClient speechClient = client;

// Metadata is exposed via ISpeechToTextClient.GetService.
var metadata = speechClient.GetService(typeof(Meai.SpeechToTextClientMetadata))
    as Meai.SpeechToTextClientMetadata;

MEAI AIFunction tools

Using Soniox endpoints as AIFunction tools with any Microsoft.Extensions.AI IChatClient.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
using var client = new SonioxClient(apiKey);

// Create AIFunction tools from the Soniox client.
var transcribeTool = client.AsTranscribeTool();
var getTool = client.AsGetTranscriptionTool();
var listModelsTool = client.AsListModelsTool();
var listLanguagesTool = client.AsListLanguagesTool();
var tempKeyTool = client.AsCreateTemporaryApiKeyTool();

// Verify all tools are created with the expected names.

// These tools can be passed to any IChatClient for function calling.
var tools = new[] { transcribeTool, getTool, listModelsTool, listLanguagesTool, tempKeyTool };

Support

Bugs

Open an issue in tryAGI/Soniox.

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.