Updated and supported automatically if there are no breaking changes
All modern .NET features - nullability, trimming, NativeAOT, etc.
MEAI AIFunction tools for use with any IChatClient
Usage
1 2 3 4 5 6 7 8 91011121314151617181920212223
usingMurf;usingvarclient=newMurfClient(apiKey);// Generate speech from textvarresponse=awaitclient.SubpackageTextToSpeech.GenerateAsync(text:"Hello, welcome to Murf AI!",voiceId:"en-US-natalie");Console.WriteLine($"Audio URL: {response.AudioFile}");Console.WriteLine($"Duration: {response.AudioLengthInSeconds}s");// List available voicesvarvoices=awaitclient.SubpackageTextToSpeech.GetVoicesAsync();foreach(varvoiceinvoices){Console.WriteLine($"{voice.DisplayName} ({voice.VoiceId}) - {voice.Gender}");}// Translate textvartranslation=awaitclient.SubpackageText.TranslateAsync(targetLanguage:"es-ES",texts:["Hello, how are you?"]);
MEAI Tools
1 2 3 4 5 6 7 8 910111213
usingMurf;usingMicrosoft.Extensions.AI;usingvarmurfClient=newMurfClient(apiKey);// Use Murf TTS as a tool with any IChatClientIChatClientchatClient=/* your preferred chat client */;varresponse=awaitchatClient.GetResponseAsync("Generate speech saying 'Welcome to the future of AI'",newChatOptions{Tools=[murfClient.AsTextToSpeechTool()],});
Text to Speech
Generate natural-sounding speech audio from text using Murf AI.
123456789
usingvarclient=newMurfClient(apiKey);// Generate speech from text using the Murf TTS API.varresponse=awaitclient.SubpackageTextToSpeech.GenerateAsync(text:"Hello, welcome to Murf AI text to speech.",voiceId:"en-US-natalie",format:"MP3");// The response contains a URL to the generated audio file and metadata.
Voices
List available Murf AI voices for speech synthesis.
1234567
usingvarclient=newMurfClient(apiKey);// List available voices for text-to-speech synthesis.varvoices=awaitclient.SubpackageTextToSpeech.GetVoicesAsync(model:"GEN2");// The response contains a list of available voices with metadata.
Translation
Translate text between languages using Murf AI.
12345678
usingvarclient=newMurfClient(apiKey);// Translate text to a target language using the Murf translation API.varresponse=awaitclient.SubpackageText.TranslateAsync(targetLanguage:"es-ES",texts:["Hello, how are you?"]);// The response contains the translated text.