OwO-Network / DeepLX

Powerful Free DeepL API, No Token Required
https://ssa.sx/deeplx
MIT License
6.64k stars 533 forks source link

Interoperability support #43

Closed Saiv46 closed 1 year ago

Saiv46 commented 1 year ago

Currently API is incompatible with neither DeepL nor Libretranslate one.

DeepL API: Uses FormData as body, also all paths starts with /v2/

POST /v2/translate HTTP/2
Content-Type: application/x-www-form-urlencoded

text=Hello%2C%20world!&target_lang=DE
200 OK
Content-Type: application/json

{
  "translations": [
    {
      "detected_source_language": "EN",
      "text": "Hallo, Welt!"
    }
  ]
}

Libretranslate API: Have other parameter names

POST /translate HTTP/2
Content-Type: application/json

{
    q: "Hello world!",
    source: "auto",
    target: "de"
}
200 OK
Content-Type: application/json

{
    "detectedLanguage": {
        "confidence": 92,
        "language": "en"
    },
    "translatedText": "Hallo Welt!"
}
missuo commented 1 year ago

I want to know why I want to be compatible. This project is completely independent. If you want the API of this project to be available on other applications, all that needs to be done is for the application to be compatible with DeepLX.