Using the DeepLX public service is the easiest way to get started, as described below:
- Confirmation request format: required for all requests
Content-Type: application/jsonhead - Select a translation engine: DeepL endpoint (
/deepl) or the Google Translate endpoint (/google) - Construct request body: needs to contain
text(Text to be translated),source_lang(source language code) andtarget_lang(target language code) three required fields
Sample code:
cURL way to request DeepL to translate English to Chinese:curl -X POST https://dplx.xi-xu.me/deepl -H "Content-Type: application/json" -d '{ "text": "Hello", "source_lang": "EN", "target_lang": "ZH" }'
Python users can use therequestslibrary to achieve the same functionality, JavaScript developers can use thefetch API. The public service address ishttps://dplx.xi-xu.me, it is recommended to prioritize the use of DeepL endpoints for better quality.
This answer comes from the articleDeepLX: free DeepL and Google Translate API servicesThe































