Skip to content

Cartesia

Nuget package dotnet License: MIT Discord

Features 🔥

  • Fully generated C# SDK based on official Cartesia OpenAPI specification using AutoSDK
  • 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

Usage

1
2
3
using Cartesia;

using var client = new CartesiaClient(apiKey);

Check API Status

Check the Cartesia API status.

1
2
3
4
5
using var client = new CartesiaClient(apiKey);

// Check the API status to verify connectivity.
var response = await client.ApiStatus.ApiStatusGetAsync(
    cartesiaVersion: ApiStatusGetCartesiaVersion.x20250416);

Speech To Text Client Get Text Async

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
using var api = new CartesiaClient(apiKey);
ISpeechToTextClient speechClient = api;

// Transcribe audio using the MEAI ISpeechToTextClient interface.
// Cartesia processes the audio synchronously — no polling required.
using var httpClient = new HttpClient();
await using var audioStream = await httpClient.GetStreamAsync(
    "https://cdn.openai.com/API/docs/audio/alloy.wav");

var ms = new MemoryStream();
await audioStream.CopyToAsync(ms);
ms.Position = 0;

var response = await speechClient.GetTextAsync(ms);

Console.WriteLine($"Text: {response.Text}");

Speech To Text Client Get Service Metadata

1
2
3
4
5
using var api = new CartesiaClient("dummy-key");
ISpeechToTextClient speechClient = api;

// Retrieve metadata about the speech-to-text provider.
var metadata = speechClient.GetService<SpeechToTextClientMetadata>();

Speech To Text Client Get Service Self

1
2
3
4
5
using var api = new CartesiaClient("dummy-key");
ISpeechToTextClient speechClient = api;

// Access the underlying CartesiaClient from the MEAI interface.
var self = speechClient.GetService<CartesiaClient>();

Support

Priority place for bugs: https://github.com/tryAGI/Cartesia/issues
Priority place for ideas and general questions: https://github.com/tryAGI/Cartesia/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.