Crate deeprl

source ·
Expand description


Access the DeepL translation engine through a quick and reliable interface. We aim to provide the full suite of tools DeepL offers. See the official docs for detailed resources.


This crate uses a blocking http client, and as such is only suitable for use in synchronous (blocking) applications. If you intend to use the library functions in an async app, there is a crate for that.


Create a new client with a valid API token to access the associated methods. For instance, you may wish to translate a simple text string to some target language.

use deeprl::{DeepL, Language, TextOptions};

let key = std::env::var("DEEPL_API_KEY").unwrap();
let dl = DeepL::new(&key);

// Translate 'good morning' to German
let opt = TextOptions::new(Language::DE);

let text = vec![
    "good morning".to_string(),

let result = dl.translate(opt, text).unwrap();

let translation = &result.translations[0];
assert_eq!(translation.text, "Guten Morgen");

As a helpful sanity check, make sure you’re able to return account usage statistics.

use deeprl::DeepL;

let dl = DeepL::new(

let usage = dl.usage().unwrap();
assert!(usage.character_limit > 0);

let count = usage.character_count;
let limit = usage.character_limit;
println!("Used: {count}/{limit}");
// Used: 42/500000

DeepL also allows translating documents and creating custom glossaries.


This project is licenced under MIT license.


  • Self-implementing type builder



  • Document state
  • Crate error variants
  • Sets whether the translation engine should lean towards formal or informal language
  • Format in which glossary entries are provided
  • Language variants.
  • Language type. Note: this is currently only used when fetching language meta information.
  • Sets whether the translation engine should first split the input into sentences
  • Sets which kind of tags should be handled