tryAGI.DeepL 1.0.0

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package tryAGI.DeepL --version 1.0.0
                    
NuGet\Install-Package tryAGI.DeepL -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="tryAGI.DeepL" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="tryAGI.DeepL" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="tryAGI.DeepL" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add tryAGI.DeepL --version 1.0.0
                    
#r "nuget: tryAGI.DeepL, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package tryAGI.DeepL@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=tryAGI.DeepL&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=tryAGI.DeepL&version=1.0.0
                    
Install as a Cake Tool

DeepL

Nuget package dotnet License: MIT Discord

Features 🔥

  • Fully generated C# SDK based on official DeepL 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

using DeepL;

using var client = new DeepLClient(apiKey);

Translate Text

Shows how to translate text between languages using the DeepL API.

using var client = new DeepLClient(apiKey);

// Translate text from English to German using the DeepL API.
var response = await client.TranslateText.TranslateTextAsync(
    request: new TranslateTextRequest
    {
        Text = ["Hello, world!"],
        TargetLang = TargetLanguage.De,
    });

Rephrase Text

Shows how to use the DeepL Write API to rephrase text.

using var client = new DeepLClient(apiKey);

// Use the DeepL Write API to rephrase text for improved style and clarity.
var response = await client.RephraseText.RephraseTextAsync(
    request: new RephraseTextRequest
    {
        Text = ["The weather is very nice today and I think we should go outside."],
        TargetLang = TargetLanguageWrite.EnUs,
    });

Get Usage

Shows how to retrieve account usage information.

using var client = new DeepLClient(apiKey);

// Retrieve your DeepL account usage (character count and limits).
var response = await client.MetaInformation.GetUsageAsync();

List Languages

Shows how to list supported languages.

using var client = new DeepLClient(apiKey);

// List all supported source and target languages.
var languages = await client.MetaInformation.GetLanguagesAsync();

Translate Document

Shows how to translate a document using the upload-poll-download workflow.

using var client = new DeepLClient(apiKey);

// DeepL's document translation follows a three-step workflow:
// 1. Upload the document and specify the target language
// 2. Poll for translation status until complete
// 3. Download the translated document

// Step 1: Upload a text file for translation.
var content = "Hello, world! This is a test document for translation."u8.ToArray();
var uploadResponse = await client.TranslateDocuments.TranslateDocumentAsync(
    targetLang: TargetLanguage.De,
    file: content,
    filename: "test.txt");

// Step 2: Poll until the document translation is complete.
GetDocumentStatusResponse status;
do
{
    await Task.Delay(1000);
    status = await client.TranslateDocuments.GetDocumentStatusAsync(
        documentId: uploadResponse.DocumentId!,
        documentKey1: uploadResponse.DocumentKey!);
}
while (status.Status is GetDocumentStatusResponseStatus.Queued
    or GetDocumentStatusResponseStatus.Translating);

// Step 3: Download the translated document (one-time download).
var translatedBytes = await client.TranslateDocuments.DownloadDocumentAsync(
    documentId: uploadResponse.DocumentId!,
    documentKey1: uploadResponse.DocumentKey!);

var translatedText = System.Text.Encoding.UTF8.GetString(translatedBytes);

Voice Streaming

Shows how to initiate a voice streaming session for real-time translation.

using var client = new DeepLClient(apiKey);

// The DeepL Voice API provides real-time speech translation via WebSocket.
// Step 1: Call the REST endpoint to get an ephemeral WebSocket URL and token.
var response = await client.VoiceAPI.GetVoiceStreamingUrlAsync(
    request: new GetVoiceStreamingUrlRequest
    {
        SourceMediaContentType = VoiceMediaContentType.AudioPcm_Encoding_s16le_Rate_16000,
        SourceLanguage = VoiceSourceLanguage.En,
        TargetLanguages = ["de"],
    });

// Step 2: Connect to the WebSocket URL (`response.StreamingUrl`)
// and stream audio bytes for real-time transcription and translation.
// This example only verifies the REST setup endpoint;
// actual WebSocket streaming requires a separate WebSocket client.

Style Rules

Demonstrates how to create, configure, and manage style rule lists for consistent translation output.

var client = new DeepLClient(apiKey);

// Style rules let you enforce terminology, formatting, and tone
// preferences across translations. They are configured per language.

// ## Create a style rule list

// Create a new style rule list for English with punctuation rules:
var created = await client.StyleRules.CreateStyleRuleListAsync(
    name: "SDK Test Rules",
    language: StyleRuleLanguage.En);

// ## List style rule lists

// Retrieve all style rule lists:
var lists = await client.StyleRules.GetStyleRuleListsAsync(detailed: true);

// ## Update configured rules

// Configure specific rule categories (7 available: DatesAndTimes,
// Formatting, Numbers, Punctuation, SpellingAndGrammar,
// StyleAndTone, Vocabulary):
var updated = await client.StyleRules.UpdateStyleRuleConfiguredRulesAsync(
    styleId: created.StyleId,
    punctuation: new ConfiguredRulesPunctuation());

// ## Clean up

await client.StyleRules.DeleteStyleRuleListAsync(
    styleId: created.StyleId);

Custom Instructions

Shows how to add free-text custom instructions to a style rule list for fine-grained control over translation output.

var client = new DeepLClient(apiKey);

// Custom instructions let you provide free-text rules that
// DeepL applies during translation — for example, enforcing
// terminology conventions or formatting preferences.

// ## Create a style rule list

var styleRule = await client.StyleRules.CreateStyleRuleListAsync(
    name: "Custom Instruction Demo",
    language: StyleRuleLanguage.En);

// ## Add a custom instruction

// Each instruction has a label and a prompt describing the rule:
var instruction = await client.StyleRules.CreateCustomInstructionAsync(
    styleId: styleRule.StyleId,
    label: "Currency formatting",
    prompt: "Always place the currency symbol before the number (e.g. $100, €50).");

// ## Retrieve the instruction

var retrieved = await client.StyleRules.GetCustomInstructionAsync(
    styleId: styleRule.StyleId,
    instructionId: instruction.Id);

// ## Add a source-language-specific instruction

// You can optionally restrict an instruction to a specific
// source language:
var deInstruction = await client.StyleRules.CreateCustomInstructionAsync(
    styleId: styleRule.StyleId,
    label: "German compound nouns",
    prompt: "Keep German compound nouns as a single word in the translation.",
    sourceLanguage: "de");

// ## Clean up

await client.StyleRules.DeleteCustomInstructionAsync(
    styleId: styleRule.StyleId,
    instructionId: deInstruction.Id);

await client.StyleRules.DeleteCustomInstructionAsync(
    styleId: styleRule.StyleId,
    instructionId: instruction.Id);

await client.StyleRules.DeleteStyleRuleListAsync(
    styleId: styleRule.StyleId);

Free API Endpoint

Shows how to use the DeepL Free API endpoint instead of the Pro endpoint.

// DeepL offers two API tiers with different base URLs:
// - Pro:  https://api.deepl.com (default)
// - Free: https://api-free.deepl.com
//
// To use the Free API, pass the base URL to the constructor.
using var freeClient = new DeepLClient(
    apiKey: "test-key",
    baseUri: new System.Uri("https://api-free.deepl.com"));

// The Pro API is the default — no base URL needed.
using var proClient = new DeepLClient(apiKey: "test-key");

Support

Priority place for bugs: https://github.com/tryAGI/DeepL/issues
Priority place for ideas and general questions: https://github.com/tryAGI/DeepL/discussions
Discord: https://discord.gg/Ca2xhfBf3v

Acknowledgments

JetBrains logo

This project is supported by JetBrains through the Open Source Support Program.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1-dev.49 30 9/24/2026
1.0.1-dev.48 40 9/23/2026
1.0.1-dev.47 38 9/22/2026
1.0.1-dev.46 40 9/22/2026
1.0.1-dev.45 52 9/21/2026
1.0.1-dev.44 46 9/18/2026
1.0.1-dev.43 61 9/13/2026
1.0.1-dev.42 62 9/11/2026
1.0.1-dev.41 59 9/11/2026
1.0.1-dev.40 65 9/10/2026
1.0.1-dev.39 66 9/8/2026
1.0.1-dev.38 69 9/8/2026
1.0.1-dev.37 68 9/8/2026
1.0.0 152 6/23/2026
0.0.0-dev.58 75 6/16/2026
0.0.0-dev.52 83 5/21/2026
0.0.0-dev.51 74 5/21/2026
0.0.0-dev.46 73 5/7/2026
0.0.0-dev.29 86 4/1/2026
0.0.0-dev.27 81 3/30/2026
Loading failed