### Install ElevenLabs-DotNet-Proxy NuGet Package Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/ElevenLabs-DotNet-Proxy/Readme.md Installs the ElevenLabs-DotNet-Proxy package using the NuGet Package Manager via the command line. This is the first step to integrate the proxy into your .NET project. ```powershell Install-Package ElevenLabs-DotNet-Proxy ``` -------------------------------- ### Setup ASP.NET Core Backend Proxy with ElevenLabs Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Provides a guide for setting up an ASP.NET Core minimal web API as a proxy for the ElevenLabs API. It includes creating a custom authentication filter and configuring the proxy startup to handle requests securely, protecting API keys. ```csharp public partial class Program { private class AuthenticationFilter : AbstractAuthenticationFilter { public override async Task ValidateAuthenticationAsync(IHeaderDictionary request) { await Task.CompletedTask; // remote resource call // You will need to implement your own class to properly test // custom issued tokens you've setup for your end users. if (!request["xi-api-key"].ToString().Contains(TestUserToken)) { throw new AuthenticationException("User is not authorized"); } } } public static void Main(string[] args) { var auth = ElevenLabsAuthentication.LoadFromEnv(); var client = new ElevenLabsClient(auth); ElevenLabsProxyStartup.CreateWebApplication(args, client).Run(); } } ``` -------------------------------- ### Install NuGet Package (dotnet CLI) Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Installs the ElevenLabs-DotNet NuGet package using the .NET Command Line Interface. ```bash dotnet add package ElevenLabs-DotNet ``` -------------------------------- ### ASP.NET Core Minimal API with ElevenLabs Proxy Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/ElevenLabs-DotNet-Proxy/Readme.md Example C# code demonstrating the setup of an ASP.NET Core minimal web API using ElevenLabsProxyStartup. It includes a custom authentication filter inheriting from AbstractAuthenticationFilter and the main program entry point to create and run the proxy web application. ```csharp public partial class Program { private class AuthenticationFilter : AbstractAuthenticationFilter { public override async Task ValidateAuthenticationAsync(IHeaderDictionary request) { await Task.CompletedTask; // remote resource call // You will need to implement your own class to properly test // custom issued tokens you've setup for your end users. if (!request["xi-api-key"].ToString().Contains(TestUserToken)) { throw new AuthenticationException("User is not authorized"); } } } public static void Main(string[] args) { var auth = ElevenLabsAuthentication.LoadFromEnv(); var client = new ElevenLabsClient(auth); ElevenLabsProxyStartup.CreateWebApplication(args, client).Run(); } } ``` -------------------------------- ### Install ElevenLabs-DotNet-Proxy Package Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/ElevenLabs-DotNet-Proxy/Readme.md Commands to add the ElevenLabs-DotNet-Proxy NuGet package to your ASP.NET Core project. Supports installation via PowerShell, the dotnet CLI, or manual editing of the .csproj file. ```powershell Install-Package ElevenLabs-DotNet-Proxy ``` ```bash dotnet add package ElevenLabs-DotNet-Proxy ``` ```xml ``` -------------------------------- ### Install NuGet Package (PowerShell) Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Installs the ElevenLabs-DotNet NuGet package using the Package Manager Console in Visual Studio or PowerShell. ```powershell Install-Package ElevenLabs-DotNet ``` -------------------------------- ### Setup Front-End Client with ElevenLabs Proxy Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Demonstrates how to initialize the ElevenLabs client in a front-end application when using the ElevenLabs-DotNet-Proxy. It involves obtaining a user's authentication token and configuring the client with the proxy's domain for secure API calls. ```csharp var authToken = await LoginAsync(); var auth = new ElevenLabsAuthentication(authToken); var settings = new ElevenLabsClientSettings(domain: "api.your-custom-domain.com"); var api = new ElevenLabsClient(auth, settings); ``` -------------------------------- ### Front End Setup with ElevenLabs-DotNet-Proxy Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/ElevenLabs-DotNet-Proxy/Readme.md Demonstrates how to set up the ElevenLabs client in a front-end application. It involves authenticating users, creating an ElevenLabsAuthentication object with a custom token, and configuring ElevenLabsClientSettings with the backend API domain. ```csharp var authToken = await LoginAsync(); var auth = new ElevenLabsAuthentication(authToken); var settings = new ElevenLabsClientSettings(domain: "api.your-custom-domain.com"); var api = new ElevenLabsClient(auth, settings); ``` -------------------------------- ### Get All Voices Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Fetches a list of all voices accessible to the authenticated account, including custom and pre-existing voices. It then prints details like ID, name, and settings. ```csharp var api = new ElevenLabsClient(); var allVoices = await api.VoicesEndpoint.GetAllVoicesAsync(); foreach (var voice in allVoices) { Console.WriteLine($"{voice.Id} | {voice.Name} | similarity boost: {voice.Settings?.SimilarityBoost} | stability: {voice.Settings?.Stability}"); } ``` -------------------------------- ### Eleven Labs API - Voices Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Details endpoints for managing voices, including retrieving lists of shared or all voices, getting specific voice details, and managing voice settings. ```apidoc GET /v1/voices Retrieves a list of all available voices, including those from the Eleven Labs library and user-created voices. Parameters: (None) Returns: A JSON object containing a list of voice objects, each with ID, name, samples, category, etc. GET /v1/voices/{voice_id} Retrieves detailed information about a specific voice by its ID. Parameters: voice_id (string, required): The ID of the voice to retrieve. Returns: A JSON object containing the details of the specified voice. GET /v1/voices/all Retrieves a list of all voices available to the user, including shared voices. Parameters: (None) Returns: A JSON object containing a list of voice objects. GET /v1/voices/default Retrieves the default voice settings for the user. Parameters: (None) Returns: A JSON object containing default voice settings. POST /v1/voices/{voice_id}/settings/edit Edits the settings for a specific voice. Parameters: voice_id (string, required): The ID of the voice to edit. stability (number, optional): New stability value. clarity (number, optional): New clarity value. style_exaggeration (number, optional): New style exaggeration value. use_streaming (boolean, optional): New use streaming value. Returns: A JSON object confirming the updated settings. POST /v1/voices/add Adds a new custom voice. Parameters: name (string, required): The name for the new voice. files (file, required): Audio files for training the voice. labels (object, optional): Labels for the voice. description (string, optional): Description of the voice. Returns: A JSON object with details of the newly created voice. POST /v1/voices/{voice_id}/edit Edits an existing custom voice. Parameters: voice_id (string, required): The ID of the voice to edit. name (string, optional): New name for the voice. files (file, optional): New audio files for retraining. labels (object, optional): New labels for the voice. description (string, optional): New description for the voice. Returns: A JSON object confirming the updated voice details. DELETE /v1/voices/{voice_id} Deletes a custom voice. Parameters: voice_id (string, required): The ID of the voice to delete. Returns: A JSON object confirming the deletion. GET /v1/voices/{voice_id}/samples Retrieves a list of audio samples for a specific voice. Parameters: voice_id (string, required): The ID of the voice. Returns: A JSON object containing a list of sample objects. GET /v1/voices/{voice_id}/samples/{sample_id}/download Downloads a specific audio sample for a voice. Parameters: voice_id (string, required): The ID of the voice. sample_id (string, required): The ID of the sample to download. Returns: Audio data of the sample. DELETE /v1/voices/{voice_id}/samples/{sample_id} Deletes a specific audio sample for a voice. Parameters: voice_id (string, required): The ID of the voice. sample_id (string, required): The ID of the sample to delete. Returns: A JSON object confirming the deletion. ``` -------------------------------- ### Get Default Voice Settings Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Retrieves the global default settings for voice generation, such as default stability and similarity boost values. These settings can be overridden on a per-voice basis. ```csharp var api = new ElevenLabsClient(); var result = await api.VoicesEndpoint.GetDefaultVoiceSettingsAsync(); Console.WriteLine($"stability: {result.Stability} | similarity boost: {result.SimilarityBoost}"); ``` -------------------------------- ### Get Voice Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Retrieves details for a specific voice using its unique ID. This includes the voice's ID, name, and a URL for a preview clip. ```csharp var api = new ElevenLabsClient(); var voice = await api.VoicesEndpoint.GetVoiceAsync("voiceId"); Console.WriteLine($"{voice.Id} | {voice.Name} | {voice.PreviewUrl}"); ``` -------------------------------- ### Get Shared Voices Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Retrieves a list of voices that are publicly shared in the ElevenLabs voice library. It iterates through the results and prints details for each voice. ```csharp var api = new ElevenLabsClient(); var results = await api.SharedVoicesEndpoint.GetSharedVoicesAsync(); foreach (var voice in results.Voices) { Console.WriteLine($"{voice.OwnerId} | {voice.VoiceId} | {voice.Date} | {voice.Name}"); } ``` -------------------------------- ### Stream Text To Speech Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Streams text to speech, allowing for real-time processing or saving chunks of audio data as they arrive. This example writes the streamed audio to an MP3 file. ```csharp var api = new ElevenLabsClient(); var text = "The quick brown fox jumps over the lazy dog."; var voice = (await api.VoicesEndpoint.GetAllVoicesAsync()).FirstOrDefault(); string fileName = "myfile.mp3"; using var outputFileStream = File.OpenWrite(fileName); var request = new TextToSpeechRequest(voice, text); var voiceClip = await api.TextToSpeechEndpoint.TextToSpeechAsync(request, partialClipCallback: async (partialClip) => { // Write the incoming data to the output file stream. // Alternatively you can play this clip data directly. await outputFileStream.WriteAsync(partialClip.ClipData); }); ``` -------------------------------- ### ElevenLabs History Endpoint API Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Provides access to synthesized audio clips and their metadata. Users can retrieve lists of history items, get details for a specific item, download audio clips, download multiple items, and delete individual history entries. ```APIDOC History Endpoint: GetHistoryAsync() - Retrieves metadata for all previously synthesized audio clips. - Returns: A Task that returns an IEnumerable. GetHistoryItemAsync(string itemId) - Retrieves detailed information about a specific history item. - Parameters: - itemId: The unique identifier of the history item. - Returns: A Task that returns a HistoryItem. DownloadHistoryAudioAsync(HistoryItem item) - Downloads the audio data for a specific history item. - Parameters: - item: The HistoryItem object for which to download audio. - Returns: A Task that returns a VoiceClip containing the audio data. DownloadHistoryItemsAsync() - Downloads the last 100 history items or a specified collection of items. - Returns: A Task that returns an IEnumerable. DeleteHistoryItemAsync(HistoryItem item) - Deletes a specific history item. - Parameters: - item: The HistoryItem object to delete. - Returns: A Task that returns a boolean indicating success. ``` -------------------------------- ### ElevenLabsClient Constructor with API Key (C#) Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Demonstrates how to instantiate the ElevenLabsClient by directly passing the API key to the constructor. ```csharp var api = new ElevenLabsClient("yourApiKey"); ``` -------------------------------- ### ElevenLabsClient Constructor with Authentication Object (C#) Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Shows how to create an instance of ElevenLabsClient using a dedicated ElevenLabsAuthentication object, providing the API key. ```csharp var api = new ElevenLabsClient(new ElevenLabsAuthentication("yourApiKey")); ``` -------------------------------- ### ElevenLabsAuthentication Load from Configuration File (C#) Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Illustrates loading API keys from a configuration file, typically named '.elevenlabs', which can be located in the current directory or parent directories. ```csharp var api = new ElevenLabsClient(ElevenLabsAuthentication.LoadFromDirectory("your/path/to/.elevenlabs")); ``` -------------------------------- ### ElevenLabsAuthentication Load from Environment Variables (C#) Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Explains how to load the API key from system environment variables, specifically using the 'ELEVEN_LABS_API_KEY' variable. ```csharp var api = new ElevenLabsClient(ElevenLabsAuthentication.LoadFromEnv()); ``` -------------------------------- ### Eleven Labs API - Text to Speech Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Provides details on the Text to Speech API endpoint for generating audio from text. Includes parameters for voice selection, text content, and optional settings like stability and clarity. ```apidoc POST /v1/text-to-speech/{voice_id} Generates audio from the provided text using a specified voice. Parameters: voice_id (string, required): The ID of the voice to use for synthesis. text (string, required): The text content to convert to speech. model_id (string, optional): The ID of the model to use. Defaults to the model associated with the voice. voice_settings (object, optional): Settings for voice generation. stability (number, optional): Controls the stability of the generated speech (0.0 to 1.0). clarity (number, optional): Controls the clarity of the generated speech (0.0 to 1.0). use_streaming (boolean, optional): If true, the response will be streamed. Returns: Audio data (e.g., MP3, PCM) or a stream of audio data if use_streaming is true. Example: // C# Example (conceptual) var response = await elevenLabsClient.TextToSpeech.TextToSpeechAsync( voiceId: "your_voice_id", text: "Hello, world!", voiceSettings: new VoiceSettings { Stability = 0.5f, Clarity = 0.7f } ); // Process audio response... ``` -------------------------------- ### Download Voice Sample Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Downloads a specific audio sample associated with a voice. The sample data is returned as a byte array, which can then be saved to a file. ```csharp var api = new ElevenLabsClient(); var voiceClip = await api.VoicesEndpoint.DownloadVoiceSampleAsync(voice, sample); await File.WriteAllBytesAsync($"{voiceClip.Id}.mp3", voiceClip.ClipData.ToArray()); ``` -------------------------------- ### Add Voice Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Creates a new custom voice by providing a name, a list of audio sample paths, and optional labels. This is typically used for cloning a voice from provided audio samples. ```csharp var api = new ElevenLabsClient(); var labels = new Dictionary { { "accent", "american" } }; var audioSamplePaths = new List(); var voice = await api.VoicesEndpoint.AddVoiceAsync("Voice Name", audioSamplePaths, labels); ``` -------------------------------- ### ElevenLabs Authentication Configuration File Format Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Specifies the JSON format for the '.elevenlabs' configuration file used to store API keys. ```json { "apiKey": "yourApiKey" } ``` -------------------------------- ### Eleven Labs API - History Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Details endpoints for accessing and managing the user's audio generation history, including downloading audio files and deleting history items. ```apidoc GET /v1/history Retrieves a list of recent audio generation history items. Parameters: page_size (integer, optional): Number of items per page. page_number (integer, optional): Page number to retrieve. start_date (string, optional): Start date for filtering history (YYYY-MM-DD). end_date (string, optional): End date for filtering history (YYYY-MM-DD). voice_id (string, optional): Filter history by voice ID. character_id (string, optional): Filter history by character ID. history_item_id (string, optional): Filter history by specific history item ID. Returns: A JSON object containing a list of history items. GET /v1/history/{history_item_id} Retrieves details for a specific history item. Parameters: history_item_id (string, required): The ID of the history item. Returns: A JSON object with details of the history item. GET /v1/history/{history_item_id}/audio Downloads the audio file associated with a specific history item. Parameters: history_item_id (string, required): The ID of the history item. Returns: Audio data of the generated speech. POST /v1/history/download Downloads multiple history items as a ZIP archive. Parameters: history_item_ids (array of strings, required): List of history item IDs to download. Returns: A ZIP archive containing the requested audio files. DELETE /v1/history/{history_item_id} Deletes a specific history item. Parameters: history_item_id (string, required): The ID of the history item to delete. Returns: A JSON object confirming the deletion. ``` -------------------------------- ### Eleven Labs API - Dubbing Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Details endpoints for the dubbing feature, allowing users to generate dubbed versions of audio content, including metadata and transcript retrieval. ```apidoc POST /v1/dubbing Creates a dubbing project for a given audio file and target languages. Parameters: audio (file, required): The audio file to dub. target_lang (string, required): The target language code (e.g., 'en', 'es'). source_lang (string, optional): The source language code. name (string, optional): Name for the dubbing project. model_id (string, optional): Model to use for dubbing. Returns: A JSON object with the dubbing project ID and status. GET /v1/dubbing/{dubbing_id}/metadata Retrieves metadata for a specific dubbing project. Parameters: dubbing_id (string, required): The ID of the dubbing project. Returns: A JSON object containing dubbing project metadata. GET /v1/dubbing/{dubbing_id}/transcript Retrieves the transcript for a specific dubbing project. Parameters: dubbing_id (string, required): The ID of the dubbing project. Returns: A JSON object containing the transcript. GET /v1/dubbing/{dubbing_id}/download Downloads the dubbed audio file for a project. Parameters: dubbing_id (string, required): The ID of the dubbing project. Returns: Audio data of the dubbed file. DELETE /v1/dubbing/{dubbing_id} Deletes a dubbing project. Parameters: dubbing_id (string, required): The ID of the dubbing project. Returns: A JSON object confirming the deletion. ``` -------------------------------- ### Eleven Labs API - User Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Details endpoints for retrieving user-specific information, including account details and subscription status. ```apidoc GET /v1/user Retrieves information about the current user's account. Parameters: (None) Returns: A JSON object containing user details like email, character count, etc. GET /v1/user/subscription Retrieves information about the current user's subscription plan. Parameters: (None) Returns: A JSON object containing subscription details like plan name, limits, usage, etc. ``` -------------------------------- ### ElevenLabs Dubbing Endpoint API Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Manages audio and video dubbing processes. Supports dubbing from URIs or local files, retrieving project metadata, downloading dubbed content in MP4/MP3 formats, fetching transcripts (e.g., SRT), and deleting dubbing projects. Progress updates are provided during the dubbing process. ```APIDOC Dubbing Endpoint: DubAsync(DubbingRequest request, IProgress progress) - Dubs an audio or video file into a target language. - Parameters: - request: DubbingRequest object containing source (URI or file path), target language, source language, and optional parameters like model and speaking rate. - progress: An optional IProgress to monitor the dubbing status (e.g., 'dubbing', 'dubbed'). - Returns: A Task that completes when the dubbing process is initiated, returning DubbingProjectMetadata. GetDubbingProjectMetadataAsync(string dubbingId) - Retrieves metadata for a specific dubbing project. - Parameters: - dubbingId: The unique identifier of the dubbing project. - Returns: A Task that returns DubbingProjectMetadata. GetDubbedFileAsync(string dubbingId, string targetLanguage) - Streams the dubbed file. - Parameters: - dubbingId: The unique identifier of the dubbing project. - targetLanguage: The language code of the dubbed file. - Returns: An IAsyncEnumerable representing the streamed file content. Videos are MP4, audio-only are MP3. GetTranscriptForDubAsync(string dubbingId, string targetLanguage) - Retrieves the transcript for a dubbing project in the desired format. - Parameters: - dubbingId: The unique identifier of the dubbing project. - targetLanguage: The language code of the transcript. - Returns: A Task that returns the transcript content as a string (e.g., SRT format). DeleteDubbingProjectAsync(string dubbingId) - Deletes a specified dubbing project. - Parameters: - dubbingId: The unique identifier of the dubbing project to delete. - Returns: A Task that completes when the project is deleted. ``` -------------------------------- ### ElevenLabs User Endpoint API Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Enables access to user account information and subscription status. Users can retrieve details about their account and current subscription plan. ```APIDOC User Endpoint: GetUserInfoAsync() - Retrieves information about the user's account. - Returns: A Task that returns UserInfo. GetSubscriptionInfoAsync() - Retrieves information about the user's current subscription plan. - Returns: A Task that returns SubscriptionInfo. ``` -------------------------------- ### ElevenLabs Sound Generation API Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Generates sound effects from text descriptions using advanced AI audio models. This endpoint allows users to create custom audio clips based on textual prompts. ```APIDOC SoundGeneration Endpoint: GenerateSoundAsync(SoundGenerationRequest request) - Generates a sound clip based on a text description. - Parameters: - request: SoundGenerationRequest object containing the text prompt for the sound. - Returns: A Task that returns the generated audio clip. ``` -------------------------------- ### Text to Speech Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Converts provided text into speech using a specified voice. The output is saved as an MP3 file. ```csharp var api = new ElevenLabsClient(); var text = "The quick brown fox jumps over the lazy dog."; var voice = (await api.VoicesEndpoint.GetAllVoicesAsync()).FirstOrDefault(); var request = new TextToSpeechRequest(voice, text); var voiceClip = await api.TextToSpeechEndpoint.TextToSpeechAsync(request); await File.WriteAllBytesAsync($"{voiceClip.Id}.mp3", voiceClip.ClipData.ToArray()); ``` -------------------------------- ### Edit Voice Settings Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Modifies the generation settings (e.g., stability, similarity boost) for an existing voice. Returns a boolean indicating success. ```csharp var api = new ElevenLabsClient(); var success = await api.VoicesEndpoint.EditVoiceSettingsAsync(voice, new VoiceSettings(0.7f, 0.7f)); Console.WriteLine($"Was successful? {success}"); ``` -------------------------------- ### Edit Voice Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Updates an existing custom voice with new audio samples or metadata. It returns a boolean indicating whether the update was successful. ```csharp var api = new ElevenLabsClient(); var labels = new Dictionary { { "age", "young" } }; var audioSamplePaths = new List(); var success = await api.VoicesEndpoint.EditVoiceAsync(voice, audioSamplePaths, labels); Console.WriteLine($"Was successful? {success}"); ``` -------------------------------- ### Delete Voice Sample Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Removes a specific audio sample from a voice using both the voice ID and the sample ID. Returns a boolean indicating if the deletion was successful. ```csharp var api = new ElevenLabsClient(); var success = await api.VoicesEndpoint.DeleteVoiceSampleAsync(voiceId, sampleId); Console.WriteLine($"Was successful? {success}"); ``` -------------------------------- ### Delete Voice Source: https://github.com/rageagainstthepixel/elevenlabs-dotnet/blob/main/README.md Removes a specific voice from the account using its voice ID. Returns a boolean indicating the success of the deletion operation. ```csharp var api = new ElevenLabsClient(); var success = await api.VoicesEndpoint.DeleteVoiceAsync(voiceId); Console.WriteLine($"Was successful? {success}"); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.