{"id":13554860,"url":"https://github.com/DeepLcom/deepl-node","last_synced_at":"2025-04-03T07:33:04.662Z","repository":{"id":40272954,"uuid":"445450399","full_name":"DeepLcom/deepl-node","owner":"DeepLcom","description":"Official Node.js library for the DeepL language translation API. ","archived":false,"fork":false,"pushed_at":"2025-03-19T17:19:06.000Z","size":984,"stargazers_count":392,"open_issues_count":24,"forks_count":25,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-26T04:04:37.600Z","etag":null,"topics":["api","deepl","i18n","javascript","language","nodejs","official","translation","translator"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DeepLcom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-07T08:27:00.000Z","updated_at":"2025-03-19T17:19:10.000Z","dependencies_parsed_at":"2024-02-12T11:31:29.859Z","dependency_job_id":"d068430b-fd31-4632-ad0f-fe528de959c5","html_url":"https://github.com/DeepLcom/deepl-node","commit_stats":{"total_commits":130,"total_committers":7,"mean_commits":"18.571428571428573","dds":"0.20769230769230773","last_synced_commit":"8a4427ad0c7f6010401381dbeae376a2b1f6ffa2"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepLcom%2Fdeepl-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepLcom%2Fdeepl-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepLcom%2Fdeepl-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeepLcom%2Fdeepl-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeepLcom","download_url":"https://codeload.github.com/DeepLcom/deepl-node/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246939137,"owners_count":20857916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","deepl","i18n","javascript","language","nodejs","official","translation","translator"],"created_at":"2024-08-01T12:02:56.394Z","updated_at":"2025-04-03T07:33:04.649Z","avatar_url":"https://github.com/DeepLcom.png","language":"TypeScript","readme":"# deepl-node\n\n[![Version](https://img.shields.io/npm/v/deepl-node.svg)](https://www.npmjs.org/package/deepl-node)\n[![Minimum node.js version](https://img.shields.io/node/v/deepl-node.svg)](https://npmjs.com/package/deepl-node)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blueviolet.svg)](https://github.com/DeepLcom/deepl-node/blob/main/LICENSE)\n\nOfficial Node.js Client Library for the DeepL API.\n\nThe [DeepL API][api-docs] is a language translation API that allows other\ncomputer programs to send texts and documents to DeepL's servers and receive\nhigh-quality translations. This opens a whole universe of opportunities for\ndevelopers: any translation product you can imagine can now be built on top of\nDeepL's best-in-class translation technology.\n\nThe DeepL Node.js library offers a convenient way for applications written for\nNode.js to interact with the DeepL API. We intend to support all API functions\nwith the library, though support for new features may be added to the library\nafter they're added to the API.\n\n## Getting an authentication key\n\nTo use the package, you'll need an API authentication key. To get a key,\n[please create an account here][create-account]. With a DeepL API Free account\nyou can translate up to 500,000 characters/month for free.\n\n## Installation\n\n`npm install deepl-node`\n\n### Requirements\n\nThe package officially supports Node.js version 12, 14, 16, 17, and 18.\n\nStarting in 2024, we will drop support for older Node versions that have reached\nofficial end-of-life. You can find the Node versions and support timelines\n[here][node-version-list].\nTo continue using this library, you should update to Node 18+.\n\n## Usage\n\nImport the package and construct a `Translator`. The first argument is a string\ncontaining your API authentication key as found in your\n[DeepL Pro Account][pro-account].\n\nBe careful not to expose your key, for example when sharing source code.\n\nAn example using `async`/`await` and ES Modules:\n\n```javascript\nimport * as deepl from 'deepl-node';\n\nconst authKey = \"f63c02c5-f056-...\"; // Replace with your key\nconst translator = new deepl.Translator(authKey);\n\n(async () =\u003e {\n    const result = await translator.translateText('Hello, world!', null, 'fr');\n    console.log(result.text); // Bonjour, le monde !\n})();\n```\n\nThis example is for demonstration purposes only. In production code, the\nauthentication key should not be hard-coded, but instead fetched from a\nconfiguration file or environment variable.\n\nIf you are using CommonJS, you should instead require the package:\n\n```javascript\nconst deepl = require('deepl-node');\nconst translator = new deepl.Translator(authKey);\n```\n\n`Translator` accepts options as the second argument, see\n[Configuration](#configuration) for more information.\n\nAll `Translator` functions return promises, and for brevity the examples in this\nfile use `await` and `try`/`catch` blocks, however Promise-chaining is also\npossible:\n\n```javascript\ntranslator\n    .translateText('Hello, world!', null, 'fr')\n    .then((result) =\u003e {\n        console.log(result.text); // Bonjour, le monde !\n    })\n    .catch((error) =\u003e {\n        console.error(error);\n    });\n```\n\nThe package also supports TypeScript:\n\n```typescript\nimport * as deepl from 'deepl-node';\n\n(async () =\u003e {\n    const targetLang: deepl.TargetLanguageCode = 'fr';\n    const results = await translator.translateText(\n        ['Hello, world!', 'How are you?'],\n        null,\n        targetLang,\n    );\n    results.map((result: deepl.TextResult) =\u003e {\n        console.log(result.text); // Bonjour, le monde !\n    });\n})();\n```\n\n### Translating text\n\nTo translate text, call `translateText()`. The first argument is a string\ncontaining the text you want to translate, or an array of strings if you want to\ntranslate multiple texts.\n\nThe second and third arguments are the source and target language codes.\nLanguage codes are **case-insensitive** strings according to ISO 639-1, for\nexample `'de'`, `'fr'`, `'ja''`. Some target languages also include the regional\nvariant according to ISO 3166-1, for example `'en-US'`, or `'pt-BR'`. The source\nlanguage also accepts `null`, to enable auto-detection of the source language.\n\nThe last argument to `translateText()` is optional, and specifies extra\ntranslation options, see [Text translation options](#text-translation-options)\nbelow.\n\n`translateText()` returns a Promise that fulfills with a `TextResult`, or an\narray of `TextResult`s corresponding to your input text(s). `TextResult` has the\nfollowing properties:\n- `text` is the translated text,\n- `detectedSourceLang` is the detected source language code,\n- `billedCharacters` is the number of characters billed for the text.\n- `modelTypeUsed` indicates the translation model used, but is `undefined`\n  unless the `modelType` option is specified.\n\n```javascript\n// Translate text into a target language, in this case, French:\nconst translationResult = await translator.translateText('Hello, world!', 'en', 'fr');\nconsole.log(translationResult.text); // 'Bonjour, le monde !'\n\n// Translate multiple texts into British English:\nconst translations = await translator.translateText(\n    ['お元気ですか？', '¿Cómo estás?'],\n    null,\n    'en-GB',\n);\nconsole.log(translations[0].text); // 'How are you?'\nconsole.log(translations[0].detectedSourceLang); // 'ja'\nconsole.log(translations[0].billedCharacters); // 7 - the number of characters in the source text \"お元気ですか？\"\nconsole.log(translations[1].text); // 'How are you?'\nconsole.log(translations[1].detectedSourceLang); // 'es'\nconsole.log(translations[1].billedCharacters); // 12 - the number of characters in the source text \"¿Cómo estás?\"\n\n// Translate into German with less and more Formality:\nconsole.log(await translator.translateText('How are you?', null, 'de', { formality: 'less' })); // 'Wie geht es dir?'\nconsole.log(await translator.translateText('How are you?', null, 'de', { formality: 'more' })); // 'Wie geht es Ihnen?'\n```\n\n#### Text translation options\n\n-   `splitSentences`: specify how input text should be split into sentences,\n    default: `'on'`.\n    -   `'on'`: input text will be split into sentences using both newlines and\n        punctuation.\n    -   `'off'`: input text will not be split into sentences. Use this for\n        applications where each input text contains only one sentence.\n    -   `'nonewlines'`: input text will be split into sentences using punctuation\n        but not newlines.\n-   `preserveFormatting`: controls automatic-formatting-correction. Set to `true`\n    to prevent automatic-correction of formatting, default: `false`.\n-   `formality`: controls whether translations should lean toward informal or\n    formal language. This option is only available for some target languages, see\n    [Listing available languages](#listing-available-languages). Use the\n    `prefer_*` options to apply formality if it is available for the target  \n    language, or otherwise fallback to the default.\n    - `'less'`: use informal language.\n    - `'more'`: use formal, more polite language.\n    - `'default'`: use default formality.\n    - `'prefer_less'`: use informal language if available, otherwise default.\n    - `'prefer_more'`: use formal, more polite language if available, otherwise default.\n-   `glossary`: specifies a glossary to use with translation, either as a string\n    containing the glossary ID, or a `GlossaryInfo` as returned by\n    `getGlossary()`.\n-   `context`: specifies additional context to influence translations, that is not\n    translated itself. Characters in the `context` parameter are not counted toward billing.\n    See the [API documentation][api-docs-context-param] for more information and\n    example usage.\n-   `modelType`: specifies the type of translation model to use, options are:\n    - `'quality_optimized'`: use a translation model that maximizes translation\n      quality, at the cost of response time. This option may be unavailable for\n      some language pairs.\n    - `'prefer_quality_optimized'`: use the highest-quality translation model \n      for the given language pair.\n    - `'latency_optimized'`: use a translation model that minimizes response\n      time, at the cost of translation quality.\n-   `tagHandling`: type of tags to parse before translation, options are `'html'`\n    and `'xml'`.\n\nThe following options are only used if `tagHandling` is `'xml'`:\n\n-   `outlineDetection`: specify `false` to disable automatic tag detection,\n    default is `true`.\n-   `splittingTags`: list of XML tags that should be used to split text into\n    sentences. Tags may be specified as an array of strings (`['tag1', 'tag2']`),\n    or a comma-separated list of strings (`'tag1,tag2'`). The default is an empty\n    list.\n-   `nonSplittingTags`: list of XML tags that should not be used to split text\n    into sentences. Format and default are the same as for `splittingTags`.\n-   `ignoreTags`: list of XML tags that containing content that should not be\n    translated. Format and default are the same as for `splittingTags`.\n-   `extraRequestParameters`: Extra body parameters to be passed along with the \n    HTTP request. Only string values are permitted.\n    For example: `{'param': 'value', 'param2': 'value2'}`\n\n\n### Translating documents\n\nTo translate documents, call `translateDocument()`. The first and second\narguments are the input and output files. These arguments accept strings\ncontaining file paths, or Streams or FileHandles opened for reading/writing. The\ninput file may also be given as a Buffer containing the file data. Note that if\nthe input file is not given as a file path, then the `filename` option is\nrequired.\n\nThe third and fourth arguments are the source and target language codes, and\nthey work exactly the same as when translating text with `translateText()`.\n\nThe last argument to `translateDocument()` is optional, and specifies extra\ntranslation options, see\n[Document translation options](#document-translation-options) below.\n\n```javascript\n// Translate a formal document from English to German:\ntry {\n    await translator.translateDocument(\n        'Instruction Manual.docx',\n        'Bedienungsanleitung.docx',\n        'en',\n        'de',\n        { formality: 'more' },\n    );\n} catch (error) {\n    // If the error occurs after the document was already uploaded,\n    // documentHandle will contain the document ID and key\n    if (error.documentHandle) {\n        const handle = error.documentHandle;\n        console.log(`Document ID: ${handle.documentId}, ` + `Document key: ${handle.documentKey}`);\n    } else {\n        console.log(`Error occurred during document upload: ${error}`);\n    }\n}\n```\n\n`translateDocument()` wraps multiple API calls: uploading, polling status until\nthe translation is complete, and downloading. If your application needs to\nexecute these steps individually, you can instead use the following functions\ndirectly:\n\n-   `uploadDocument()`,\n-   `getDocumentStatus()` (or `isDocumentTranslationComplete()`), and\n-   `downloadDocument()`\n\n#### Document translation options\n\n-   `formality`: same as in [Text translation options](#text-translation-options).\n-   `glossary`: same as in [Text translation options](#text-translation-options).\n-   `filename`: if the input file is not provided as file path, this option is\n    needed to specify the file extension.\n-   `extraRequestParameters`: same as in [Text translation options](#text-translation-options).\n-   `enableDocumentMinification`: A `bool` value. If set to `true`, the library will try to minify a document \nbefore translating it through the API, sending a smaller document if the file contains a lot of media. This is \ncurrently only supported for `pptx` and `docx` files. See also [Document minification](#document-minification). \n\n#### Document minification\nIn some contexts, one can end up with large document files (e.g. PowerPoint presentations\nor Word files with many contributors, especially in a larger organization). However, the\nDeepL API enforces a limit of 30 MB for most of these files (see Usage Limits in the docs).\nIn the case that most of this size comes from media included in the documents (e.g. images,\nvideos, animations), document minification can help.\nIn this case, the library will create a temporary directory to extract the document into,\nreplace the large media with tiny placeholders, create a minified document, translate that\nvia the API, and re-insert the original media into the original file. Please note that this\nrequires a bit of additional (temporary) disk space, we recommend at least 2x the file size\nof the document to be translated.\n\nTo use document minification, simply pass the option to the `translateDocument()` function:\n```typescript\nawait translator.translateDocument(\n    inFile, outFile, \"en\", \"de\", { enableDocumentMinification: true }\n);\n```\nIn order to use document minification with the lower-level `uploadDocument()`,\n`isDocumentTranslationComplete()` and `downloadDocument()` methods as well as other details,\nsee the `DocumentMinifier` class.\n\n\nCurrently supported document types for minification:\n1. `pptx`\n2. `docx`\n\nCurrently supported media types for minification:\n1. `png`\n2. `jpg`\n3. `jpeg`\n4. `emf`\n5. `bmp`\n6. `tiff`\n7. `wdp`\n8. `svg`\n9. `gif`\n10. `mp4`\n11. `asf`\n12. `avi`\n13. `m4v`\n14. `mpg`\n15. `mpeg`\n16. `wmv`\n17. `mov`\n18. `aiff`\n19. `au`\n20. `mid`\n21. `midi`\n22. `mp3`\n23. `m4a`\n24. `wav`\n25. `wma`\n\n\n### Glossaries\n\nGlossaries allow you to customize your translations using defined terms.\nMultiple glossaries can be stored with your account, each with a user-specified\nname and a uniquely-assigned ID.\n\nYou can create a glossary with your desired terms and name using\n`createGlossary()`. Each glossary applies to a single source-target language\npair. Note: glossaries are only supported for some language pairs, check the\n[DeepL API documentation][api-docs] for more information.\n\n```javascript\n// Create an English to German glossary with two terms:\nconst entries = new deepl.GlossaryEntries({ entries: { artist: 'Maler', prize: 'Gewinn' } });\nconst glossaryEnToDe = await translator.createGlossary('My glossary', 'en', 'de', entries);\n```\n\nYou can also upload a glossary downloaded from the DeepL website using\n`createGlossaryWithCsv()`. Instead of supplying the entries as a dictionary,\nprovide the CSV file as a string containing the file path, or a Stream, Buffer,\nor FileHandle containing the CSV file content:\n\n```javascript\nconst csvFilePath = '/path/to/glossary_file.csv';\nconst glossaryEnToDe = await translator.createGlossaryWithCsv(\n    'My glossary',\n    'en',\n    'de',\n    csvFilePath);\n```\n\nThe [API documentation][api-docs-csv-format] explains the expected CSV format in\ndetail.\n\nFunctions to get, list, and delete stored glossaries are also provided.\n\n```javascript\n// Find details about the glossary named 'My glossary'\nconst glossaries = await translator.listGlossaries();\nconst glossary = glossaries.find((glossary) =\u003e glossary.name == 'My glossary');\nconsole.log(\n    `Glossary ID: ${glossary.glossaryId}, source: ${glossary.sourceLang}, ` +\n        `target: ${glossary.targetLang}, contains ${glossary.entryCount} entries.`,\n);\n```\n\nTo use a glossary when translating text and documents, include the ID\n(or `Glossary` object returned by `listGlossaries()` or `createGlossary()`) in\nthe function call. The source and target languages must match the glossary.\n\n```javascript\nconst resultWithGlossary = await translator.translateText(\n    'The artist was awarded a prize.',\n    'en',\n    'de',\n    { glossary },\n);\nconsole.log(resultWithGlossary.text); // 'Der Maler wurde mit einem Gewinn ausgezeichnet.'\n// Without using a glossary would give:  'Der Künstler wurde mit einem Preis ausgezeichnet.'\n```\n\n### Checking account usage\n\nTo check account usage, use the `getUsage()` function.\n\nThe returned `Usage` object contains up to three usage subtypes, depending on\nyour account type: `character`, `document` and `teamDocument`. For API accounts\n`character` will be defined, the others `undefined`.\n\nEach usage subtypes (if defined) have `count` and `limit` properties giving the\namount used and maximum amount respectively, and the `limitReached()` function\nthat checks if the usage has reached the limit. The top level `Usage` object has\nthe `anyLimitReached()` function to check all usage subtypes.\n\n```javascript\nconst usage = await translator.getUsage();\nif (usage.anyLimitReached()) {\n    console.log('Translation limit exceeded.');\n}\nif (usage.character) {\n    console.log(`Characters: ${usage.character.count} of ${usage.character.limit}`);\n}\nif (usage.document) {\n    console.log(`Documents: ${usage.document.count} of ${usage.document.limit}`);\n}\n```\n\n### Listing available languages\n\nYou can request the list of languages supported by DeepL Translator for text and\ndocuments using the `getSourceLanguages()` and `getTargetLanguages()` functions.\nThey both return an array of `Language` objects.\n\nThe `name` property gives the name of the language in English, and the `code`\nproperty gives the language code. The `supportsFormality` property only appears\nfor target languages, and is a `Boolean` indicating whether the target language\nsupports the optional `formality` parameter.\n\n```javascript\nconst sourceLanguages = await translator.getSourceLanguages();\nfor (let i = 0; i \u003c sourceLanguages.length; i++) {\n    const lang = sourceLanguages[i];\n    console.log(`${lang.name} (${lang.code})`); // Example: 'English (en)'\n}\n\nconst targetLanguages = await translator.getTargetLanguages();\nfor (let i = 0; i \u003c targetLanguages.length; i++) {\n    const lang = targetLanguages[i];\n    if (lang.supportsFormality) {\n        console.log(`${lang.name} (${lang.code}) supports formality`);\n        // Example: 'German (DE) supports formality'\n    }\n}\n```\n\nGlossaries are supported for a subset of language pairs. To retrieve those\nlanguages use the `getGlossaryLanguagePairs()` function, which returns an array\nof `GlossaryLanguagePair` objects. Each has `sourceLang` and `targetLang`\nproperties indicating that that pair of language codes is supported for\nglossaries.\n\n```javascript\nconst glossaryLanguages = await translator.getGlossaryLanguagePairs();\nfor (let i = 0; i \u003c glossaryLanguages.length; i++) {\n    const languagePair = glossaryLanguages[i];\n    console.log(`${languagePair.sourceLang} to ${languagePair.targetLang}`);\n    // Example: 'en to de', 'de to en', etc.\n}\n```\n\n### Writing a Plugin\n\nIf you use this library in an application, please identify the application with\nthe `appInfo` field in the `TranslatorOptions`, which takes the name and version of the app:\n\n```javascript\nconst options = {appInfo: { appName: 'sampleNodeTranslationApp', appVersion: '1.2.3' },};\nconst deepl = new deepl.Translator('YOUR_AUTH_KEY', options);\n```\n\nThis information is passed along when the library makes calls to the DeepL API.\nBoth name and version are required.\n\n### Configuration\n\nThe `Translator` constructor accepts configuration options as a second argument,\nfor example:\n\n```javascript\nconst options = { maxRetries: 5, minTimeout: 10000 };\nconst deepl = new deepl.Translator('YOUR_AUTH_KEY', options);\n```\n\nThe available options are:\n\n-   `maxRetries`: the maximum `Number` of failed HTTP requests to retry, per\n    function call. By default, 5 retries are made. See\n    [Request retries](#request-retries).\n-   `minTimeout`: the `Number` of milliseconds used as connection timeout for each\n    HTTP request retry. The default value is 10000 (10 seconds).\n-   `serverUrl`: `string` containing the URL of the DeepL API, can be overridden\n    for example for testing purposes. By default, the URL is selected based on the\n    user account type (free or paid).\n-   `headers`: extra HTTP headers attached to every HTTP request. By default, no\n    extra headers are used. Note that Authorization and User-Agent headers are\n    added automatically but may be overridden by this option.\n-   `proxy`: define the hostname, and port of the proxy server, and optionally\n    the protocol, and authorization (as an auth object with username and\n    password fields).\n\n### Rephrasing Text\n\nTo rephrase text, call `rephraseText()`. The first argument is a string containing the text you want to rephrase, or an array of strings if you want to rephrase multiple texts.\n\nThe second argument is the target language code. Language codes are **case-insensitive** strings, for example, `'de'`, `'fr'`, `'en'`. The target language code can also be `null` to enable auto-detection of the target language.\n\nThe last two arguments, `writingStyle` and `tone`, are optional and specify the writing style and tone of the rephrased text. Possible values are defined in the `WritingStyle` and `WritingTone` enums.\n\n`rephraseText()` returns a Promise that fulfills with an `Improvement` object or an array of `Improvement` objects corresponding to your input text(s). The `Improvement` object has the following properties:\n- `text`: the rephrased text,\n- `detectedSourceLang`: the detected source language code,\n- `targetLanguage`: the target language code.\n\n```javascript\n// Rephrasing a text in academic style:\nconst rephrasedResult = await deepLClient.rephraseText('This is an example text.', 'en', WritingStyle.ACADEMIC);\nconsole.log(rephrasedResult.text); // The rephrased text in academic style\n\n// Rephrasing multiple texts in a friendly tone:\nconst rephrasedTexts = await deepLClient.rephraseText(\n    ['How are you?', 'What are you doing today?'],\n    'de',\n    null,\n    WritingTone.FRIENDLY,\n);\nconsole.log(rephrasedTexts[0].text); // The rephrased text for \"How are you?\" in a friendly tone\nconsole.log(rephrasedTexts[1].text); // The rephrased text for \"What are you doing today?\" in a friendly tone\n```\n\n\n#### Logging\n\n`deepl-node` logs debug and info messages for every HTTP request and response\nusing the `loglevel` module, to the `'deepl'` logger. You can reconfigure the\nlog level as follows:\n\n```javascript\nimport log from 'loglevel';\n\nlog.getLogger('deepl').setLevel('debug'); // Or 'info'\n```\n\nThe `loglevel` package also supports plugins, see\n[the documentation](https://www.npmjs.com/package/loglevel#plugins).\n\n#### Proxy configuration\n\nYou can configure a proxy by specifying the `proxy` argument when constructing a\n`deepl.Translator`:\n\n```javascript\nconst options = {proxy: {host: 'localhost', port: 3000}};\nconst deepl = new deepl.Translator('YOUR_AUTH_KEY', options);\n```\n\nThe proxy argument is passed to the underlying `axios` request, see the\n[documentation for axios][axios-proxy-docs].\n\n#### Anonymous platform information\n\nBy default, we send some basic information about the platform the client library\nis running on with each request, see [here for an explanation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent).\nThis data is completely anonymous and only used to improve our product, not track\nany individual users. If you do not wish to send this data, you can opt-out when\ncreating your `Translator` object by setting the `sendPlatformInfo` flag in\nthe `TranslatorOptions` to `false` like so:\n\n```javascript\nconst options = {sendPlatformInfo: false};\nconst deepl = new deepl.Translator('YOUR_AUTH_KEY', options);\n```\n\n### Request retries\n\nRequests to the DeepL API that fail due to transient conditions (for example,\nnetwork timeouts or high server-load) will be retried. The maximum number of\nretries can be configured when constructing the `Translator` object using the\n`maxRetries` option. The timeout for each request attempt may be controlled\nusing the `minTimeout` option. An exponential-backoff strategy is used, so\nrequests that fail multiple times will incur delays.\n\n## Issues\n\nIf you experience problems using the library, or would like to request a new\nfeature, please open an [issue][issues].\n\n## Development\n\nWe welcome Pull Requests, please read the\n[contributing guidelines](CONTRIBUTING.md).\n\n### Environment Variables\n\nThere are multiple ways to manage your own environment variables. You can choose what works best for you. Make sure that only the values for one stage (local, prod, etc) are active at one time.\n\n**Using a global .rc file (such as ~/.bashrc):**\n\n```sh\n# Local\nexport DEEPL_MOCK_SERVER_PORT=3000\nexport DEEPL_AUTH_KEY=ANY_VALUE\nexport DEEPL_SERVER_URL=http://localhost:3000\n```\n\n```sh\n# Prod\n# (Make sure to run `unset DEEPL_MOCK_SERVER_PORT` if it was previously assigned a value)\nexport DEEPL_AUTH_KEY={YOUR_API_KEY}\nexport DEEPL_SERVER_URL=https://api.deepl.com\n```\n\n**Using .env file**:\n\n(Benefits include: No need to refresh terminal when changing stages, no need to call `unset` to clear vars, can be used to isolate vars between multiple projects)\n\n- Copy `.env.example` file to a `.env` file \n    - The `.env` file will never be stored in git, so your local credentials will not be shared\n- Edit `.env` file to your own desired variables\n    - If using local mock server, then point to local ports\n\n### Tests\n\nExecute the tests using `npm test`. The tests communicate with the DeepL API\nusing the authentication key defined by the `DEEPL_AUTH_KEY` environment\nvariable.\n\nBe aware that the tests make DeepL API requests that contribute toward your API\nusage.\n\nThe test suite may instead be configured to communicate with the mock-server\nprovided by [deepl-mock][deepl-mock]. Although most test cases work for either,\nsome test cases work only with the DeepL API or the mock-server and will be\notherwise skipped. The test cases that require the mock-server trigger server\nerrors and test the client error-handling. To execute the tests using\ndeepl-mock, run it in another terminal while executing the tests. Execute the\ntests using `npm test` with the `DEEPL_MOCK_SERVER_PORT` and `DEEPL_SERVER_URL`\nenvironment variables defined referring to the mock-server.\n\n[api-docs]: https://www.deepl.com/docs-api?utm_source=github\u0026utm_medium=github-nodejs-readme\n[api-docs-context-param]: https://www.deepl.com/docs-api/translating-text/?utm_source=github\u0026utm_medium=github-nodejs-readme\n[api-docs-csv-format]: https://www.deepl.com/docs-api/managing-glossaries/supported-glossary-formats/?utm_source=github\u0026utm_medium=github-nodejs-readme\n[axios-proxy-docs]: https://axios-http.com/docs/req_config\n[create-account]: https://www.deepl.com/pro?utm_source=github\u0026utm_medium=github-nodejs-readme#developer\n[deepl-mock]: https://www.github.com/DeepLcom/deepl-mock\n[issues]: https://www.github.com/DeepLcom/deepl-node/issues\n[node-version-list]: https://nodejs.dev/en/about/releases/\n[pro-account]: https://www.deepl.com/pro-account/?utm_source=github\u0026utm_medium=github-nodejs-readme\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDeepLcom%2Fdeepl-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDeepLcom%2Fdeepl-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDeepLcom%2Fdeepl-node/lists"}