This example assumes using RevAI; is in scope and apiKey contains your RevAI API key.
1 2 3 4 5 6 7 8 9101112131415161718192021222324
varapiKey=Environment.GetEnvironmentVariable("REVAI_API_KEY")is{Length:>0}value?value:thrownewAssertInconclusiveException("REVAI_API_KEY environment variable is not found.");usingvarclient=newRevAIClient(apiKey);ISpeechToTextClientsttClient=client;// Provide an audio URL via RawRepresentationFactory.varoptions=newSpeechToTextOptions{SpeechLanguage="en",RawRepresentationFactory=_=>newSubmitTranscriptionJobRequest{MediaUrl="https://www.rev.ai/FTC_Sample_1.mp3",},};// Get the transcription result.varresponse=awaitsttClient.GetTextAsync(audioSpeechStream:Stream.Null,options:options);Console.WriteLine($"Transcript: {response.Text[..Math.Min(200, response.Text.Length)]}...");