How can I use LT_API_KEYS_REMOTE?

Hello,
I would like to use an external database to provide the API keys. The database or the program behind it offers a REST API with a “Verify” option but itself need a API Key to authenticate. How can I connect this to Libre Translate?

To use a remote authentication server, your server needs to implement a POST endpoint (specify the URL of the endpoint via LT_API_KEYS_REMOTE) that takes a api_key parameter and returns a JSON response with (optional) char_limit and req_limit values in case of success, or an error field in case of failure.

See LibreTranslate/libretranslate/api_keys.py at main · LibreTranslate/LibreTranslate · GitHub

1 Like