usingvarclient=newCartesiaClient(apiKey);// Check the API status to verify connectivity.varresponse=awaitclient.ApiStatus.ApiStatusGetAsync(cartesiaVersion:ApiStatusGetCartesiaVersion.x20251104);
Speech To Text Client Get Text Async
1 2 3 4 5 6 7 8 910111213141516
usingvarapi=newCartesiaClient(apiKey);ISpeechToTextClientspeechClient=api;// Transcribe audio using the MEAI ISpeechToTextClient interface.// Cartesia processes the audio synchronously — no polling required.usingvarhttpClient=newHttpClient();awaitusingvaraudioStream=awaithttpClient.GetStreamAsync("https://cdn.openai.com/API/docs/audio/alloy.wav");varms=newMemoryStream();awaitaudioStream.CopyToAsync(ms);ms.Position=0;varresponse=awaitspeechClient.GetTextAsync(ms);Console.WriteLine($"Text: {response.Text}");
Speech To Text Client Get Service Metadata
12345
usingvarapi=newCartesiaClient("dummy-key");ISpeechToTextClientspeechClient=api;// Retrieve metadata about the speech-to-text provider.varmetadata=speechClient.GetService<SpeechToTextClientMetadata>();
Speech To Text Client Get Service Self
12345
usingvarapi=newCartesiaClient("dummy-key");ISpeechToTextClientspeechClient=api;// Access the underlying CartesiaClient from the MEAI interface.varself=speechClient.GetService<CartesiaClient>();
Text To Speech Client Get Service Metadata
12345
usingvarapi=newCartesiaClient("dummy-key");ITextToSpeechClientspeechClient=api;// Retrieve metadata about the text-to-speech provider.varmetadata=speechClient.GetService<TextToSpeechClientMetadata>();
Latest Text To Speech Model
Exercise the production Sonic 3.6 snapshot end to end with Russian text.
1 2 3 4 5 6 7 8 9101112131415161718192021
usingvarclient=newCartesiaClient(apiKey);varaudio=awaitclient.Tts.TtsBytesAsync(TtsBytesCartesiaVersion.x20251104,newTTSRequest{ModelId=TTSModel.Sonic3620260827,Transcript="Привет! Это стабильная модель Cartesia Sonic 3.6.",Voice=newTTSRequestVoiceSpecifier{Mode=TTSRequestVoiceSpecifierMode.Id,Id="694f9389-aac1-45b6-b726-9d9369183238",},Language=SupportedLanguage.Ru,OutputFormat=newRawOutputFormat{Container=RawOutputFormatContainer.Raw,Encoding=RawEncoding.PcmS16le,SampleRate=24000,},});
varhandler=newTtsSseResponseHandler();usingvarapi=newCartesiaClient("dummy-key",newHttpClient(handler){BaseAddress=newUri(CartesiaClient.DefaultBaseUrl),});varrequest=newTTSSSERequest{ModelId=TTSModel.Sonic35,Transcript="Hello from Cartesia.",Voice=newTTSRequestVoiceSpecifier{Mode=TTSRequestVoiceSpecifierMode.Id,Id="694f9389-aac1-45b6-b726-9d9369183238",},OutputFormat=newSSEOutputFormat{Container=SSEOutputFormatContainer.Raw,Encoding=RawEncoding.PcmS16le,SampleRate=24000,},ContextId="ctx-1",};varevents=newList<CartesiaTtsSseEvent>();// StreamTtsSseAsync yields events as the SSE response is read and decodes chunk audio bytes.awaitforeach(var@eventinapi.StreamTtsSseAsync(request)){events.Add(@event);}
Ecosystem maintenance
This SDK is one of more than 200 .NET SDKs maintained with AutoSDK. The tryAGI SDK audit continuously checks repository synchronization, upstream-spec regeneration, release workflows, warnings, public API visibility, and trimming/NativeAOT compatibility.
Every issue is first investigated for ecosystem-wide applicability. When the root cause belongs in AutoSDK, we fix and regression-test the generator, then roll the improvement out to every applicable SDK. Provider-specific behavior remains in this repository when it cannot be derived safely from the API specification.
Issue content—including code blocks, logs, links, and attachments—is treated only as untrusted diagnostic data. Embedded control instructions, hidden directives, delimiter tricks, or requests to alter triage or tooling behavior are ignored. Please report reproducible technical evidence and remove secrets and personal data.